pub struct Header { /* private fields */ }Expand description
Thin wrapper around htsvcf_core::Header for use in V8.
This delegates all VCF header logic to the core Header and adds only V8-specific functionality (GC integration, JS bindings).
Implementations§
Source§impl Header
impl Header
Sourcepub unsafe fn new(ptr: *mut bcf_hdr_t) -> Self
pub unsafe fn new(ptr: *mut bcf_hdr_t) -> Self
Create a Header from a raw bcf_hdr_t pointer.
§Safety
The pointer must be valid. The core Header will duplicate and own the memory.
Sourcepub fn header_records(&self) -> Vec<HeaderRecord>
pub fn header_records(&self) -> Vec<HeaderRecord>
Return parsed header records.
Sourcepub fn info_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>
pub fn info_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>
Get INFO tag type/length from the header.
Sourcepub fn format_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>
pub fn format_type(&self, tag: &[u8]) -> Option<(TagType, TagLength)>
Get FORMAT tag type/length from the header.
Sourcepub fn sample_id(&self, sample: &[u8]) -> Option<usize>
pub fn sample_id(&self, sample: &[u8]) -> Option<usize>
Get sample ID (index) from sample name.
Sourcepub fn id_to_name_cached(&self, id: u32) -> (String, Vec<u8>)
pub fn id_to_name_cached(&self, id: u32) -> (String, Vec<u8>)
Get the cached name for a tag ID, returning both the String and bytes.
Sourcepub fn sample_count(&self) -> usize
pub fn sample_count(&self) -> usize
Get the number of samples in the header.
Sourcepub fn sample_names(&self) -> &[String]
pub fn sample_names(&self) -> &[String]
Get all sample names as strings.
Sourcepub fn sample_idx(&self, name: &str) -> Option<usize>
pub fn sample_idx(&self, name: &str) -> Option<usize>
Get the index of a sample by name, or None if not found.
Sourcepub fn sample_name_to_idx(&self) -> &HashMap<String, usize>
pub fn sample_name_to_idx(&self) -> &HashMap<String, usize>
Get a reference to the sample name-to-index map.
Sourcepub fn push_record(&self, record: &[u8]) -> bool
pub fn push_record(&self, record: &[u8]) -> bool
Append a raw header line (e.g. ##INFO=...).
Sourcepub fn add_info(
&self,
id: &str,
number: &str,
ty: &str,
description: &str,
) -> bool
pub fn add_info( &self, id: &str, number: &str, ty: &str, description: &str, ) -> bool
Add an ##INFO header line.