pub struct StringMaps { /* private fields */ }
Expand description
An indexed map of VCF strings.
This includes both the dictionary of strings and dictionary of contigs.
Implementations§
Source§impl StringMaps
impl StringMaps
Sourcepub fn strings(&self) -> &StringStringMap
pub fn strings(&self) -> &StringStringMap
Returns an indexed map of VCF strings (FILTER, FORMAT, and INFO).
The filter ID “PASS” is always the first entry in the string string map.
§Examples
use noodles_vcf::{
self as vcf,
header::{
record::value::{map::{Contig, Filter, Format, Info}, Map},
StringMaps,
},
variant::record::{info, samples},
};
let header = vcf::Header::builder()
.add_info(info::field::key::TOTAL_DEPTH, Map::<Info>::from(info::field::key::TOTAL_DEPTH))
.add_filter("q10", Map::<Filter>::new("Quality below 10"))
.add_format(samples::keys::key::READ_DEPTH, Map::<Format>::from(samples::keys::key::READ_DEPTH))
.add_contig("sq0", Map::<Contig>::new())
.build();
let string_maps = StringMaps::try_from(&header)?;
let string_string_map = string_maps.strings();
assert_eq!(string_string_map.get_index(0), Some("PASS"));
assert_eq!(string_string_map.get_index(1), Some("DP"));
assert_eq!(string_string_map.get_index(2), Some("q10"));
assert!(string_string_map.get_index(3).is_none());
Sourcepub fn contigs(&self) -> &ContigStringMap
pub fn contigs(&self) -> &ContigStringMap
Returns an indexed map of contig names.
§Examples
use noodles_vcf::{
self as vcf,
header::{
record::value::{map::{Contig, Filter, Format, Info}, Map},
StringMaps,
},
variant::record::{info, samples},
};
let header = vcf::Header::builder()
.add_info(info::field::key::TOTAL_DEPTH, Map::<Info>::from(info::field::key::TOTAL_DEPTH))
.add_filter("q10", Map::<Filter>::new("Quality below 10"))
.add_format(samples::keys::key::READ_DEPTH, Map::<Format>::from(samples::keys::key::READ_DEPTH))
.add_contig("sq0", Map::<Contig>::new())
.build();
let string_maps = StringMaps::try_from(&header)?;
let contig_string_map = string_maps.contigs();
assert_eq!(contig_string_map.get_index(0), Some("sq0"));
assert!(contig_string_map.get_index(1).is_none());
Trait Implementations§
Source§impl Clone for StringMaps
impl Clone for StringMaps
Source§fn clone(&self) -> StringMaps
fn clone(&self) -> StringMaps
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for StringMaps
impl Debug for StringMaps
Source§impl Default for StringMaps
impl Default for StringMaps
Source§impl FromStr for StringMaps
impl FromStr for StringMaps
Source§impl PartialEq for StringMaps
impl PartialEq for StringMaps
Source§impl TryFrom<&Header> for StringMaps
impl TryFrom<&Header> for StringMaps
impl Eq for StringMaps
impl StructuralPartialEq for StringMaps
Auto Trait Implementations§
impl Freeze for StringMaps
impl RefUnwindSafe for StringMaps
impl Send for StringMaps
impl Sync for StringMaps
impl Unpin for StringMaps
impl UnwindSafe for StringMaps
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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.