diff --git a/lib/simulator.js b/lib/simulator.js index 1cc6195..8377332 100644 --- a/lib/simulator.js +++ b/lib/simulator.js @@ -23,8 +23,9 @@ var rt = sim.assocs.relevantTerms() if (sim.excludeAncestralTerms || sim.termAssociationCutoff) rt = rt.filter (function (termIndex) { - return ontology.children[termIndex].length == 0 - && (typeof(sim.termAssociationCutoff) === 'undefined' + return (!sim.excludeAncestralTerms + || ontology.children[termIndex].length == 0) + && (!sim.termAssociationCutoff || sim.assocs.genesByTerm[termIndex].length < sim.termAssociationCutoff) }) for (var i = 0; i < rt.length - 1; ++i) { // Fisher-Yates shuffle