range of all reads in the file, calling progressBarFunc
for each read.
progressBarFunc will be called
each time next alignment is read, with the argument being a number from [0.0, 1.0],
which is estimated progress percentage.
Notice that progressBarFunc takes lazy argument,
so that the number of relatively expensive float division operations
can be controlled by user.
Once the iteration is finished (call to empty returned true), finishFunc will be called if provided.
import std.functional, std.stdio, bio.bam.reader; void progress(lazy float p) { static uint n; if (++n % 63 == 0) writeln(p); // prints progress after every 63 records } ... foreach (read; bam.readsWithProgress(toDelegate(&progress))) { ... }