Last active
August 29, 2015 14:18
-
-
Save winni2k/9a9ccb9ac45a45392a2c to your computer and use it in GitHub Desktop.
Code snippet for including Erik Garrison's tabixpp located at https://github.com/ekg/tabixpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "tabix.hpp" | |
void anyfunc(){ | |
//tabixed vcf | |
string inVCF = "input.vcf.gz"; | |
// region | |
string region = "20:1-4000000"; | |
// create tabix object | |
Tabix tbx(inVCF); | |
// set region to extract from vcf | |
if (tbx.setRegion(region) != true) | |
throw std::runtime_error("Malformed region string: " + region); | |
// get the header | |
string header; | |
tbx.getHeader(header); | |
// read each line in region | |
while (tbx.getNextLine(line)) { | |
// parse vcf record as string | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment