Struct noodles_sam::alignment::record_buf::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

An alignment record builder.

Implementations§

source§

impl Builder

source

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));
source

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());
source

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));
source

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));
source

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));
source

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);
source

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));
source

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));
source

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);
source

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);
source

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);
source

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);
source

pub fn build(self) -> RecordBuf

Builds the alignment record.

§Examples
use noodles_sam as sam;
let record = sam::alignment::RecordBuf::builder().build();
assert_eq!(record, sam::alignment::RecordBuf::default());

Trait Implementations§

source§

impl Debug for Builder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Builder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more