Changes

From Genome Analysis Wiki
Jump to: navigation, search

LibStatGen: VCF

1,055 bytes added, 11:07, 13 June 2012
Subsetting Samples
VcfHeader header;
// Subset 1 is delimited by new lines, '\n'.
reader.open("vcfFileName.vcf", header, "subsetFile1.txt", NULL, NULL);
</source>
<source lang="cpp">
VcfHeader header;
// Subset 2 is delimited by ';'
reader.open("vcfFileName.vcf", header, "subsetFile2.txt", NULL, NULL, ';');</source> To select a subset of samples to remove/ignore, when opening the file also specify the name of the file containing the names of the samples to remove/ignore and the delimiter separating the sample names (default is a new line, '\n').<source lang="cpp"> // Open the vcf file for reading. VcfFileReader reader; VcfHeader header; // Subset 1 is delimited by new lines, '\n'. reader.open("vcfFileName.vcf", header, NULL, NULL, "subsetFile1.txt");</source><source lang="cpp"> // Open the vcf file for reading. VcfFileReader reader; VcfHeader header; // Subset 2 is delimited by ';' reader.open("vcfFileName.vcf", header, NULL, NULL, "subsetFile2.txt", ';');</source> If you just have 1 sample to be excluded, you can specify it directly in the open line.<source lang="cpp"> // Open the vcf file for reading. VcfFileReader reader; VcfHeader header; // Subset 1 is delimited by new lines, '\n'. reader.open("vcfFileName.vcf", header, NULL, "BAD_SAMPLE", NULL);
</source>

Navigation menu