SAMReader

Encapsulates a SAM/BAM file.

Implements InputRange interface using htslib calls. If indexed, Random-access query via multidimensional slicing.

Constructors

this
this(T f, int extra_threads)

Create a representation of SAM/BAM/CRAM file from given filename or File

Destructor

~this
~this()

Undocumented in source.

Postblit

this(this)
this(this)

disallow copying

Members

Aliases

allRecords
alias allRecords = all_records

Undocumented in source.

Functions

all_records
AllRecordsRange all_records()

Return an InputRange representing all recods in the SAM/BAM/CRAM

n_targets
int n_targets()

number of reference sequences; from bam_hdr_t

opIndex
auto opIndex(string q)

bam["chr1:1-2"]

opIndex
auto opIndex(string tid, int[2] pos)

bam["chr1", 1..2]

opIndex
auto opIndex(string tid, int pos)

bam["chr1", 1]

opIndex
auto opIndex(string tid, int pos1, int pos2)
opIndex
auto opIndex(int tid, int[2] pos)

Integer-based chr below bam[0, 1..2]

opIndex
auto opIndex(int tid, int pos)

bam[0, 1]

opIndex
auto opIndex(int tid, int pos1, int pos2)

bam[0, 1, 2]

opSlice
int[2] opSlice(int start, int end)

support bam["chr1", 1..2 ]

query
auto query(string chrom, long start, long end)

Query a region and return matching alignments as an InputRange Query by chr, start, end

query
auto query(string q)

Query by string chr:start-end

query
auto query(int tid, long start, long end)

Query by contig id, start, end

query
auto query(string[] regions)

Query by ["chr1:1-2","chr1:1000-1001"]

target_id
int target_id(string name)

reference contig name to integer id Calls int bam_name2id(bam_hdr_t *h, const char *_ref);

target_len
uint target_len(int target)

length of specific reference sequence (by number)

target_lens
uint[] target_lens()

lengths of the reference sequences

target_names
string[] target_names()

names of the reference sequences

Structs

AllRecordsRange
struct AllRecordsRange

Iterate through all records in the SAM/BAM/CRAM

RecordRange
struct RecordRange

Iterate over records falling within a queried region (TODO: itr_multi_query)

RecordRangeMulti
struct RecordRangeMulti

Iterate over records falling within queried regions using a RegionList

RegionList
struct RegionList

List of regions based on sam/bam

Variables

filename
string filename;

filename; as usable from D

header
bam_hdr_t* header;

header struct

Meta