pub struct RecordBuf { /* private fields */ }
Expand description
A variant record buffer.
Implementations§
Source§impl RecordBuf
impl RecordBuf
Sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Returns a builder to create a record from each of its fields.
§Examples
use noodles_vcf as vcf;
let builder = vcf::variant::RecordBuf::builder();
Sourcepub fn reference_sequence_name(&self) -> &str
pub fn reference_sequence_name(&self) -> &str
Returns 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 reference_sequence_name_mut(&mut self) -> &mut String
pub fn reference_sequence_name_mut(&mut self) -> &mut String
Returns a mutable reference to the reference sequence name.
§Examples
use noodles_vcf as vcf;
let mut record = vcf::variant::RecordBuf::builder()
.set_reference_sequence_name("sq0")
.build();
*record.reference_sequence_name_mut() = String::from("sq1");
assert_eq!(record.reference_sequence_name(), "sq1");
Sourcepub fn variant_start(&self) -> Option<Position>
pub fn variant_start(&self) -> Option<Position>
Returns the variant start position.
This position is 1-based, inclusive. If the record represents the start of a telomeric
breakend, this returns None
.
§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 variant_start_mut(&mut self) -> &mut Option<Position>
pub fn variant_start_mut(&mut self) -> &mut Option<Position>
Returns a mutable reference to the variant start position.
This position is 1-based, inclusive. If the record represents the start of a telomeric
breakend, this returns None
.
§Examples
use noodles_core::Position;
use noodles_vcf as vcf;
let mut record = vcf::variant::RecordBuf::default();
*record.variant_start_mut() = Some(Position::MIN);
assert_eq!(record.variant_start(), Some(Position::MIN));
Sourcepub fn ids(&self) -> &Ids
pub fn ids(&self) -> &Ids
Returns a list of IDs of the record.
§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 ids_mut(&mut self) -> &mut Ids
pub fn ids_mut(&mut self) -> &mut Ids
Returns a mutable reference to the IDs.
§Examples
use noodles_vcf::{self as vcf, variant::record_buf::Ids};
let mut record = vcf::variant::RecordBuf::default();
let ids: Ids = [String::from("nd0")].into_iter().collect();
*record.ids_mut() = ids.clone();
assert_eq!(record.ids(), &ids);
Sourcepub fn reference_bases(&self) -> &str
pub fn reference_bases(&self) -> &str
Returns the reference bases of the record.
§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 reference_bases_mut(&mut self) -> &mut String
pub fn reference_bases_mut(&mut self) -> &mut String
Returns a mutable reference to the reference bases of the record.
§Examples
use noodles_vcf as vcf;
let mut record = vcf::variant::RecordBuf::builder()
.set_reference_bases("A")
.build();
*record.reference_bases_mut() = String::from("T");
assert_eq!(record.reference_bases(), "T");
Sourcepub fn alternate_bases(&self) -> &AlternateBases
pub fn alternate_bases(&self) -> &AlternateBases
Returns the alternate bases of the record.
§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 alternate_bases_mut(&mut self) -> &mut AlternateBases
pub fn alternate_bases_mut(&mut self) -> &mut AlternateBases
Returns a mutable reference to the alternate bases of the record.
§Examples
use noodles_vcf::{self as vcf, variant::record_buf::AlternateBases};
let mut record = vcf::variant::RecordBuf::builder()
.set_reference_bases("A")
.build();
let alternate_bases = AlternateBases::from(vec![String::from("C")]);
*record.alternate_bases_mut() = alternate_bases.clone();
assert_eq!(record.alternate_bases(), &alternate_bases);
Sourcepub fn quality_score(&self) -> Option<f32>
pub fn quality_score(&self) -> Option<f32>
Returns the quality score of the record.
§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 quality_score_mut(&mut self) -> &mut Option<f32>
pub fn quality_score_mut(&mut self) -> &mut Option<f32>
Returns a mutable reference to the quality score.
§Examples
use noodles_vcf as vcf;
let mut record = vcf::variant::RecordBuf::default();
*record.quality_score_mut() = Some(13.0);
assert_eq!(record.quality_score(), Some(13.0));
Sourcepub fn filters(&self) -> &Filters
pub fn filters(&self) -> &Filters
Returns the filters of the record.
The filters can either be pass (PASS
), a list of filter names that caused the record to
fail, (e.g., q10
), or missing (.
).
§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 filters_mut(&mut self) -> &mut Filters
pub fn filters_mut(&mut self) -> &mut Filters
Returns a mutable reference to the filters.
§Examples
use noodles_vcf::{self as vcf, variant::record_buf::Filters};
let mut record = vcf::variant::RecordBuf::default();
*record.filters_mut() = Filters::pass();
assert!(record.filters().is_pass());
Sourcepub fn info(&self) -> &Info
pub fn info(&self) -> &Info
Returns the addition information of the record.
§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::from(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 info_mut(&mut self) -> &mut Info
pub fn info_mut(&mut self) -> &mut Info
Returns a mutable reference to the additional info fields.
§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::from(3))),
(String::from(key::ALLELE_FREQUENCIES), Some(Value::from(vec![Some(0.5)]))),
]
.into_iter()
.collect();
let mut record = vcf::variant::RecordBuf::builder()
.set_info(info)
.build();
record.info_mut().insert(String::from(key::TOTAL_DEPTH), Some(Value::Integer(13)));
let expected = [
(String::from(key::SAMPLES_WITH_DATA_COUNT), Some(Value::Integer(3))),
(String::from(key::ALLELE_FREQUENCIES), Some(Value::from(vec![Some(0.5)]))),
(String::from(key::TOTAL_DEPTH), Some(Value::Integer(13))),
]
.into_iter()
.collect();
assert_eq!(record.info(), &expected);
Sourcepub fn format(&self) -> &Keys
pub fn format(&self) -> &Keys
Returns the format of the genotypes of the record.
§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.clone(),
vec![vec![Some(Value::from("0|0")), Some(Value::from(13))]],
);
let record = vcf::variant::RecordBuf::builder()
.set_samples(samples)
.build();
assert_eq!(record.format(), &keys);
Sourcepub fn samples(&self) -> &Samples
pub fn samples(&self) -> &Samples
Returns the genotypes of the record.
§Examples
use noodles_vcf::{
self as vcf,
variant::{
record::samples::keys::key,
record_buf::{samples::sample::Value, Samples},
},
};
let 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);
Sourcepub fn samples_mut(&mut self) -> &mut Samples
pub fn samples_mut(&mut self) -> &mut Samples
Returns a mutable reference to the genotypes of the record.
§Examples
use noodles_vcf::{
self as vcf,
variant::{
record::samples::keys::key,
record_buf::{samples::sample::Value, Samples},
},
};
let mut record = vcf::variant::RecordBuf::default();
let 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))]],
);
*record.samples_mut() = samples.clone();
assert_eq!(record.samples(), &samples);
Trait Implementations§
Source§impl Record for RecordBuf
impl Record for RecordBuf
Source§fn reference_sequence_name<'a, 'h: 'a>(
&'a self,
_: &'h Header,
) -> Result<&'a str>
fn reference_sequence_name<'a, 'h: 'a>( &'a self, _: &'h Header, ) -> Result<&'a str>
Source§fn variant_start(&self) -> Option<Result<Position>>
fn variant_start(&self) -> Option<Result<Position>>
Source§fn reference_bases(&self) -> Box<dyn ReferenceBases + '_>
fn reference_bases(&self) -> Box<dyn ReferenceBases + '_>
Source§fn alternate_bases(&self) -> Box<dyn AlternateBases + '_>
fn alternate_bases(&self) -> Box<dyn AlternateBases + '_>
impl StructuralPartialEq for RecordBuf
Auto Trait Implementations§
impl Freeze for RecordBuf
impl RefUnwindSafe for RecordBuf
impl Send for RecordBuf
impl Sync for RecordBuf
impl Unpin for RecordBuf
impl UnwindSafe for RecordBuf
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)