pub struct AnnotationTypeView<'a> { /* private fields */ }Expand description
View over a specific annotation type, providing the column-oriented
surface fibertools historically got from FiberAnnotations while
delegating per-annotation iteration to the library’s
AnnotationInfo.
Stays valid when the type is absent: every accessor returns an empty
Vec / zero count, so call sites avoid Option plumbing.
All accessors and the per-annotation iterator yield results in BAM-orient ascending order. The spec stores annotations in molecular order; for reverse-aligned reads we reverse so consumers (BED12 blocks, pileup intervals, TSV columns) get ascending output.
Implementations§
Source§impl<'a> AnnotationTypeView<'a>
impl<'a> AnnotationTypeView<'a>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn infos(&self) -> &[AnnotationInfo<'a>]
pub fn infos(&self) -> &[AnnotationInfo<'a>]
Borrow the memoized infos directly, BAM-orient ascending. Lets hot
loops scan query coordinates without the per-call Vec allocation
that the column accessors incur.
Sourcepub fn count_query_in(&self, start: i64, end: i64) -> usize
pub fn count_query_in(&self, start: i64, end: i64) -> usize
Count annotations whose BAM-orient query_start falls in
[start, end). Allocation-free over the memoized infos.
pub fn starts(&self) -> Vec<i64>
pub fn ends(&self) -> Vec<i64>
pub fn option_starts(&self) -> Vec<Option<i64>>
pub fn option_ends(&self) -> Vec<Option<i64>>
pub fn option_lengths(&self) -> Vec<Option<i64>>
pub fn lengths(&self) -> Vec<i64>
Sourcepub fn qual(&self) -> Vec<u8> ⓘ
pub fn qual(&self) -> Vec<u8> ⓘ
Convenience over Self::qual_at for the common case where the
annotation type carries at most one quality per annotation. Returns
0 for annotations with no qualities.
All fibertools-rs annotation types (nuc, msp+ / msp+Q,
fire+P, m6a+Q, cpg+Q) are single-quality; this method debug-
asserts that invariant. If you add a multi-quality type, call
Self::qual_at with an explicit index instead — qual()
silently dropping quality columns would be a footgun.
Sourcepub fn qual_at(&self, idx: usize) -> Vec<u8> ⓘ
pub fn qual_at(&self, idx: usize) -> Vec<u8> ⓘ
Per-annotation quality at the given index, BAM-orient ascending.
Returns 0 when the annotation has fewer than idx + 1 qualities.
qual_at(0) is the canonical single-quality accessor and
debug-asserts that the type has at most one quality. Other indices
skip the assertion — the caller is presumed to know the type’s
QualitySpec.
pub fn reference_starts(&self) -> Vec<Option<i64>>
pub fn reference_ends(&self) -> Vec<Option<i64>>
pub fn reference_lengths(&self) -> Vec<Option<i64>>
Sourcepub fn iter(&self) -> IntoIter<AnnotationInfo<'a>>
pub fn iter(&self) -> IntoIter<AnnotationInfo<'a>>
Iterate per-annotation in BAM-orient ascending order, yielding the
library’s AnnotationInfo view directly. Call sites read fields
like info.query_start, info.ref_start, info.qualities.
Trait Implementations§
Source§impl<'a> Debug for AnnotationTypeView<'a>
impl<'a> Debug for AnnotationTypeView<'a>
Source§impl<'a> IntoIterator for &AnnotationTypeView<'a>
impl<'a> IntoIterator for &AnnotationTypeView<'a>
Auto Trait Implementations§
impl<'a> !Freeze for AnnotationTypeView<'a>
impl<'a> !RefUnwindSafe for AnnotationTypeView<'a>
impl<'a> !Sync for AnnotationTypeView<'a>
impl<'a> Send for AnnotationTypeView<'a>
impl<'a> Unpin for AnnotationTypeView<'a>
impl<'a> UnsafeUnpin for AnnotationTypeView<'a>
impl<'a> UnwindSafe for AnnotationTypeView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.