Struct noodles_vcf::variant::record_buf::builder::Builder
source · pub struct Builder { /* private fields */ }
Expand description
A VCF record builder.
Implementations§
source§impl Builder
impl Builder
sourcepub fn set_reference_sequence_name<N>(self, reference_sequence_name: N) -> Self
pub fn set_reference_sequence_name<N>(self, reference_sequence_name: N) -> Self
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");
sourcepub fn set_variant_start(self, position: Position) -> Self
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));
sourcepub fn set_ids(self, ids: Ids) -> Self
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);
sourcepub fn set_reference_bases<B>(self, reference_bases: B) -> Self
pub fn set_reference_bases<B>(self, reference_bases: B) -> Self
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");
sourcepub fn set_alternate_bases(self, alternate_bases: AlternateBases) -> Self
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);
sourcepub fn set_quality_score(self, quality_score: f32) -> Self
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));
sourcepub fn set_filters(self, filters: Filters) -> Self
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());
sourcepub fn set_info(self, info: Info) -> Self
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);
sourcepub fn set_samples(self, samples: Samples) -> Self
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);
Trait Implementations§
source§impl PartialEq for Builder
impl PartialEq for Builder
impl StructuralPartialEq for Builder
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