Skip to content

Commit

Permalink
Correct syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Aug 27, 2018
1 parent de4752c commit 8f8a4ec
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/JBrowse/Store/SeqFeature/RegionStatsMixin.js
Expand Up @@ -51,16 +51,30 @@ return declare( null, {
for (var bin = 0 ; bin < numBins ; bin++) {
histogram[bin] = 0
}

this._getFeatures(query,
feature => {
let binValue = Math.round( (feature.get('start') - query.start )* binRatio)
let binValueEnd = Math.round( (feature.get('end')- query.start )* binRatio)

for(let bin = binValue; bin <= binValueEnd; bin++) {
if(bin >= 0 && bin < numBins) {
histogram[bin] = (histogram[bin] || 0) + 1
if (histogram[bin] > stats.max) {
stats.max = histogram[bin]
if(stats.max > this.scoreMax) {
this.scoreMax = stats.max
}
}
}
}
},
() => {
stats.max = this.scoreMax
successCallback({ bins: histogram, stats: stats})
},
errorCallback
);

}

});
});

0 comments on commit 8f8a4ec

Please sign in to comment.