Skip to content

Commit

Permalink
Make the auto-generated in-memory histogram more sane
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Apr 18, 2018
1 parent 99f3849 commit c50e418
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/JBrowse/Store/SeqFeature/GFF3Tabix.js
Expand Up @@ -221,18 +221,17 @@ return declare( [ SeqFeatureStore, DeferredStatsMixin, DeferredFeaturesMixin, Gl
query.start,
query.end,
line => {
// var feat = this.lineToFeature(line);
// if(!feat.attributes.parent) // only count if has NO parent
const start = line.start ;
const end = line.end ;
console.log(line);
let binValue = Math.round( (start - query.start )* binRatio)
let binValueEnd = Math.round( (end - query.start )* binRatio)

// in case it extends over the end, just push it on the end
binValue = binValue >= 0 ? binValue : 0 ;
binValue = binValue < histogram.length ? binValue : histogram.length -1

histogram[binValue] += 1
if (histogram[binValue] > stats.max) {
stats.max = histogram[binValue]
for(let bin = binValue; bin < binValueEnd; bin++) {
histogram[bin] += 1
if (histogram[bin] > stats.max) {
stats.max = histogram[bin]
}
}
},
() => {
Expand Down

0 comments on commit c50e418

Please sign in to comment.