Skip to content

Instantly share code, notes, and snippets.

View winni2k's full-sized avatar

Winni Kretzschmar winni2k

View GitHub Profile
@winni2k
winni2k / readTabix.cpp
Last active August 29, 2015 14:18
Code snippet for including Erik Garrison's tabixpp located at https://github.com/ekg/tabixpp
#include "tabix.hpp"
void anyfunc(){
//tabixed vcf
string inVCF = "input.vcf.gz";
// region
string region = "20:1-4000000";
@winni2k
winni2k / wtccc_haps_reader
Last active August 29, 2015 14:18
Code Snippet for reading WTCCC style haps files quickly
#include <string>
#include <vector>
// untested code, may contain bugs
#if __cplusplus <= 199711L
#error This library needs at least a C++11 compliant compiler
#endif
using namespace std;
@winni2k
winni2k / gist:1ab7f30a1372260ba56f
Last active August 29, 2015 14:18
Find end of first five cols
string::size_type p_last = str.find_first_not_of(" ", 0);
string::size_type p_curr = str.find_first_of(" ", p_last);
// seek to end of header columns (5)
for(int i = 0; i<4; ++i){
p_last = str.find_first_not_of(" ", p_curr);
p_curr = str.find_first_of(" ", p_last);
}
ss.str(line.substr(0, p_last + 1));
@winni2k
winni2k / gist:c00109b4840fc6a8553c
Created April 4, 2015 12:22
Converting WTCCC haps file to tabixed haps
zcat wtccc.haps.gz | tr ' ' '\t' | bgzip -c > wtccc.tabhaps.gz
# first column is the chromosome, third column is position
# these coordinates are 1-base
tabix -s 1 -b 3 wtccc.tabhaps.gz
@winni2k
winni2k / read tabixed haps
Created April 4, 2015 12:32
How to load and parse a tabixed WTCCC haps file
#include "tabix.hpp"
#include <vector>
#include <string>
// untested code
#if __cplusplus <= 199711L
#error This library needs at least a C++11 compliant compiler
#endif
@winni2k
winni2k / unflip.pl
Created July 27, 2015 13:58
Perl script for checking if a WTCCC style haps file has sites that are flipped in comparison to a genotype map file
#!/usr/bin/env perl
=head1 NAME
unflip.pl
=head1 SYNOPSIS
# unflip any sites that do not match between sites.map and haps
unflip.pl -m sites.map < haps > unflipped.haps
@winni2k
winni2k / issue_336_minimal.vcf
Created October 16, 2015 12:16
Minimal VCF showing bug described in issue 336
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##samtoolsVersion=1.2-216-gdffc67f-dirty+htslib-1.2.1-216-gd2ed7e6-dirty
##reference=file:///usr/bio-ref/GRCh38.81/GRCh38.fa
##contig=<ID=1,length=248956422>
#CHROM POS ID REF ALT QUAL FILTER
1 789241 . C G 41.4503 .
1 789262 . G A 36.0809 .
1 789280 . T C 40.0265 .
1 789334 . A T 67 .
@winni2k
winni2k / X.gls.vcf
Created October 31, 2015 18:44
bcftools bug MWE
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=X,length=155270560>
##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version=3>
##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
@winni2k
winni2k / glphase_setup.md
Last active December 3, 2015 10:42
Instructions on getting GSL lib to be found

Making GSL lib headers available to gcc

Findfing the GSL lib header dir

On a linux machine locate should find the header

locate gsl_rng.h

# which returns this on my machine
/data/fenghuang/kretzsch/opt/gsl-1.9/gsl/gsl_rng.h
@winni2k
winni2k / keybase.md
Last active September 28, 2017 14:08
keybase identity assert

Keybase proof

I hereby claim:

  • I am winni2k on github.
  • I am wkretzsch (https://keybase.io/wkretzsch) on keybase.
  • I have a public key whose fingerprint is D159 3C06 9FC7 BC6B F60B 94F1 EF28 1755 138F 2E99

To claim this, I am signing this object: