Struct rust_htslib::bam::record::CigarString [−][src]
Expand description
A CIGAR string. This type wraps around a Vec<Cigar>.
Example
use rust_htslib::bam::record::{Cigar, CigarString}; let cigar = CigarString(vec![Cigar::Match(100), Cigar::SoftClip(10)]); // access by index assert_eq!(cigar[0], Cigar::Match(100)); // format into classical string representation assert_eq!(format!("{}", cigar), "100M10S"); // iterate for op in &cigar { println!("{}", op); }
Implementations
Create a CigarStringView from this CigarString at position pos
Calculate the bam cigar from the alignment struct. x is the target string
and y is the reference. hard_clip controls how unaligned read bases are encoded in the
cigar string. Set to true to use the hard clip (H) code, or false to use soft clip
(S) code. See the SAM spec for more details.
Trait Implementations
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Create a CigarString from given &u8.
Example
use rust_htslib::bam::record::*; use rust_htslib::bam::record::CigarString; use rust_htslib::bam::record::Cigar::*; use std::convert::TryFrom; let cigar_str = "2H10M5X3=2H".as_bytes(); let cigar = CigarString::try_from(cigar_str) .expect("Unable to parse cigar string."); let expected_cigar = CigarString(vec![ HardClip(2), Match(10), Diff(5), Equal(3), HardClip(2), ]); assert_eq!(cigar, expected_cigar);
Create a CigarString from given &str.
Example
use rust_htslib::bam::record::*; use rust_htslib::bam::record::CigarString; use rust_htslib::bam::record::Cigar::*; use std::convert::TryFrom; let cigar_str = "2H10M5X3=2H"; let cigar = CigarString::try_from(cigar_str) .expect("Unable to parse cigar string."); let expected_cigar = CigarString(vec![ HardClip(2), Match(10), Diff(5), Equal(3), HardClip(2), ]); assert_eq!(cigar, expected_cigar);
Auto Trait Implementations
impl RefUnwindSafe for CigarStringimpl Send for CigarStringimpl Sync for CigarStringimpl Unpin for CigarStringimpl UnwindSafe for CigarStringBlanket Implementations
Mutably borrows from an owned value. Read more