Struct noodles_bcf::record::Record
source · pub struct Record(/* private fields */);
Expand description
A BCF record.
Implementations§
source§impl Record
impl Record
sourcepub fn reference_sequence_id(&self) -> Result<usize>
pub fn reference_sequence_id(&self) -> Result<usize>
Returns the reference sequence ID of the record.
The reference sequence ID represents an index in the contig string map, which associates an ID (by position) with a contig record in the VCF header (by name). That is, to get the associated contig record in the VCF header, the contig string map must first be queried by position to find the chromosome name, and then the contigs in the VCF header can be queried by name.
§Examples
use noodles_bcf as bcf;
let record = bcf::Record::default();
assert_eq!(record.reference_sequence_id()?, 0);
sourcepub fn reference_sequence_name<'h>(
&self,
string_maps: &'h StringMaps,
) -> Result<&'h str>
pub fn reference_sequence_name<'h>( &self, string_maps: &'h StringMaps, ) -> Result<&'h str>
Returns the reference sequence name.
§Examples
use noodles_bcf as bcf;
use noodles_vcf::{
self as vcf,
header::{record::value::{map::Contig, Map}, StringMaps},
};
let header = vcf::Header::builder()
.add_contig("sq0", Map::<Contig>::new())
.build();
let string_maps = StringMaps::try_from(&header)?;
let record = bcf::Record::default();
assert_eq!(record.reference_sequence_name(&string_maps)?, "sq0");
sourcepub fn variant_start(&self) -> Option<Result<Position>>
pub fn variant_start(&self) -> Option<Result<Position>>
Returns the variant start position.
Despite the BCF format using 0-based positions, this normalizes the value as a 1-based position.
§Examples
use noodles_bcf as bcf;
use noodles_core::Position;
let record = bcf::Record::default();
assert_eq!(record.variant_start().transpose()?, Some(Position::MIN));
sourcepub fn end(&self) -> Result<Position>
pub fn end(&self) -> Result<Position>
Returns the end position of this record.
This value is 1-based.
§Examples
use noodles_bcf as bcf;
use noodles_core::Position;
let record = bcf::Record::default();
assert_eq!(record.end()?, Position::MIN);
sourcepub fn quality_score(&self) -> Result<Option<f32>>
pub fn quality_score(&self) -> Result<Option<f32>>
Returns the quality score.
§Examples
use noodles_bcf as bcf;
let record = bcf::Record::default();
assert!(record.quality_score()?.is_none());
sourcepub fn ids(&self) -> Ids<'_>
pub fn ids(&self) -> Ids<'_>
Returns the IDs.
§Examples
use noodles_bcf as bcf;
use noodles_vcf::variant::record::Ids;
let record = bcf::Record::default();
assert!(record.ids().is_empty());
sourcepub fn reference_bases(&self) -> ReferenceBases<'_>
pub fn reference_bases(&self) -> ReferenceBases<'_>
Returns the reference bases.
§Examples
use noodles_bcf as bcf;
let record = bcf::Record::default();
assert_eq!(record.reference_bases().as_ref(), b"N");
sourcepub fn alternate_bases(&self) -> AlternateBases<'_>
pub fn alternate_bases(&self) -> AlternateBases<'_>
Returns the alternate bases.
§Examples
use noodles_bcf as bcf;
use noodles_vcf::variant::record::AlternateBases;
let record = bcf::Record::default();
assert!(record.alternate_bases().is_empty());
sourcepub fn filters(&self) -> Filters<'_>
pub fn filters(&self) -> Filters<'_>
Returns the filters.
§Examples
use noodles_bcf as bcf;
use noodles_vcf::variant::record::Filters;
let record = bcf::Record::default();
assert!(record.filters().is_empty());