Skip to content

Commit

Permalink
cleanup, more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Mar 13, 2015
1 parent 9c6851a commit 9c96e36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/BigBed.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ function parseHeader(dataView: DataView) {
// NB: dalliance doesn't support big endian formats.
var jb = new jBinary(dataView.buffer, BigBedTypeSet);
var header = jb.readAll();
console.log(header);

return header;
}

function parseCirTree(dataView: DataView) {
var jb = new jBinary(dataView.buffer, CirTreeTypeSet);
var cirTree = jb.readAll();
console.log(cirTree);

return cirTree;
}
Expand Down Expand Up @@ -215,7 +213,6 @@ function findOverlappingBlocks(twoBitHeader, cirTree, contigRange) {
}

function extractFeaturesInRange(dataView, dataRange, blocks, contigRange) {
console.log('Fetched ', dataRange);
var buffer = dataView.buffer;

return _.flatten(blocks.map(block => {
Expand All @@ -230,12 +227,9 @@ function extractFeaturesInRange(dataView, dataRange, blocks, contigRange) {
// TODO: parse only one record at a time, as many as is necessary.
var beds = jb.readAll();

console.log(beds);

beds = beds.filter(function(bed) {
var bedInterval = new ContigInterval(bed.chrId, bed.start, bed.end);
var r = contigRange.intersects(bedInterval);
console.log('intersect?', contigRange.toString(), bedInterval.toString(), r);
return r;
});

Expand Down Expand Up @@ -285,7 +279,6 @@ class BigBed {
if (blocks.length == 0) {
return [];
}
console.log(blocks);

var range = Interval.boundingInterval(
blocks.map(n => new Interval(+n.offset, n.offset+n.size)));
Expand Down
7 changes: 4 additions & 3 deletions test/jbinary-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('jBinary', function() {

var jb = new jBinary(u8array.buffer, twoBitTypeSet);
var header = jb.readAll();
console.log(header);

expect(header.magic).to.equal(0x1A412743); // two bit magic
expect(header.version).to.equal(0);
Expand All @@ -51,9 +50,11 @@ describe('jBinary', function() {
var buffer = u8array.buffer;

var jb = new jBinary(buffer, uint8TypeSet);
var num = 0;
while (jb.tell() < buffer.byteLength) {
var x = jb.read({value: 'uint8'});
console.log(jb.tell(), x);
var x = jb.read('File');
expect(x).to.deep.equal({value: num * num});
num++;
}
});
});

0 comments on commit 9c96e36

Please sign in to comment.