Struct noodles_bam::record::cigar::Cigar[][src]

pub struct Cigar(_);
Expand description

BAM record CIGAR.

Implementations

👎 Deprecated since 0.8.0:

Use Cigar::from::<Vec<u32>> instead.

Creates a CIGAR by wrapping raw CIGAR data.

Examples
use noodles_bam::record::Cigar;
let data = vec![0x00000240, 0x00000084]; // 36M8S
let cigar = Cigar::from(data);
assert_eq!(cigar.as_ref(), [0x00000240, 0x00000084]);

Returns the number of CIGAR operations.

Examples
use noodles_bam::record::Cigar;
let cigar = Cigar::default();
assert_eq!(cigar.len(), 0);

Returns whether there are any CIGAR operations.

Examples
use noodles_bam::record::Cigar;
let cigar = Cigar::default();
assert!(cigar.is_empty());

Returns an iterator over the operations in the CIGAR.

Examples
use noodles_bam::record::{cigar::Op, Cigar};
use noodles_sam::record::cigar::op::Kind;

let data = vec![0x00000240, 0x00000084]; // 36M8S
let cigar = Cigar::from(data);

let mut ops = cigar.ops();

assert_eq!(ops.next().transpose()?, Some(Op::new(Kind::Match, 36)?));
assert_eq!(ops.next().transpose()?, Some(Op::new(Kind::SoftClip, 8)?));
assert_eq!(ops.next().transpose()?, None);

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_bam::record::{cigar::Op, Cigar};
use noodles_sam::record::cigar::op::Kind;

let data = vec![0x00000240, 0x00000043, 0x00000084]; // 36M4D8S
let cigar = Cigar::from(data);

assert_eq!(cigar.reference_len()?, 40);

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_bam::record::{cigar::Op, Cigar};
use noodles_sam::record::cigar::op::Kind;

let data = vec![0x00000240, 0x00000043, 0x00000084]; // 36M4D8S
let cigar = Cigar::from(data);

assert_eq!(cigar.read_len()?, 44);

Appends an op to the end of the CIGAR.

Examples
use noodles_bam::record::{cigar::Op, Cigar};
use noodles_sam::record::cigar::op::Kind;

let mut cigar = Cigar::default();

let op = Op::new(Kind::Match, 36)?;
cigar.push(op);

assert_eq!(cigar.as_ref(), [0x00000240]);
Ok::<_, noodles_bam::record::cigar::op::LengthError>(())

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.