pub fn reference_len(&self) -> io::Result<u32> {
        let mut len = 0;

        for result in self.ops() {
            let op = result?;

            match op.kind() {
                Kind::Match | Kind::Deletion | Kind::Skip | Kind::SeqMatch | Kind::SeqMismatch => {
                    len += op.len();
                }
                _ => {}
            }
        }

        Ok(len)
    }
/// 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 std::io;
/// 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);
/// # Ok::<(), io::Error>(())
/// ```
Calculates the alignment span over the reference sequence.
Calculates the alignment span over the reference sequence .
pub fn reference_len(&self) -> io::Result<u32> {
        let mut len = 0;
        for result in self.ops() {
            let op = result?;
            match op.kind() {
                Kind::Match | Kind::Deletion | Kind::Skip | Kind::SeqMatch | Kind::SeqMismatch => {
                    len += op.len();
                }
                _ => {}
            }
        }
        Ok(len)
    }
pub fn reference_len ( & self ) -> io :: Result < u32 > { let mut len = 0 ; for result in self . ops ( ) { let op = result ? ; match op . kind ( ) { Kind :: Match | Kind :: Deletion | Kind :: Skip | Kind :: SeqMatch | Kind :: SeqMismatch => { len += op . len ( ) ; } _ => { } } } Ok ( len ) }
Calculates the alignment span over the reference sequence.
Calculates the alignment span over the reference sequence .
&self
&self
examples
None
use std::io;
use noodles_bam::record::{cigar::Op, Cigar};
use noodles_sam::record::cigar::op::Kind.



assert_eq!(cigar.reference_len()?, 40).
use noodles_bam :: record :: { cigar :: Op Cigar } ; use noodles_sam :: record :: cigar :: op :: Kind . assert_eq! ( cigar . reference_len () ? 40 ) .
ok::<(), io::error>(())
None