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.
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
Auto Trait Implementations
impl RefUnwindSafe for Cigar
impl UnwindSafe for Cigar
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.