[][src]Struct bam::record::Record

pub struct Record { /* fields omitted */ }

BAM Record

Methods

impl Record[src]

pub fn new() -> Record[src]

Creates an empty record. Can be filled using read_into.

pub fn shrink_to_fit(&mut self)[src]

Shrinks record contents. The more records were read into the same Record instance, the bigger would be inner vectors (to save time on memory allocation). Use this function if you do not plan to read into this record in the future.

pub fn name(&self) -> &[u8][src]

Returns record name as bytes.

pub fn sequence(&self) -> &Sequence[src]

Returns record sequence.

pub fn qualities(&self) -> Option<&Qualities>[src]

Returns record qualities, if present.

pub fn cigar(&self) -> &Cigar[src]

Returns record CIGAR (can be empty).

pub fn ref_id(&self) -> i32[src]

Returns 0-based reference index. Returns -1 for unmapped records.

pub fn start(&self) -> i32[src]

Returns 0-based left-most aligned reference position. Same as POS - 1 in SAM specification. Returns -1 for unmapped records.

pub fn calculate_end(&self) -> i32[src]

For a mapped read aligned to reference positions [start-end), the function returns end. The first calculation takes O(n), where n is the length of Cigar. Consecutive calculations take O(1). If the read was fetched from a specific region, it should have end already calculated.

Returns -1 for unmapped records.

pub fn bin(&self) -> u16[src]

Returns BAI bin.

pub fn mapq(&self) -> u8[src]

Returns record MAPQ.

pub fn next_ref_id(&self) -> i32[src]

Returns 0-based reference index for the pair record. Returns -1 for unmapped records, and records without a pair.

pub fn next_start(&self) -> i32[src]

Returns 0-based left-most aligned reference position for the pair record. Same as PNEXT - 1 in SAM specification. Returns -1 for unmapped records and records without a pair.

pub fn template_len(&self) -> i32[src]

Observed template length (TLEN in SAM specification).

pub fn get_tag(&self, tag_name: &[u8; 2]) -> Option<&TagValue>[src]

Return tag value with tag_name, if there is one. Takes O(n_tags).

pub fn remove_tag(&mut self, tag_name: &[u8; 2]) -> Option<TagValue>[src]

Remove tag and return its value. Returns None, if the record does not contain such tag. Takes O(n_tags).

pub fn push_tag(&mut self, tag_name: &[u8; 2], value: TagValue)[src]

Add a tag and its value. Does not check if the tag already exists. Takes O(1).

pub fn replace_tag(
    &mut self,
    tag_name: &[u8; 2],
    value: TagValue
) -> Option<TagValue>
[src]

Add a tag and its value. Replaces an existing tag if there was one and pushes the new tag to the end otherwise. Takes O(n_tags). Returns old value, if there was one.

pub fn write_sam<W: Write>(&self, f: &mut W, header: &Header) -> Result<()>[src]

Write the record in SAM format to f. The function needs header, as the record itself does not store reference names.

pub fn is_paired(&self) -> bool[src]

pub fn all_segments_aligned(&self) -> bool[src]

pub fn is_mapped(&self) -> bool[src]

pub fn mate_is_mapped(&self) -> bool[src]

pub fn is_reverse_strand(&self) -> bool[src]

pub fn mate_is_reverse_strand(&self) -> bool[src]

pub fn first_in_pair(&self) -> bool[src]

pub fn last_in_pair(&self) -> bool[src]

pub fn is_secondary(&self) -> bool[src]

pub fn fails_quality_controls(&self) -> bool[src]

pub fn is_duplicate(&self) -> bool[src]

pub fn is_supplementary(&self) -> bool[src]

Auto Trait Implementations

impl Send for Record

impl Unpin for Record

impl !Sync for Record

impl UnwindSafe for Record

impl !RefUnwindSafe for Record

Blanket Implementations

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.

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

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

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