Struct noodles_sam::alignment::record_buf::Builder
source · pub struct Builder { /* private fields */ }
Expand description
An alignment record builder.
Implementations§
source§impl Builder
impl Builder
sourcepub fn set_name(self, name: Name) -> Self
pub fn set_name(self, name: Name) -> Self
Sets the read name.
§Examples
use noodles_sam::{self as sam, alignment::record_buf::Name};
let name = Name::from(b"r1");
let record = sam::alignment::RecordBuf::builder()
.set_name(name.clone())
.build();
assert_eq!(record.name(), Some(&name));
sourcepub fn set_flags(self, flags: Flags) -> Self
pub fn set_flags(self, flags: Flags) -> Self
Sets the flags.
§Examples
use noodles_sam::{self as sam, alignment::record::Flags};
let record = sam::alignment::RecordBuf::builder()
.set_flags(Flags::empty())
.build();
assert_eq!(record.flags(), Flags::empty());
sourcepub fn set_reference_sequence_id(self, reference_sequence_id: usize) -> Self
pub fn set_reference_sequence_id(self, reference_sequence_id: usize) -> Self
Sets the reference sequence ID.
§Examples
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_reference_sequence_id(0)
.build();
assert_eq!(record.reference_sequence_id(), Some(0));
sourcepub fn set_alignment_start(self, alignment_start: Position) -> Self
pub fn set_alignment_start(self, alignment_start: Position) -> Self
Sets the alignment start.
§Examples
use noodles_core::Position;
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_alignment_start(Position::MIN)
.build();
assert_eq!(record.alignment_start(), Some(Position::MIN));
sourcepub fn set_mapping_quality(self, mapping_quality: MappingQuality) -> Self
pub fn set_mapping_quality(self, mapping_quality: MappingQuality) -> Self
Sets the mapping quality.
§Examples
use noodles_sam::{self as sam, alignment::record::MappingQuality};
let record = sam::alignment::RecordBuf::builder()
.set_mapping_quality(MappingQuality::MIN)
.build();
assert_eq!(record.mapping_quality(), Some(MappingQuality::MIN));
sourcepub fn set_cigar(self, cigar: Cigar) -> Self
pub fn set_cigar(self, cigar: Cigar) -> Self
Sets the CIGAR operations.
§Examples
use noodles_sam::{
self as sam,
alignment::{
record::cigar::{op::Kind, Op},
record_buf::Cigar,
},
};
let cigar: Cigar = [Op::new(Kind::Match, 4)].into_iter().collect();
let record = sam::alignment::RecordBuf::builder()
.set_cigar(cigar.clone())
.build();
assert_eq!(record.cigar(), &cigar);
sourcepub fn set_mate_reference_sequence_id(
self,
mate_reference_sequence_id: usize
) -> Self
pub fn set_mate_reference_sequence_id( self, mate_reference_sequence_id: usize ) -> Self
Sets the mate reference sequence ID.
§Examples
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_mate_reference_sequence_id(0)
.build();
assert_eq!(record.mate_reference_sequence_id(), Some(0));
sourcepub fn set_mate_alignment_start(self, mate_alignment_start: Position) -> Self
pub fn set_mate_alignment_start(self, mate_alignment_start: Position) -> Self
Sets the mate alignment start.
§Examples
use noodles_core::Position;
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_mate_alignment_start(Position::MIN)
.build();
assert_eq!(record.mate_alignment_start(), Some(Position::MIN));
sourcepub fn set_template_length(self, template_length: i32) -> Self
pub fn set_template_length(self, template_length: i32) -> Self
Sets the template length.
§Examples
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_template_length(4)
.build();
assert_eq!(record.template_length(), 4);
sourcepub fn set_sequence(self, sequence: Sequence) -> Self
pub fn set_sequence(self, sequence: Sequence) -> Self
Sets the sequence.
§Examples
use noodles_sam::{self as sam, alignment::record_buf::Sequence};
let sequence = Sequence::from(b"ACGT");
let record = sam::alignment::RecordBuf::builder()
.set_sequence(sequence.clone())
.build();
assert_eq!(record.sequence(), &sequence);
sourcepub fn set_quality_scores(self, quality_scores: QualityScores) -> Self
pub fn set_quality_scores(self, quality_scores: QualityScores) -> Self
Sets the quality scores.
§Examples
use noodles_sam::{self as sam, alignment::record_buf::QualityScores};
let quality_scores = QualityScores::from(vec![45, 35, 43, 50]);
let record = sam::alignment::RecordBuf::builder()
.set_quality_scores(quality_scores.clone())
.build();
assert_eq!(record.quality_scores(), &quality_scores);
sourcepub fn set_data(self, data: Data) -> Self
pub fn set_data(self, data: Data) -> Self
Sets the data.
§Examples
use noodles_sam::{
self as sam,
alignment::{
record::data::field::Tag,
record_buf::{data::field::Value, Data},
},
};
let data: Data = [(Tag::ALIGNMENT_HIT_COUNT, Value::from(1))]
.into_iter()
.collect();
let record = sam::alignment::RecordBuf::builder()
.set_data(data.clone())
.build();
assert_eq!(record.data(), &data);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more