rust_htslib::bcf::header

Struct 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>,

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T