Struct noodles_tabix::index::reference_sequence::ReferenceSequence
source · [−]pub struct ReferenceSequence { /* private fields */ }
Expand description
A tabix index reference sequence.
Implementations
sourceimpl ReferenceSequence
impl ReferenceSequence
sourcepub fn new(
bins: Vec<Bin>,
intervals: Vec<VirtualPosition>,
metadata: Option<Metadata>
) -> Self
pub fn new(
bins: Vec<Bin>,
intervals: Vec<VirtualPosition>,
metadata: Option<Metadata>
) -> Self
Creates a tabix index reference sequence.
Examples
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
sourcepub fn bins(&self) -> &[Bin]
pub fn bins(&self) -> &[Bin]
Returns the list of bins in the reference sequence.
This list does not include the metadata pseudo-bin (bin 37450). Use Self::metadata
instead.
Examples
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
assert!(reference_sequence.bins().is_empty());
sourcepub fn intervals(&self) -> &[VirtualPosition]
pub fn intervals(&self) -> &[VirtualPosition]
Returns the list of 16 kbp intervals that make up the linear index.
Examples
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
assert!(reference_sequence.intervals().is_empty());
sourcepub fn query<B>(&self, interval: B) -> Result<Vec<&Bin>, QueryError> where
B: RangeBounds<i32>,
pub fn query<B>(&self, interval: B) -> Result<Vec<&Bin>, QueryError> where
B: RangeBounds<i32>,
Returns a list of bins in this reference sequence that intersects the given range.
The interval values are 1-based.
Examples
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
let query_bins = reference_sequence.query(8..=13)?;
assert!(query_bins.is_empty());
sourcepub fn min_offset(&self, start: i32) -> VirtualPosition
pub fn min_offset(&self, start: i32) -> VirtualPosition
Finds in minimum start offset in the linear index for a given start position.
start
is 1-based.
Examples
use noodles_bgzf as bgzf;
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
assert_eq!(reference_sequence.min_offset(13), bgzf::VirtualPosition::from(0));
Trait Implementations
sourceimpl BinningIndex<ReferenceSequence> for Index
impl BinningIndex<ReferenceSequence> for Index
sourcefn reference_sequences(&self) -> &[ReferenceSequence]
fn reference_sequences(&self) -> &[ReferenceSequence]
Returns a list of indexed reference sequences.
Examples
use noodles_csi::BinningIndex;
use noodles_tabix as tabix;
let index = tabix::Index::default();
assert!(index.reference_sequences().is_empty());
sourcefn unplaced_unmapped_record_count(&self) -> Option<u64>
fn unplaced_unmapped_record_count(&self) -> Option<u64>
Returns the number of unplaced, unmapped records in the associated file.
Examples
use noodles_csi::BinningIndex;
use noodles_tabix as tabix;
let index = tabix::Index::default();
assert!(index.unplaced_unmapped_record_count().is_none());
sourcefn query<B>(
&self,
reference_sequence_id: usize,
interval: B
) -> Result<Vec<Chunk>> where
B: RangeBounds<i32> + Clone,
fn query<B>(
&self,
reference_sequence_id: usize,
interval: B
) -> Result<Vec<Chunk>> where
B: RangeBounds<i32> + Clone,
Returns the chunks that overlap with the given region.
sourcefn first_record_in_last_linear_bin_start_position(
&self
) -> Option<VirtualPosition>
fn first_record_in_last_linear_bin_start_position(
&self
) -> Option<VirtualPosition>
Returns the start position of the first record in the last linear bin. Read more
sourceimpl Clone for ReferenceSequence
impl Clone for ReferenceSequence
sourcefn clone(&self) -> ReferenceSequence
fn clone(&self) -> ReferenceSequence
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ReferenceSequence
impl Debug for ReferenceSequence
sourceimpl Default for ReferenceSequence
impl Default for ReferenceSequence
sourcefn default() -> ReferenceSequence
fn default() -> ReferenceSequence
Returns the “default value” for a type. Read more
sourceimpl PartialEq<ReferenceSequence> for ReferenceSequence
impl PartialEq<ReferenceSequence> for ReferenceSequence
sourcefn eq(&self, other: &ReferenceSequence) -> bool
fn eq(&self, other: &ReferenceSequence) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ReferenceSequence) -> bool
fn ne(&self, other: &ReferenceSequence) -> bool
This method tests for !=
.
sourceimpl ReferenceSequenceExt for ReferenceSequence
impl ReferenceSequenceExt for ReferenceSequence
sourcefn metadata(&self) -> Option<&Metadata>
fn metadata(&self) -> Option<&Metadata>
Returns the optional metadata for the reference sequence.
Metadata is parsed from the optional pseudo-bin 37450.
Examples
use noodles_bgzf::VirtualPosition;
use noodles_csi::{binning_index::ReferenceSequenceExt, index::reference_sequence::Metadata};
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::new(Vec::new(), Vec::new(), None);
assert!(reference_sequence.metadata().is_none());
let reference_sequence = ReferenceSequence::new(
Vec::new(),
Vec::new(),
Some(Metadata::new(VirtualPosition::from(610), VirtualPosition::from(1597), 55, 0))
);
assert!(reference_sequence.metadata().is_some());
sourcefn first_record_in_last_linear_bin_start_position(
&self
) -> Option<VirtualPosition>
fn first_record_in_last_linear_bin_start_position(
&self
) -> Option<VirtualPosition>
Returns the start position of the first record in the last linear bin.
Examples
use noodles_bgzf as bgzf;
use noodles_csi::binning_index::ReferenceSequenceExt;
use noodles_tabix::index::ReferenceSequence;
let reference_sequence = ReferenceSequence::default();
assert!(reference_sequence.first_record_in_last_linear_bin_start_position().is_none());
let intervals = vec![bgzf::VirtualPosition::from(8), bgzf::VirtualPosition::from(13)];
let reference_sequence = ReferenceSequence::new(Vec::new(), intervals, None);
assert_eq!(
reference_sequence.first_record_in_last_linear_bin_start_position(),
Some(bgzf::VirtualPosition::from(13))
);
impl Eq for ReferenceSequence
impl StructuralEq for ReferenceSequence
impl StructuralPartialEq for ReferenceSequence
Auto Trait Implementations
impl RefUnwindSafe for ReferenceSequence
impl Send for ReferenceSequence
impl Sync for ReferenceSequence
impl Unpin for ReferenceSequence
impl UnwindSafe for ReferenceSequence
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more