Struct noodles_vcf::variant::record_buf::builder::Builder

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

A VCF record builder.

Implementations§

source§

impl Builder

source

pub fn set_reference_sequence_name<N>(self, reference_sequence_name: N) -> Self
where N: Into<String>,

Sets the reference sequence name.

§Examples
use noodles_vcf as vcf;

let record = vcf::variant::RecordBuf::builder()
    .set_reference_sequence_name("sq0")
    .build();

assert_eq!(record.reference_sequence_name(), "sq0");
source

pub fn set_variant_start(self, position: Position) -> Self

Sets the variant start position.

§Examples
use noodles_core::Position;
use noodles_vcf as vcf;

let record = vcf::variant::RecordBuf::builder()
    .set_variant_start(Position::MIN)
    .build();

assert_eq!(record.variant_start(), Some(Position::MIN));
source

pub fn set_ids(self, ids: Ids) -> Self

Sets a list of IDs.

§Examples
use noodles_vcf::{self as vcf, variant::record_buf::Ids};

let ids: Ids = [String::from("nd0")].into_iter().collect();

let record = vcf::variant::RecordBuf::builder()
    .set_ids(ids.clone())
    .build();

assert_eq!(record.ids(), &ids);
source

pub fn set_reference_bases<B>(self, reference_bases: B) -> Self
where B: Into<String>,

Sets the reference bases.

§Examples
use noodles_vcf as vcf;

let record = vcf::variant::RecordBuf::builder()
    .set_reference_bases("A")
    .build();

assert_eq!(record.reference_bases(), "A");
source

pub fn set_alternate_bases(self, alternate_bases: AlternateBases) -> Self

Sets the alternate bases.

§Examples
use noodles_vcf::{self as vcf, variant::record_buf::AlternateBases};

let alternate_bases = AlternateBases::from(vec![String::from("C")]);

let record = vcf::variant::RecordBuf::builder()
    .set_alternate_bases(alternate_bases.clone())
    .build();

assert_eq!(record.alternate_bases(), &alternate_bases);
source

pub fn set_quality_score(self, quality_score: f32) -> Self

Sets the quality score.

§Examples
use noodles_vcf as vcf;

let record = vcf::variant::RecordBuf::builder()
    .set_quality_score(13.0)
    .build();

assert_eq!(record.quality_score(), Some(13.0));
source

pub fn set_filters(self, filters: Filters) -> Self

Sets the filters.

§Examples
use noodles_vcf::{self as vcf, variant::record_buf::Filters};

let record = vcf::variant::RecordBuf::builder()
    .set_filters(Filters::pass())
    .build();

assert!(record.filters().is_pass());
source

pub fn set_info(self, info: Info) -> Self

Sets additional information.

§Examples
use noodles_vcf::{
    self as vcf,
    variant::{
        record::info::field::key,
        record_buf::{info::field::Value, Info},
    },
};

let info: Info = [
    (String::from(key::SAMPLES_WITH_DATA_COUNT), Some(Value::Integer(3))),
    (String::from(key::ALLELE_FREQUENCIES), Some(Value::from(vec![Some(0.5)]))),
]
.into_iter()
.collect();

let record = vcf::variant::RecordBuf::builder()
    .set_info(info.clone())
    .build();

assert_eq!(record.info(), &info);
source

pub fn set_samples(self, samples: Samples) -> Self

Sets the list of genotypes.

§Examples
use noodles_vcf::{
    self as vcf,
    variant::{
        record::samples::keys::key,
        record_buf::{samples::{sample::Value, Keys}, Samples},
    },
};

let keys: Keys = [
    String::from(key::GENOTYPE),
    String::from(key::CONDITIONAL_GENOTYPE_QUALITY),
].into_iter().collect();

let samples = Samples::new(
    keys,
    vec![vec![Some(Value::from("0|0")), Some(Value::from(13))]],
);

let record = vcf::variant::RecordBuf::builder()
    .set_samples(samples.clone())
    .build();

assert_eq!(record.samples(), &samples);
source

pub fn build(self) -> RecordBuf

Builds a VCF record.

§Examples
use noodles_vcf as vcf;
let record = vcf::variant::RecordBuf::builder().build();

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
source§

impl PartialEq for Builder

source§

fn eq(&self, other: &Builder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Builder

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, 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.