pub struct Reader { /* private fields */ }Expand description
A VCF/BCF file reader with automatic index detection.
Reader provides a unified interface for reading VCF/BCF files.
When opening a file, it automatically checks for index files
(.tbi or .csi) and enables region queries if found.
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn has_index(&self) -> bool
pub fn has_index(&self) -> bool
Check if this reader has an index available.
Returns true if region queries are supported.
Sourcepub fn header_ptr(&self) -> *mut bcf_hdr_t
pub fn header_ptr(&self) -> *mut bcf_hdr_t
Get the raw header pointer.
Sourcepub fn query_region_1based(&mut self, region: &str) -> Result<(), Error>
pub fn query_region_1based(&mut self, region: &str) -> Result<(), Error>
Query by a 1-based region string (e.g., “chr1:1000-2000”).
After calling this, subsequent next_record calls will return
only records overlapping the specified region.
Sourcepub fn query_chrom_start_end(
&mut self,
chrom: &str,
start0: u64,
end0: Option<u64>,
) -> Result<(), Error>
pub fn query_chrom_start_end( &mut self, chrom: &str, start0: u64, end0: Option<u64>, ) -> Result<(), Error>
Query by chromosome and 0-based coordinates.
After calling this, subsequent next_record calls will return
only records overlapping the specified region.
Sourcepub fn query(
&mut self,
region_or_chrom: &str,
start0: Option<u64>,
end0: Option<u64>,
) -> Result<(), Error>
pub fn query( &mut self, region_or_chrom: &str, start0: Option<u64>, end0: Option<u64>, ) -> Result<(), Error>
Query by region string (“chr1:1000-2000”) or by coordinates.
If start0 is None, treat region_or_chrom as a region string.
Otherwise, treat it as a chromosome name with numeric coordinates.
Sourcepub fn next_record(&mut self) -> Result<Option<Record>, Error>
pub fn next_record(&mut self) -> Result<Option<Record>, Error>
Read the next record.
Returns Ok(Some(record)) if a record was read, Ok(None) at EOF,
or Err(...) on error.