From Genome Analysis Wiki
Jump to: navigation, search

LibStatGen: VCF

462 bytes added, 17:12, 18 April 2012
Read only Certain Sections of the File / Using a VCF Index (TABIX) File
bool setReadSection(const char* chromName);
bool set1BasedReadSection(const char* chromName,
int32_t start, int32_t end, bool overlap = false);
Both methods currently always return true, since in the current implementation this can't fail. It currently allows the VcfIndex file to be read after this call.
<code>set1BasedReadSection</code> will set the code to read the specified chromosome starting at the specified 1-based position up to, but not including, the specified 1-based end position. On the first <code>readRecord</code> call it will jump the file to the beginning of this section. It will continue to read the section for each <code>readRecord</code> call made until it has read the entire section. Once the entire section has been read, <code>readRecord</code> will return false until a new read section is specified.
<code>set1BasedReadSection</code> takes an optional parameter, <code>overlap</code>. It is defaulted to false which means that only records that start within the specified region will be returned by <code>readRecord</code>. If <code>overlap</code> is set to true, <code>readRecord</code> will also return records that start prior to the specified region, but whose deletions occur in the specified region.
Implementation NOTE: internally it may read extra records prior to the section, but <code>readRecord</code> will keep reading and will not return until it finds a record in the section or until the section has been passed (no records in the section).

Navigation menu