Skip to content

Commit

Permalink
remove some unnecessary functions, additional parallelisation
Browse files Browse the repository at this point in the history
  • Loading branch information
reality committed Aug 30, 2022
1 parent 6c06143 commit 82a7e45
Showing 3 changed files with 15 additions and 20 deletions.
1 change: 1 addition & 0 deletions klarigi/src/main/groovy/klarigi/App.groovy
Original file line number Diff line number Diff line change
@@ -218,6 +218,7 @@ class App {
println "Could not handle the --group-file: ${e.toString()}"
System.exit(1)
}
if(o['verbose']) { println "[...] Loaded ${o['group'].size()} groups from ${o['group-file']}. Ignoring any --group argument." }
} else if(o['group'] =~ ';') {
o['group'] = o['group'].tokenize(';')
} else if(o['group']) {
22 changes: 5 additions & 17 deletions klarigi/src/main/groovy/klarigi/Scorer.groovy
Original file line number Diff line number Diff line change
@@ -187,22 +187,7 @@ public class Scorer {
}
}
}
/*
private def findRelevantClasses(relevant, c) {
/*if(relevant.contains(c)) { return; }
relevant << c
def ce = ontoHelper.dataFactory.getOWLClass(IRI.create(c))
ontoHelper.reasoner.getSuperClasses(ce, false).each { n ->
n.getEntities().each { sc ->
def strc = sc.getIRI().toString()
findRelevantClasses(relevant, strc)
}
relevant += scMap[c]
}
*/

def scoreClasses(cid, classes) {
scoreClasses(cid, classes, false)
}
@@ -232,7 +217,10 @@ public class Scorer {

def scoreAllClasses(cid, returnAll) {
// No point running expensive unique here since we check in processClass whether we already have it
def relevant = data.allAssociations.collect { scMap[it] }.flatten()
def relevant
GParsPool.withPool(o['threads']) { p ->
relevant = data.allAssociations.collectParallel { scMap[it] }.flatten()
}

def explainers = new ConcurrentHashMap()
GParsPool.withPool(o['threads']) { p ->
12 changes: 9 additions & 3 deletions klarigi/src/main/groovy/klarigi/StepDown.groovy
Original file line number Diff line number Diff line change
@@ -14,9 +14,13 @@ public class StepDown {
def stepDown = { e, icCutoff, powerCutoff, totalInclusionCutoff ->
while(totalCoverage <= (totalInclusionCutoff*100)) {

def ef = candidates.findAll {

def ef
GParsPool.withPool(threads) { p ->
ef = candidates.findAllParallel {
it.nIc >= icCutoff && it.nPower >= powerCutoff
}
}

totalCoverage = CalculateOI(c, cid, data, ef, threads, false)

@@ -52,12 +56,14 @@ public class StepDown {
static def CalculateOI(c, cid, data, candidates, threads, total) {
def contributingEf = candidates
if(!total) {
contributingEf = contributingEf.findAll { it.nInclusion <= c.MAX_INCLUSION && it.nExclusion <= c.MAX_EXCLUSION && it.nPower <= c.MAX_R_SCORE }
GParsPool.withPool(threads) { p ->
contributingEf = contributingEf.findAllParallel { it.nInclusion <= c.MAX_INCLUSION && it.nExclusion <= c.MAX_EXCLUSION && it.nPower <= c.MAX_R_SCORE }
}
}

def covered = new AtomicInteger(0)
GParsPool.withPool(threads) { p ->
data.groupings[cid].each { ee ->
data.groupings[cid].eachParallel { ee ->
if(contributingEf.any { it.incEnts.containsKey(ee) }) {
covered.getAndIncrement()
}

0 comments on commit 82a7e45

Please sign in to comment.