class HTS::Bam::Mpileup

Overview

High-level mpileup iterator over multiple BAM/CRAM inputs. Yields a zero-copy Position view for each genomic position. A Position is an ordered collection of Pileup::Column views (one per input); index it with position[i] or iterate it. Nothing is allocated per position, and Alignment values are constructed lazily only for the reads the consumer touches, so it matches the C mpileup hot-path cost. See Pileup::Column's borrowing contract.

Defined in:

hts/bam/mpileup.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(inputs : Array(Bam), maxcnt : Int32 | Nil = nil, overlaps : Bool = false, *, region : String | Nil = nil, regions : Array(String) | Nil = nil, filter : Pileup::Filter = Pileup::Filter.new) #

Accept Array(Bam). If region is set, it uses SAM-style 1-based inclusive coordinates and each input must already have an index loaded. If regions is set, htslib's multi-region iterator is used and overlapping records are returned once. filter applies the same read-level filtering as single-input Pileup (see Pileup::Filter).


[View source]

Class Method Detail

def self.open(inputs : Array(Bam), maxcnt : Int32 | Nil = nil, overlaps : Bool = false, *, region : String | Nil = nil, regions : Array(String) | Nil = nil, filter : Pileup::Filter = Pileup::Filter.new, &) #

Open an Mpileup iterator with block (RAII style)


[View source]
def self.open(inputs : Array(Bam), *, maxcnt : Int32 | Nil = nil, overlaps : Bool = false, region : String | Nil = nil, regions : Array(String) | Nil = nil, filter : Pileup::Filter = Pileup::Filter.new, &) #

Open an Mpileup iterator using keyword arguments.


[View source]

Instance Method Detail

def close : Nil #

[View source]
def count : Int32 #

Count mpileup positions by consuming this iterator.


[View source]
def count(& : Position -> Bool) : Int32 #

Count mpileup positions matching the block by consuming this iterator.


[View source]
def each(& : Position -> ) : Nil #

Iterate and yield a zero-copy Position view per genomic position. The view is valid only for the duration of the block (see Position's contract).


[View source]
def finalize #

[View source]