Reader

Struct Reader 

Source
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

Source

pub fn has_index(&self) -> bool

Check if this reader has an index available.

Returns true if region queries are supported.

Source

pub fn header_ptr(&self) -> *mut bcf_hdr_t

Get the raw header pointer.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Reader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Reader

§

impl RefUnwindSafe for Reader

§

impl Send for Reader

§

impl !Sync for Reader

§

impl Unpin for Reader

§

impl UnwindSafe for Reader

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,