Function noodles_sam::io::writer::record::write_cigar
source · pub fn write_cigar<W, C>(writer: &mut W, cigar: &C) -> Result<()>
Expand description
Writes a SAM record CIGAR string.
§Examples
use noodles_sam::{
alignment::{
record::cigar::{op::Kind, Op},
record_buf::Cigar,
},
io::writer::record::write_cigar,
};
let mut buf = Vec::new();
let cigar = Cigar::default();
write_cigar(&mut buf, &cigar)?;
assert_eq!(buf, b"*");
let mut buf = Vec::new();
let cigar: Cigar = [Op::new(Kind::Match, 4)].into_iter().collect();
write_cigar(&mut buf, &cigar)?;
assert_eq!(buf, b"4M");
Ok::<_, std::io::Error>(())