BamReader

BAM file reader, featuring parallel decompression of BGZF blocks.

Constructors

this
this(undead.stream.Stream stream, TaskPool task_pool)
this(string filename, std.parallelism.TaskPool task_pool)
this(string filename)

Creates reader associated with file or stream. (If stream constructor is used, no random access is possible.)
Optionally, task pool can be specified. It will be used to unpack BGZF blocks in parallel.

Members

Functions

allReads
std.range.InputRange!(bio.bam.read.BamRead) allReads()

Part of IBamSamReader interface

assumeSequentialProcessing
void assumeSequentialProcessing()
createIndex
void createIndex(bool overwrite)

Creates BAI file. If overwrite is false, it won't touch existing index if it is already found.

eofVirtualOffset
bio.core.bgzf.virtualoffset.VirtualOffset eofVirtualOffset()

If file ends with EOF block, returns virtual offset of the start of EOF block. Otherwise, returns virtual offset of the physical end of file.

filename
string filename()

Filename, if the object was created via file name constructor, null otherwise.

getBgzfBlockAt
bio.core.bgzf.block.BgzfBlock getBgzfBlockAt(ulong offset)

Get BGZF block at a given file offset.

getChunks
bio.core.bgzf.chunk.Chunk[] getChunks(uint ref_id, int beg, int end)

Get BAI chunks containing all reads that overlap specified region. For ref_id = -1, use unmappedReads method.

getReadAt
bio.bam.read.BamRead getReadAt(bio.core.bgzf.virtualoffset.VirtualOffset offset)
getReadsBetween
auto getReadsBetween(bio.core.bgzf.virtualoffset.VirtualOffset from, bio.core.bgzf.virtualoffset.VirtualOffset to)
getReadsOverlapping
auto getReadsOverlapping(BamRegion[] regions)
hasReference
bool hasReference(string ref_name)

Check if reference named ref_name is presented in BAM header.

has_index
bool has_index()

True if BAI file was found for this BAM file. This is necessary for any random-access operations.
Looks for files in the same directory which filename is either the file name of BAM file with '.bai' appended, or with the last extension replaced with '.bai' (that is, for file.bam paths file.bai and file.bam.bai will be checked)

header
bio.sam.header.SamHeader header()
opIndex
bio.bam.reference.ReferenceSequence opIndex(string ref_name)

Returns reference sequence named ref_name.

reads
auto reads()

Range of all alignment records in the file.
Element type of the returned range depends on the policy. Default one is $(DPREF2 bam, readrange, withoutOffsets), in this case range element type is $(DPREF2 bam, read, BamRead).
The other option is $(DPREF2 bam, readrange, withOffsets), which allows to track read virtual offsets in the file. In this case range element type is $(DPREF2 bam, readrange, BamReadBlock).

readsWithProgress
auto readsWithProgress(void delegate(lazy float p) progressBarFunc, void delegate() finishFunc)
reference
bio.bam.reference.ReferenceSequence reference(int ref_id)

Returns reference sequence with id ref_id.

reference_sequences
const(bio.bam.referenceinfo.ReferenceSequenceInfo)[] reference_sequences()
setBufferSize
void setBufferSize(size_t buffer_size)

Set buffer size for I/O operations. Values less than 4096 are disallowed.
This can help in multithreaded applications when several files are read simultaneously (e.g. merging).

unmappedReads
auto unmappedReads()

Unmapped reads, i.e. reads at the end of file whose reference id is -1. The file must be coordinate-sorted and indexed.

Structs

ReadsWithProgressResult
struct ReadsWithProgressResult(alias IteratePolicy, R, S)
Undocumented in source.

Variables

_seqprocmode
bool _seqprocmode;
Undocumented in source.

Inherited Members

From IBamSamReader

header
bio.sam.header.SamHeader header()

SAM header

reference_sequences
const(bio.bam.referenceinfo.ReferenceSequenceInfo)[] reference_sequences()

Information about reference sequences

allReads
std.range.InputRange!(bio.bam.read.BamRead) allReads()

All reads in the file

filename
string filename()

Filename

assumeSequentialProcessing
void assumeSequentialProcessing()

Meta