Struct rust_htslib::bcf::record::Record
source · Expand description
A BCF record.
New records can be created by the empty_record
methods of bcf::Reader
and bcf::Writer
.
Fields§
§inner: *mut bcf1_t
Implementations§
source§impl Record
impl Record
sourcepub fn header(&self) -> &HeaderView
pub fn header(&self) -> &HeaderView
Return associated header.
sourcepub fn inner(&self) -> &bcf1_t
pub fn inner(&self) -> &bcf1_t
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.
sourcepub fn inner_mut(&mut self) -> &mut bcf1_t
pub fn inner_mut(&mut self) -> &mut bcf1_t
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.
sourcepub fn rid(&self) -> Option<u32>
pub fn rid(&self) -> Option<u32>
Get the reference id of the record.
To look up the contig name, use bcf::header::HeaderView::rid2name
.
Returns
Some(rid)
if the internalrid
is set to a value that is not-1
None
if the internalrid
is set to-1
pub fn set_rid(&mut self, rid: &Option<u32>)
pub fn pos(&self) -> u32
sourcepub fn id(&self) -> Vec<u8> ⓘ
pub fn id(&self) -> Vec<u8> ⓘ
Return the value of the ID column.
When empty, returns b".".to_vec()
.
sourcepub fn set_id(&mut self, id: &[u8]) -> Result<(), IdWriteError>
pub fn set_id(&mut self, id: &[u8]) -> Result<(), IdWriteError>
Update the ID string to the given value.
sourcepub fn clear_id(&mut self) -> Result<(), IdWriteError>
pub fn clear_id(&mut self) -> Result<(), IdWriteError>
Clear the ID column (set it to "."
).
sourcepub fn push_id(&mut self, id: &[u8]) -> Result<(), IdWriteError>
pub fn push_id(&mut self, id: &[u8]) -> Result<(), IdWriteError>
Add the ID string (the ID field is semicolon-separated), checking for duplicates.
sourcepub fn filters(&self) -> Filters<'_> ⓘ
pub fn filters(&self) -> Filters<'_> ⓘ
Return Filters
iterator for enumerating all filters that have been set.
A record having the PASS
filter will return an empty Filter
here.
sourcepub fn has_filter(&self, flt_id: &Id) -> bool
pub fn has_filter(&self, flt_id: &Id) -> bool
Query whether the filter with the given ID has been set.
Arguments
flt_id
- The filter ID to query for.
sourcepub fn set_filters(&mut self, flt_ids: &[Id])
pub fn set_filters(&mut self, flt_ids: &[Id])
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.
sourcepub fn push_filter(&mut self, flt_id: Id)
pub fn push_filter(&mut self, flt_id: Id)
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.
sourcepub fn remove_filter(&mut self, flt_id: Id, pass_on_empty: bool)
pub fn remove_filter(&mut self, flt_id: Id, pass_on_empty: bool)
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.
sourcepub fn alleles(&self) -> Vec<&[u8]> ⓘ
pub fn alleles(&self) -> Vec<&[u8]> ⓘ
Get alleles strings.
The first allele is the reference allele.
sourcepub fn set_alleles(&mut self, alleles: &[&[u8]]) -> Result<(), AlleleWriteError>
pub fn set_alleles(&mut self, alleles: &[&[u8]]) -> Result<(), AlleleWriteError>
Set alleles.
sourcepub fn sample_count(&self) -> u32
pub fn sample_count(&self) -> u32
Get the number of samples.
sourcepub fn allele_count(&self) -> u32
pub fn allele_count(&self) -> u32
Get the number of alleles, including reference allele.
sourcepub fn genotypes(&mut self) -> Result<Genotypes<'_>, FormatReadError>
pub fn genotypes(&mut self) -> Result<Genotypes<'_>, FormatReadError>
Get genotypes as vector of one Genotype
per sample.
sourcepub fn format<'a>(&'a mut self, tag: &'a [u8]) -> Format<'_>
pub fn format<'a>(&'a mut self, tag: &'a [u8]) -> Format<'_>
Get the value of the given format tag for each sample.
sourcepub fn push_format_integer(
&mut self,
tag: &[u8],
data: &[i32]
) -> Result<(), TagWriteError>
pub fn push_format_integer(
&mut self,
tag: &[u8],
data: &[i32]
) -> Result<(), TagWriteError>
sourcepub fn push_format_float(
&mut self,
tag: &[u8],
data: &[f32]
) -> Result<(), TagWriteError>
pub fn push_format_float(
&mut self,
tag: &[u8],
data: &[f32]
) -> Result<(), TagWriteError>
sourcepub fn push_format_char(
&mut self,
tag: &[u8],
data: &[u8]
) -> Result<(), TagWriteError>
pub fn push_format_char(
&mut self,
tag: &[u8],
data: &[u8]
) -> Result<(), TagWriteError>
sourcepub fn push_format_string(
&mut self,
tag: &[u8],
data: &[&[u8]]
) -> Result<(), TagWriteError>
pub fn push_format_string(
&mut self,
tag: &[u8],
data: &[&[u8]]
) -> Result<(), TagWriteError>
sourcepub fn push_info_integer(
&mut self,
tag: &[u8],
data: &[i32]
) -> Result<(), TagWriteError>
pub fn push_info_integer(
&mut self,
tag: &[u8],
data: &[i32]
) -> Result<(), TagWriteError>
Add an integer-typed INFO entry.
sourcepub fn clear_info_integer(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
pub fn clear_info_integer(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
Remove the integer-typed INFO entry.
sourcepub fn push_info_float(
&mut self,
tag: &[u8],
data: &[f32]
) -> Result<(), TagWriteError>
pub fn push_info_float(
&mut self,
tag: &[u8],
data: &[f32]
) -> Result<(), TagWriteError>
Add a float-typed INFO entry.
sourcepub fn clear_info_float(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
pub fn clear_info_float(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
Remove the float-typed INFO entry.
sourcepub fn push_info_flag(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
pub fn push_info_flag(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
Set flag into the INFO column.
sourcepub fn clear_info_flag(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
pub fn clear_info_flag(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
Remove the flag from the INFO column.
sourcepub fn push_info_string(
&mut self,
tag: &[u8],
data: &[&[u8]]
) -> Result<(), TagWriteError>
pub fn push_info_string(
&mut self,
tag: &[u8],
data: &[&[u8]]
) -> Result<(), TagWriteError>
Add a string-typed INFO entry.
sourcepub fn clear_info_string(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
pub fn clear_info_string(&mut self, tag: &[u8]) -> Result<(), TagWriteError>
Remove the string field from the INFO column.
sourcepub fn trim_alleles(&mut self) -> Result<(), RemoveAllelesError>
pub fn trim_alleles(&mut self) -> Result<(), RemoveAllelesError>
Remove unused alleles.