Skip to main content

AnnotationTypeView

Struct AnnotationTypeView 

Source
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>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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.

Source

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.

Source

pub fn starts(&self) -> Vec<i64>

Source

pub fn ends(&self) -> Vec<i64>

Source

pub fn option_starts(&self) -> Vec<Option<i64>>

Source

pub fn option_ends(&self) -> Vec<Option<i64>>

Source

pub fn option_lengths(&self) -> Vec<Option<i64>>

Source

pub fn lengths(&self) -> Vec<i64>

Source

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.

Source

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.

Source

pub fn reference_starts(&self) -> Vec<Option<i64>>

Source

pub fn reference_ends(&self) -> Vec<Option<i64>>

Source

pub fn reference_lengths(&self) -> Vec<Option<i64>>

Source

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>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> IntoIterator for &AnnotationTypeView<'a>

Source§

type Item = AnnotationInfo<'a>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<AnnotationInfo<'a>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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> 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> ErasedDestructor for T
where T: 'static,

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more