Struct noodles_sam::alignment::record_buf::Cigar

source ·
pub struct Cigar(/* private fields */);
Expand description

An alignment record CIGAR operations buffer.

Implementations§

source§

impl Cigar

source

pub fn alignment_span(&self) -> usize

Calculates the alignment span over the reference sequence.

This sums the lengths of the CIGAR operations that consume the reference sequence, i.e., alignment matches (M), deletions from the reference (D), skipped reference regions (S), sequence matches (=), and sequence mismatches (X).

§Examples
use noodles_sam::alignment::{
    record::cigar::{op::Kind, Op},
    record_buf::Cigar,
};

let cigar: Cigar = [
    Op::new(Kind::Match, 36),
    Op::new(Kind::Deletion, 4),
    Op::new(Kind::SoftClip, 8),
]
.into_iter()
.collect();

assert_eq!(cigar.alignment_span(), 40);
source

pub fn read_length(&self) -> usize

Calculates the read length.

This sums the lengths of the CIGAR operations that consume the read, i.e., alignment matches (M), insertions to the reference (I), soft clips (S), sequence matches (=), and sequence mismatches (X).

§Examples
use noodles_sam::alignment::{
    record::cigar::{op::Kind, Op},
    record_buf::Cigar,
};

let cigar: Cigar = [
    Op::new(Kind::Match, 36),
    Op::new(Kind::Deletion, 4),
    Op::new(Kind::SoftClip, 8),
]
.into_iter()
.collect();

assert_eq!(cigar.read_length(), 44);

Trait Implementations§

source§

impl AsMut<Vec<Op>> for Cigar

source§

fn as_mut(&mut self) -> &mut Vec<Op>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<[Op]> for Cigar

source§

fn as_ref(&self) -> &[Op]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Cigar for &Cigar

source§

fn is_empty(&self) -> bool

Returns whether there are any operations.
source§

fn len(&self) -> usize

Returns the number of operations.
source§

fn iter(&self) -> Box<dyn Iterator<Item = Result<Op>> + '_>

Returns an iterator over operations.
source§

fn alignment_span(&self) -> Result<usize>

Calculates the alignment span over the reference sequence.
source§

fn read_length(&self) -> Result<usize>

Calculates the read length.
source§

impl Cigar for Cigar

source§

fn is_empty(&self) -> bool

Returns whether there are any operations.
source§

fn len(&self) -> usize

Returns the number of operations.
source§

fn iter(&self) -> Box<dyn Iterator<Item = Result<Op>> + '_>

Returns an iterator over operations.
source§

fn alignment_span(&self) -> Result<usize>

Calculates the alignment span over the reference sequence.
source§

fn read_length(&self) -> Result<usize>

Calculates the read length.
source§

impl Clone for Cigar

source§

fn clone(&self) -> Cigar

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Cigar

source§

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

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

impl Default for Cigar

source§

fn default() -> Cigar

Returns the “default value” for a type. Read more
source§

impl Extend<Op> for Cigar

source§

fn extend<T: IntoIterator<Item = Op>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl From<Cigar> for Vec<Op>

source§

fn from(cigar: Cigar) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Op>> for Cigar

source§

fn from(ops: Vec<Op>) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Op> for Cigar

source§

fn from_iter<T: IntoIterator<Item = Op>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl PartialEq for Cigar

source§

fn eq(&self, other: &Cigar) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> TryFrom<Cigar<'a>> for Cigar

§

type Error = Error

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

fn try_from(Cigar: Cigar<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Cigar

source§

impl StructuralPartialEq for Cigar

Auto Trait Implementations§

§

impl Freeze for Cigar

§

impl RefUnwindSafe for Cigar

§

impl Send for Cigar

§

impl Sync for Cigar

§

impl Unpin for Cigar

§

impl UnwindSafe for Cigar

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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

§

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