File: make_pileup.d

package info (click to toggle)
libbiod 0.2.3%2Bgit20191120.b8eecef-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,416 kB
  • sloc: makefile: 68; sh: 10
file content (31 lines) | stat: -rw-r--r-- 822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

import bio.std.hts.bam.reader;
import bio.std.hts.bam.pileup;
import bio.std.hts.bam.read : compareCoordinates;

import std.range;
import std.algorithm;
import std.datetime;
import std.stdio;
import std.array;

void main() {

  auto bam = new BamReader("../test/data/illu_20_chunk.bam");

  auto pileup = makePileup(bam.reads, true);

// Reads in every pileup column are sorted by coordinate.
// Therefore the following holds:
  assert(equal(
        pileup.map!(column => column.reads.equalRange(column.position))()
        .joiner(),
        bam.reads));

// There is also easier and faster way to get reads starting at the column:
 pileup = makePileup(bam.reads, true); // (initialize pileup engine again)
 assert(equal(
       pileup.map!(column => column.reads_starting_here)()
      .joiner(),
      bam.reads));
}