Writing a script/tool for processing BAM data often starts this way:
import bio.std.hts.bam.reader; void main(string[] args) { auto bam = new BamReader(args[1]); // open BAM file foreach (read; bam.reads) { // iterate through its reads if (read.is_unmapped) continue; // maybe skip unmapped ones ... } }
Or, if a specific interval on the reference sequence is to be explored:
import bio.std.hts.bam.pileup; ... auto reads = bam["chr7"][50_000 .. 60_000]; // BAI index is required foreach (column; makePileup(reads)) { ... } // see $(PMODULE pileup) docs
BAM file reader, featuring parallel decompression of BGZF blocks.
See Source File
Writing a script/tool for processing BAM data often starts this way:
Or, if a specific interval on the reference sequence is to be explored: