Struct rust_htslib::bcf::header::HeaderView [−][src]
Fields
inner: *mut bcf_hdr_t
Implementations
Get the number of samples 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 HeaderRecord
s.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for HeaderView
impl !Send for HeaderView
impl !Sync for HeaderView
impl Unpin for HeaderView
impl UnwindSafe for HeaderView
Blanket Implementations
Mutably borrows from an owned value. Read more