forked from igvteam/igv.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testBamIndex.js
79 lines (51 loc) · 1.93 KB
/
testBamIndex.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
function runBAMIndexTests() {
asyncTest("blocksForRange", function () {
var refID = 14,
beg = 24375199,
end = 24378544,
url = 'data/bam/gstt1_sample.bam',
indexPath = url + ".bai",
config;
config = {
type: 'bam',
url: url
};
igv.loadBamIndex(indexPath, config, function (bamIndex) {
chunks = bamIndex.blocksForRange(refID, beg, end);
ok(chunks, "chunks are non-null");
equal(chunks.length, 1, "chunks.length is correct");
var chunk = chunks[0];
equal(0, chunk.maxv.offset, "chunk.maxv.offset");
equal(60872, chunk.maxv.block, "chunk.maxv.block");
start();
}, undefined);
});
asyncTest("blocksForRange 1kg", function () {
var refID = 0,
beg = 155168191,
end = 155170311,
url = 'http://data.broadinstitute.org/igvdata/1KG/b37/data/HG02450/alignment/HG02450.mapped.ILLUMINA.bwa.ACB.low_coverage.20120522.bam',
indexPath = url + ".bai",
config;
config = {
type: 'bam',
url: url
};
igv.loadBamIndex(indexPath, config, function (bamIndex) {
var chunks = bamIndex.blocksForRange(refID, beg, end);
ok(chunks, "chunks are non-null");
equal(chunks.length, 6, "chunks.length is correct");
var chunk = chunks[0];
equal(34768, chunk.minv.offset);
equal(884732468, chunk.minv.block);
equal(47405, chunk.maxv.offset);
equal(884831373, chunk.maxv.block);
chunk = chunks[5];
equal(33278, chunk.minv.offset);
equal(1082533645, chunk.minv.block);
equal(36171, chunk.maxv.offset);
equal(1082533645, chunk.maxv.block);
start();
}, undefined);
});
}