[][src]Struct rust_htslib::bcf::record::Record

pub struct Record {
    pub inner: *mut bcf1_t,
    // some fields omitted
}

A BCF record. New records can be created by the empty_record methods of bcf::Reader and bcf::Writer.

Fields

inner: *mut bcf1_t

Methods

impl Record[src]

pub fn unpack(&mut self)[src]

Force unpacking of internal record values.

pub fn header(&self) -> &HeaderView[src]

Return associated header.

pub fn inner(&self) -> &bcf1_t[src]

Return reference to the inner C struct.

Remarks

Note that this function is only required as long as Rust-Htslib does not provide full access to all aspects of Htslib.

pub fn inner_mut(&mut self) -> &mut bcf1_t[src]

Return mutable reference to inner C struct.

Remarks

Note that this function is only required as long as Rust-Htslib does not provide full access to all aspects of Htslib.

pub fn rid(&self) -> Option<u32>[src]

Get the reference id of the record.

To look up the contig name, use bcf::header::HeaderView::rid2name.

Returns

  • Some(rid) if the internal rid is set to a value that is not -1
  • None if the internal rid is set to -1

pub fn set_rid(&mut self, rid: Option<u32>)[src]

pub fn pos(&self) -> i64[src]

pub fn set_pos(&mut self, pos: i64)[src]

Set 0-based position.

pub fn id(&self) -> Vec<u8>[src]

Return the value of the ID column.

When empty, returns b".".to_vec().

pub fn set_id(&mut self, id: &[u8]) -> Result<()>[src]

Update the ID string to the given value.

pub fn clear_id(&mut self) -> Result<()>[src]

Clear the ID column (set it to ".").

pub fn push_id(&mut self, id: &[u8]) -> Result<()>[src]

Add the ID string (the ID field is semicolon-separated), checking for duplicates.

pub fn filters(&self) -> Filters[src]

Return Filters iterator for enumerating all filters that have been set.

A record having the PASS filter will return an empty Filter here.

pub fn has_filter(&self, flt_id: Id) -> bool[src]

Query whether the filter with the given ID has been set.

Arguments

  • flt_id - The filter ID to query for.

pub fn set_filters(&mut self, flt_ids: &[Id])[src]

Set the given filters IDs to the FILTER column.

Setting an empty slice removes all filters.

Arguments

  • flt_ids - The identifiers of the filter values to set.

pub fn push_filter(&mut self, flt_id: Id)[src]

Add the given filter to the FILTER column.

If val corresponds to "PASS" then all existing filters are removed first. If other than "PASS", then existing "PASS" is removed.

Arguments

  • flt_id - The corresponding filter ID value to add.

pub fn remove_filter(&mut self, flt_id: Id, pass_on_empty: bool)[src]

Remove the given filter from the FILTER column.

Arguments

  • val - The corresponding filter ID to remove.
  • pass_on_empty - Set to "PASS" when removing the last value.

pub fn alleles(&self) -> Vec<&[u8]>[src]

Get alleles strings.

The first allele is the reference allele.

pub fn set_alleles(&mut self, alleles: &[&[u8]]) -> Result<()>[src]

Set alleles.

pub fn qual(&self) -> f32[src]

Get variant quality.

pub fn set_qual(&mut self, qual: f32)[src]

Set variant quality.

pub fn info<'a>(&'a mut self, tag: &'a [u8]) -> Info[src]

Get the value of the given info tag.

pub fn sample_count(&self) -> u32[src]

Get the number of samples.

pub fn allele_count(&self) -> u32[src]

Get the number of alleles, including reference allele.

pub fn genotypes(&mut self) -> Result<Genotypes>[src]

Get genotypes as vector of one Genotype per sample.

pub fn format<'a>(&'a mut self, tag: &'a [u8]) -> Format[src]

Get the value of the given format tag for each sample.

pub fn push_format_integer(&mut self, tag: &[u8], data: &[i32]) -> Result<()>[src]

Add/replace an integer-typed FORMAT tag.

Arguments

  • tag - The tag's string.
  • data - a flattened, two-dimensional array, the first dimension contains one array for each sample.

Errors

Returns error if tag is not present in header.

pub fn push_format_float(&mut self, tag: &[u8], data: &[f32]) -> Result<()>[src]

Add/replace a float-typed FORMAT tag.

Arguments

  • tag - The tag's string.
  • data - a flattened, two-dimensional array, the first dimension contains one array for each sample.

Errors

Returns error if tag is not present in header.

pub fn push_format_char(&mut self, tag: &[u8], data: &[u8]) -> Result<()>[src]

Add/replace a single-char-typed FORMAT tag.

Arguments

  • tag - The tag's string.
  • data - a flattened, two-dimensional array, the first dimension contains one array for each sample.

Errors

Returns error if tag is not present in header.

pub fn push_format_string<D: Borrow<[u8]>>(
    &mut self,
    tag: &[u8],
    data: &[D]
) -> Result<()>
[src]

Add a string-typed FORMAT tag.

Arguments

  • tag - The tag's string.
  • data - a two-dimensional array, the first dimension contains one array for each sample. Must be non-empty.

Errors

Returns error if tag is not present in header.

pub fn push_info_integer(&mut self, tag: &[u8], data: &[i32]) -> Result<()>[src]

Add/replace an integer-typed INFO entry.

pub fn clear_info_integer(&mut self, tag: &[u8]) -> Result<()>[src]

Remove the integer-typed INFO entry.

pub fn push_info_float(&mut self, tag: &[u8], data: &[f32]) -> Result<()>[src]

Add/replace a float-typed INFO entry.

pub fn clear_info_float(&mut self, tag: &[u8]) -> Result<()>[src]

Remove the float-typed INFO entry.

pub fn push_info_flag(&mut self, tag: &[u8]) -> Result<()>[src]

Set flag into the INFO column.

pub fn clear_info_flag(&mut self, tag: &[u8]) -> Result<()>[src]

Remove the flag from the INFO column.

pub fn push_info_string(&mut self, tag: &[u8], data: &[&[u8]]) -> Result<()>[src]

Add/replace a string-typed INFO entry.

pub fn clear_info_string(&mut self, tag: &[u8]) -> Result<()>[src]

Remove the string field from the INFO column.

pub fn trim_alleles(&mut self) -> Result<()>[src]

Remove unused alleles.

pub fn remove_alleles(&mut self, remove: &[bool]) -> Result<()>[src]

pub fn desc(&self) -> String[src]

Provide short description of record for locating it in the BCF/VCF file.

Trait Implementations

impl AbstractLocus for Record[src]

impl Debug for Record[src]

impl Drop for Record[src]

impl Send for Record[src]

impl Sync for Record[src]

Auto Trait Implementations

impl !RefUnwindSafe for Record

impl Unpin for Record

impl UnwindSafe for Record

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.