pub struct Info { /* private fields */ }
Expand description

BCF record info.

Implementations

Converts BCF record info to VCF record info.

Examples
use noodles_bcf as bcf;
use noodles_vcf as vcf;

let bcf_info = bcf::record::Info::default();
let header = vcf::Header::default();
let string_maps = bcf::header::StringMaps::default();

let vcf_info = bcf_info.try_into_vcf_record_info(&header, string_maps.strings())?;
assert!(vcf_info.is_empty());

Creates an info map by wrapping the given buffer.

Examples
use noodles_bcf::record::Info;

let data = vec![
    0x11, 0x01, 0x11, 0x05, // AC=5
    0x11, 0x02, 0x11, 0x08, // DP=8
];

let info = Info::new(data, 2);

Returns the number of info fields.

Examples
use noodles_bcf::record::Info;
let info = Info::default();
assert_eq!(info.len(), 0);

Returns whether there are any info fields.

Examples
use noodles_bcf::record::Info;
let info = Info::default();
assert!(info.is_empty());

Removes all fields from the info map.

This does not affect the capacity of the map.

Examples
use noodles_bcf::record::Info;
let mut info = Info::default();
info.clear();
assert!(info.is_empty());

Returns the field with the given key.

Examples
use noodles_bcf::{header::StringMaps, record::Info};
use noodles_vcf::{self as vcf, record::info::{field::{Key, Value}, Field}, Header};

let header = vcf::Header::builder()
    .add_info(vcf::header::Info::from(Key::AlleleCount))
    .add_info(vcf::header::Info::from(Key::TotalDepth))
    .build();

let string_maps = StringMaps::from(&header);

let data = vec![
    0x11, 0x01, 0x11, 0x05, // AC=5
    0x11, 0x02, 0x11, 0x08, // DP=8
];

let info = Info::new(data, 2);

assert_eq!(
    info.get(&header, string_maps.strings(), &Key::AlleleCount).transpose()?,
    Some(Field::new(Key::AlleleCount, Some(Value::Integer(5))))
);

assert!(info.get(&header, string_maps.strings(), &Key::AncestralAllele).is_none());

Returns an iterator over all info fields.

Examples
use noodles_bcf::{header::StringMaps, record::Info};
use noodles_vcf::{self as vcf, record::info::{field::{Key, Value}, Field}, Header};

let header = vcf::Header::builder()
    .add_info(vcf::header::Info::from(Key::AlleleCount))
    .add_info(vcf::header::Info::from(Key::TotalDepth))
    .build();

let string_maps = StringMaps::from(&header);

let data = vec![
    0x11, 0x01, 0x11, 0x05, // AC=5
    0x11, 0x02, 0x11, 0x08, // DP=8
];

let info = Info::new(data, 2);
let mut fields = info.values(&header, string_maps.strings());

assert_eq!(
    fields.next().transpose()?,
    Some(Field::new(Key::AlleleCount, Some(Value::Integer(5))))
);

assert_eq!(
    fields.next().transpose()?,
    Some(Field::new(Key::TotalDepth, Some(Value::Integer(8))))
);

assert!(fields.next().is_none());

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.