Skip to content

Instantly share code, notes, and snippets.

@brentp
Created April 4, 2011 21:59
Show Gist options
  • Save brentp/902550 to your computer and use it in GitHub Desktop.
Save brentp/902550 to your computer and use it in GitHub Desktop.
fix for dalliance bigbed format
diff --git a/js/bigwig.js b/js/bigwig.js
index 0e72afa..48157fa 100644
--- a/js/bigwig.js
+++ b/js/bigwig.js
@@ -88,6 +88,7 @@ function BigWigView(bwg, cirTreeOffset, cirTreeLength, isSummary) {
BigWigView.prototype.readWigData = function(chrName, min, max, callback) {
var chr = this.bwg.chromsToIDs[chrName];
+ console.log(chrName, chr)
if (chr === undefined) {
// Not an error because some .bwgs won't have data for all chromosomes.
@@ -346,8 +347,8 @@ BigWigView.prototype.readWigDataById = function(chr, min, max, callback) {
var thickStart = bedColumns[3]|0;
var thickEnd = bedColumns[4]|0;
var blockCount = bedColumns[6]|0;
- var blockStarts = bedColumns[7].split(',');
- var blockEnds = bedColumns[8].split(',');
+ var blockSizes = bedColumns[7].split(',');
+ var blockStarts = bedColumns[8].split(',');
featureOpts.type = 'bb-transcript'
var grp = new DASGroup();
@@ -368,8 +369,8 @@ BigWigView.prototype.readWigDataById = function(chr, min, max, callback) {
var spans = null;
for (var b = 0; b < blockCount; ++b) {
- var bmin = blockStarts[b]|0;
- var bmax = blockEnds[b]|0;
+ var bmin = (blockStarts[b]|0) + start;
+ var bmax = bmin + (blockSizes[b]|0);
var span = new Range(bmin, bmax);
if (spans) {
spans = union(spans, span);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment