Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class BoqaPrioritiser implements Prioritiser<BoqaPriorityResult> {
private final Counter counter;
private final double alpha;
private final double beta;
private final double temperature;

public BoqaPrioritiser(PriorityService priorityService, Counter counter) {
// TODO: add getCounter(): Counter to Priority Service, then initialise the Counter @Lazy in the exomiser-config
Expand All @@ -36,8 +37,9 @@ public BoqaPrioritiser(PriorityService priorityService, Counter counter) {
// it. The Counter now takes ~ 300ms to create, but still, it would be best to move it's creation into the config code.
this.priorityService = priorityService;
this.counter = counter;
this.alpha = 1.0/19077; // TODO: Make alpha and beta constructor parameters
this.alpha = 1.0/19077; // TODO: Make alpha, beta and temperature constructor parameters
this.beta = 0.9;
this.temperature = 1.0; // default
}

@Override
Expand All @@ -50,11 +52,20 @@ public Stream<BoqaPriorityResult> prioritise(List<String> hpoIds, List<Gene> gen
logger.info("Running BOQA prioritiser...XXX");
var observedHpoIds = hpoIds.stream().map(TermId::of).collect(toUnmodifiableSet());
PatientData patientData = new ExomiserPatientData(observedHpoIds, Collections.emptySet());
AlgorithmParameters params = AlgorithmParameters.create(alpha, beta);
BoqaAnalysisResult boqaAnalysisResult = BoqaPatientAnalyzer.computeBoqaResultsRawLog(patientData, counter, params);
List<BoqaResult> rescaledBoqaResults = reScaledRawLogBoqaExomiserScores(boqaAnalysisResult.boqaResults());
logger.debug("Top 10 BOQA results:");
rescaledBoqaResults.stream().sorted(Comparator.comparing(BoqaResult::boqaScore)).limit(10).forEach(b -> logger.debug("BOQA score: {} {} {}", b.counts().diseaseId(), b.boqaScore(), b.counts().diseaseLabel()));
AlgorithmParameters params = AlgorithmParameters.create(alpha, beta, temperature);
double epsilon = 0.000001d;
List<BoqaResult> rescaledBoqaResults;
BoqaAnalysisResult boqaAnalysisResult;
if((Math.abs(1.0 - temperature) < epsilon)) {
boqaAnalysisResult = BoqaPatientAnalyzer.computeBoqaResultsRawLog(patientData, counter, params);
rescaledBoqaResults = reScaledRawLogBoqaExomiserScores(boqaAnalysisResult.boqaResults());
logger.debug("Top 10 BOQA results:");
rescaledBoqaResults.stream().sorted(Comparator.comparing(BoqaResult::boqaScore)).limit(10).forEach(b -> logger.debug("BOQA score: {} {} {}", b.counts().diseaseId(), b.boqaScore(), b.counts().diseaseLabel()));
} else {
boqaAnalysisResult = BoqaPatientAnalyzer.computeBoqaResults(
patientData, counter, Integer.MAX_VALUE, params);
rescaledBoqaResults = boqaAnalysisResult.boqaResults().stream().toList();
}
Map<String, BoqaResult> boqaResultsByDiseaseId = rescaledBoqaResults.stream()
.collect(toUnmodifiableMap(boqaResult -> boqaResult.counts().diseaseId(), Function.identity()));
return genes.stream().map(prioritiseGene(boqaResultsByDiseaseId));
Expand Down