pub struct Builder { /* private fields */ }
Expand description
An alignment record builder.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn set_name<N>(self, name: N) -> Self
pub fn set_name<N>(self, name: N) -> Self
Sets the read name.
§Examples
use bstr::ByteSlice;
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder()
.set_name("r1")
.build();
assert_eq!(record.name(), Some(b"r1".as_bstr()));
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