pub struct InfoExtractor;Expand description
Extract and manipulate INFO field annotations from variants
Implementations§
Source§impl InfoExtractor
impl InfoExtractor
Sourcepub fn extract_fields(
variants: &[Variant],
fields: &[String],
) -> HashMap<u64, HashMap<String, String, RandomState>, RandomState>
pub fn extract_fields( variants: &[Variant], fields: &[String], ) -> HashMap<u64, HashMap<String, String, RandomState>, RandomState>
Extract specific INFO fields from variants
§Arguments
variants- List of variants to extract fromfields- INFO field names to extract
§Returns
A map of variant positions to their INFO field values
§Example
use deepbiop_vcf::annotate::InfoExtractor;
use deepbiop_vcf::types::Variant;
let variant = Variant::new("chr1".to_string(), 100, "A".to_string(), vec!["G".to_string()]);
let variants = vec![variant];
let fields = vec!["AF".to_string(), "DP".to_string()];
let extracted = InfoExtractor::extract_fields(&variants, &fields);Sourcepub fn list_info_fields(variants: &[Variant]) -> Vec<String>
pub fn list_info_fields(variants: &[Variant]) -> Vec<String>
Get all unique INFO field names from a set of variants
§Example
use deepbiop_vcf::annotate::InfoExtractor;
use deepbiop_vcf::types::Variant;
let variant = Variant::new("chr1".to_string(), 100, "A".to_string(), vec!["G".to_string()]);
let variants = vec![variant];
let fields = InfoExtractor::list_info_fields(&variants);Sourcepub fn extract_field(variants: &[Variant], field: &str) -> Vec<Option<String>>
pub fn extract_field(variants: &[Variant], field: &str) -> Vec<Option<String>>
Extract a single INFO field as a vector of values
§Example
use deepbiop_vcf::annotate::InfoExtractor;
use deepbiop_vcf::types::Variant;
let variant = Variant::new("chr1".to_string(), 100, "A".to_string(), vec!["G".to_string()]);
let variants = vec![variant];
let depths = InfoExtractor::extract_field(&variants, "DP");Sourcepub fn count_by_field(variants: &[Variant], field: &str) -> (usize, usize)
pub fn count_by_field(variants: &[Variant], field: &str) -> (usize, usize)
Count variants by INFO field presence
§Example
use deepbiop_vcf::annotate::InfoExtractor;
use deepbiop_vcf::types::Variant;
let variant = Variant::new("chr1".to_string(), 100, "A".to_string(), vec!["G".to_string()]);
let variants = vec![variant];
let counts = InfoExtractor::count_by_field(&variants, "DP");
println!("Variants with DP: {}, without: {}", counts.0, counts.1);Auto Trait Implementations§
impl Forget for InfoExtractor
impl Freeze for InfoExtractor
impl Move for InfoExtractor
impl RefUnwindSafe for InfoExtractor
impl Send for InfoExtractor
impl Sync for InfoExtractor
impl Unpin for InfoExtractor
impl UnsafeUnpin for InfoExtractor
impl UnwindSafe for InfoExtractor
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more