Struct rust_htslib::bcf::header::HeaderView[][src]

pub struct HeaderView {
    pub inner: *mut bcf_hdr_t,
}

Fields

inner: *mut bcf_hdr_t

Implementations

Get the number of samples defined in the header.

Get vector of sample names defined in the header.

Obtain id (column index) of given sample. Returns None if sample is not present in header.

Get the number of contigs defined in the header.

Retrieve the (internal) chromosome identifier

Examples

use rust_htslib::bcf::header::Header;
use rust_htslib::bcf::{Format, Writer};

let mut header = Header::new();
let contig_field = br#"##contig=<ID=foo,length=10>"#;
header.push_record(contig_field);
let mut vcf = Writer::from_stdout(&header, true, Format::Vcf).unwrap();
let header_view = vcf.header();
let rid = header_view.name2rid(b"foo").unwrap();
assert_eq!(rid, 0);
// try and retrieve a contig not in the header
let result = header_view.name2rid(b"bar");
assert!(result.is_err())

Errors

If name does not match a chromosome currently in the VCF header, returns Error::BcfUnknownContig

Convert string ID (e.g., for a FILTER value) to its numeric identifier.

Convert integer representing an identifier (e.g., a FILTER value) to its string name.bam.

Convert string sample name to its numeric identifier.

Convert integer representing an contig to its name.

Return structured HeaderRecords.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.