Skip to content

Commit

Permalink
Remove unused paircache stats
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 14, 2018
1 parent bf220e2 commit 25a385c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 51 deletions.
30 changes: 3 additions & 27 deletions src/JBrowse/Store/SeqFeature/_PairCache.js
Expand Up @@ -42,11 +42,6 @@ define( [
return declare(null, {
constructor(args) {
this.featureCache = {}
this.insertUpperPercentile = args.insertUpperPercentile || 0.95
this.insertLowerPercentile = args.insertLowerPercentile || 0.05
this.insertStatsCacheMin = args.insertStatsCacheMin || 400
this.insertMaxSize = args.insertMaxSize || 50000
this.orientationType = args.orientationType || 'fr'
},


Expand All @@ -68,9 +63,7 @@ return declare(null, {
}
if(feat.read1 && feat.read2) {
delete pairCache[name]
if(this.insertMaxSize > feat.get('end') - feat.get('start')) {
this.featureCache[name] = feat
}
this.featureCache[name] = feat
}
}
else {
Expand Down Expand Up @@ -104,25 +97,8 @@ return declare(null, {
delete this.featureCache[k]
}
})
},

getStatsForPairCache() {
if(Object.keys(this.featureCache).length > this.insertStatsCacheMin) {
var total = Object.keys(this.featureCache).length
var tlens = Object.entries(this.featureCache)
.map(([k, v]) => Math.abs(v.get('template_length')))
.filter(tlen => tlen < this.insertMaxSize)
.sort((a, b) => a - b)
var sum = tlens.reduce((a, b) => a + b, 0)
var sum2 = tlens.map(a => a*a).reduce((a, b) => a + b, 0)
var avg = sum / total;
var sd = Math.sqrt((total * sum2 - sum*sum) / (total * total));
return {
upper: avg + 3*sd,
lower: avg - 3*sd
}
}
return { upper: Infinity, lower: 0 }
}


});
});
24 changes: 0 additions & 24 deletions src/JBrowse/Store/SeqFeature/_SpanCache.js
Expand Up @@ -42,11 +42,6 @@ define( [
return declare(null, {
constructor(args) {
this.featureCache = {}
this.insertUpperPercentile = args.insertUpperPercentile || 0.95
this.insertLowerPercentile = args.insertLowerPercentile || 0.05
this.insertStatsCacheMin = args.insertStatsCacheMin || 400
this.insertMaxSize = args.insertMaxSize || 50000
this.orientationType = args.orientationType || 'fr'
},


Expand Down Expand Up @@ -77,25 +72,6 @@ return declare(null, {
delete this.featureCache[k]
}
})
},

getStatsForPairCache() {
if(Object.keys(this.featureCache).length > this.insertStatsCacheMin) {
var total = Object.keys(this.featureCache).length
var tlens = Object.entries(this.featureCache)
.map(([k, v]) => Math.abs(v.get('template_length')))
.filter(tlen => tlen < this.insertMaxSize)
.sort((a, b) => a - b)
var sum = tlens.reduce((a, b) => a + b, 0)
var sum2 = tlens.map(a => a*a).reduce((a, b) => a + b, 0)
var avg = sum / total;
var sd = Math.sqrt((total * sum2 - sum*sum) / (total * total));
return {
upper: avg + 3*sd,
lower: avg - 3*sd
}
}
return { upper: Infinity, lower: 0 }
}
});
});

0 comments on commit 25a385c

Please sign in to comment.