Struct rust_htslib::bcf::header::Header

source ·
pub struct Header {
    pub inner: *mut bcf_hdr_t,
    pub subset: Option<SampleSubset>,
}
Expand description

A BCF header.

Fields§

§inner: *mut bcf_hdr_t§subset: Option<SampleSubset>

Implementations§

source§

impl Header

source

pub fn new() -> Self

Create a new (empty) Header.

source

pub fn from_template(header: &HeaderView) -> Self

Create a new Header using the given HeaderView as the template.

After construction, you can modify the header independently from the template header.

§Arguments
  • header - The HeaderView to use as the template.
source

pub fn from_template_subset( header: &HeaderView, samples: &[&[u8]] ) -> Result<Self>

Create a new Header using the given HeaderView as as template, but subsetting to the given samples.

§Arguments
  • header - The HeaderView to use for the template.
  • samples - A slice of byte-encoded ([u8]) sample names.
source

pub fn push_sample(&mut self, sample: &[u8]) -> &mut Self

Add a sample to the header.

§Arguments
  • sample - Name of the sample to add (to the end of the sample list).
source

pub fn push_record(&mut self, record: &[u8]) -> &mut Self

Add a record to the header.

§Arguments
  • record - String representation of the header line
§Example
header.push_record(format!("##contig=<ID={},length={}>", "chrX", 155270560).as_bytes());
source

pub fn remove_filter(&mut self, tag: &[u8]) -> &mut Self

Remove a FILTER entry from the header.

§Arguments
  • tag - Name of the FLT tag to remove.
source

pub fn remove_info(&mut self, tag: &[u8]) -> &mut Self

Remove an INFO entry from the header.

§Arguments
  • tag - Name of the INFO tag to remove.
source

pub fn remove_format(&mut self, tag: &[u8]) -> &mut Self

Remove a FORMAT entry from the header.

§Arguments
  • tag - Name of the FORMAT tag to remove.
source

pub fn remove_contig(&mut self, tag: &[u8]) -> &mut Self

Remove a contig entry from the header.

§Arguments
  • tag - Name of the FORMAT tag to remove.
source

pub fn remove_structured(&mut self, tag: &[u8]) -> &mut Self

Remove a structured entry from the header.

§Arguments
  • tag - Name of the structured tag to remove.
source

pub fn remove_generic(&mut self, tag: &[u8]) -> &mut Self

Remove a generic entry from the header.

§Arguments
  • tag - Name of the generic tag to remove.

Trait Implementations§

source§

impl Debug for Header

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Header

source§

fn default() -> Self

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

impl Drop for Header

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl !Send for Header

§

impl !Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.