[][src]Trait rust_htslib::bam::ext::BamRecordExtensions

pub trait BamRecordExtensions {
    fn aligned_blocks(&self) -> Vec<[i64; 2]>;
fn introns(&self) -> Vec<[i64; 2]>;
fn aligned_pairs(&self) -> Vec<[i64; 2]>;
fn aligned_pairs_full(&self) -> Vec<[Option<i64>; 2]>;
fn cigar_stats_nucleotides(&self) -> HashMap<Cigar, i32>;
fn cigar_stats_blocks(&self) -> HashMap<Cigar, i32>;
fn reference_positions(&self) -> Vec<i64>;
fn reference_positions_full(&self) -> Vec<Option<i64>>;
fn reference_start(&self) -> i64;
fn reference_end(&self) -> i64;
fn seq_len_from_cigar(&self, include_hard_clip: bool) -> usize; }

Extra functionality for BAM records

Inspired by pysam

Required methods

fn aligned_blocks(&self) -> Vec<[i64; 2]>

get a list of start and end positions of aligned gapless blocks

The start and end positions are in genomic coordinates. There is not necessarily a gap between blocks on the genome, this happens on insertions.

pysam: blocks

fn introns(&self) -> Vec<[i64; 2]>

find intron positions (start, stop)

This scans the CIGAR for reference skips and reports their positions.

pysam: get_introns

fn aligned_pairs(&self) -> Vec<[i64; 2]>

a list of aligned read and reference positions

No entry for insertions, deletions or skipped pairs

pysam: get_aligned_pairs(matches_only = True)

fn aligned_pairs_full(&self) -> Vec<[Option<i64>; 2]>

a list of aligned read and reference positions

None in either the read positions or the reference position for insertions, deletions or skipped pairs

pysam: aligned_pairs(matches_only = False)

fn cigar_stats_nucleotides(&self) -> HashMap<Cigar, i32>

the number of nucleotides covered by each Cigar:: possibility

Result is a Hashmap Cigar::xyz(0) => covered nucleotides

pysam: first result from get_cigar_stats

fn cigar_stats_blocks(&self) -> HashMap<Cigar, i32>

the number of occurances of each each Cigar:: possibility

Result is a Hashmap Cigar::xyz(0) => number of times this Cigar:: appeared

pysam: second result from get_cigar_stats

fn reference_positions(&self) -> Vec<i64>

a Vec of reference positions that this read aligns to

only returns positions that are aligned, excluding any soft-clipped or unaligned positions within the read

pysam: get_reference_positions(full_length=False)

fn reference_positions_full(&self) -> Vec<Option<i64>>

a Vec of reference positions that this read aligns to

include soft-clipped or skipped positions as None

pysam: get_reference_positions(full_length=True)

fn reference_start(&self) -> i64

left most aligned reference position of the read on the reference genome.

fn reference_end(&self) -> i64

right most aligned reference position of the read on the reference genome.

fn seq_len_from_cigar(&self, include_hard_clip: bool) -> usize

infer the query length from the cigar string, optionally include hard clipped bases

Contrast with record::seq_len which returns the length of the sequence stored in the BAM file, and as such is 0 if the BAM file omits sequences

pysam: infer_query_length / infer_read_length

Loading content...

Implementors

Loading content...