diff --git a/src/bam/ext.rs b/src/bam/ext.rs index c113d2920..614498049 100644 --- a/src/bam/ext.rs +++ b/src/bam/ext.rs @@ -434,6 +434,9 @@ impl BamRecordExtensions for bam::Record { fn reference_start(&self) -> i64 { self.pos() } + + /// Calculate the rightmost base position of an alignment on the reference genome. + /// Returns the coordinate of the first base after the alignment (0-based). fn reference_end(&self) -> i64 { unsafe { htslib::bam_endpos(self.inner_ptr()) } } diff --git a/src/bam/mod.rs b/src/bam/mod.rs index dae37c511..daaf08351 100644 --- a/src/bam/mod.rs +++ b/src/bam/mod.rs @@ -677,7 +677,7 @@ impl IndexedReader { /// /// Both iterating (with [.records()](trait.Read.html#tymethod.records)) and looping without allocation (with [.read()](trait.Read.html#tymethod.read) are a two stage process: /// 1. 'fetch' the region of interest - /// 2. iter/loop trough the reads. + /// 2. iter/loop through the reads. /// /// Example: /// ``` @@ -703,6 +703,8 @@ impl IndexedReader { /// coordinates' expansion), i32, u32, and u64 (with a possible panic! if the coordinate /// won't fit an i64). /// + /// `start` and `stop` are zero-based. `start` is inclusive, `stop` is exclusive. + /// /// This replaces the old fetch and fetch_str implementations. pub fn fetch<'a, T: Into>>(&mut self, fetch_definition: T) -> Result<()> { //this 'compile time redirect' safes us @@ -1037,7 +1039,7 @@ impl Drop for IndexedReader { } } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Format { Sam, Bam, diff --git a/src/bcf/mod.rs b/src/bcf/mod.rs index ef19bfb9c..149ddd9a2 100644 --- a/src/bcf/mod.rs +++ b/src/bcf/mod.rs @@ -632,7 +632,7 @@ pub mod synced { } } -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Format { Vcf, Bcf,