Skip to content

Commit

Permalink
fixing tests for result writers and reports
Browse files Browse the repository at this point in the history
  • Loading branch information
iimpulse committed Jan 6, 2025
1 parent 9d75898 commit 06444bc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public double getPercentageFilteredFromBeginning(double originalSize) {
return ((originalSize - (double) passed) / originalSize) * 100;
}

public double getPercentageFilteredFromReports(double originalSize) {
return (failed / originalSize) * 100;
}

public double getPercentageFilteredFromReport(double originalSize) {
return (failed / originalSize) * 100;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private Context buildContext(AnalysisResults analysisResults, OutputSettings out
//write out the analysis reports section
List<FilterReport> analysisStepReports = ResultsWriterUtils.makeFilterReports(analysis, analysisResults);
context.setVariable("filterReports", analysisStepReports);
context.setVariable("filterReportEvalCount", !analysisStepReports.isEmpty() ? analysisStepReports.get(0).getTotalEvaluationCount() : 0.00);
//write out the variant type counters
List<String> sampleNames = analysisResults.getSampleNames();
List<VariantEffectCount> variantTypeCounters = ResultsWriterUtils.makeVariantEffectCounters(sampleNames, analysisResults
Expand Down
12 changes: 8 additions & 4 deletions exomiser-core/src/main/resources/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ <h2 class="title text-center text-uppercase m-4">
<div class="tab-pane fade" id="filtering" role="tabpanel">
<div class="">
<div class="vstack gap-3">
<div class="report-wrapper p-2" th:each="report : ${filterReports}">
<div class="report-wrapper p-2" th:if="${filterReports.size() > 0}" th:each="report : ${filterReports}">
<div class="report-title-wrapper">
<h5 class="report-title" th:text="${report.filterType.shortName}">Frequency</h5>
<p class="report-description" th:each="message : ${report.messages}"
Expand All @@ -351,16 +351,17 @@ <h5 class="report-title" th:text="${report.filterType.shortName}">Frequency</h5>
</p>
</div>
<div class="report-numbers">
<div class="report-percentloss" th:classappend="${#numbers.formatDecimal(report.getPercentageFilteredFromReport(filterReports.get(0).getTotalEvaluationCount()), 1, 0)} > 0 ? 'report-text-violetred' : ''"
th:text="${#numbers.formatDecimal(report.getPercentageFilteredFromReport(filterReports.get(0).getTotalEvaluationCount()), 1, 0)} + '%'"></div>
<div class="report-percentloss" th:if="${report != null}"
th:classappend="${report != null ? (#numbers.formatDecimal(report.getPercentageFilteredFromReport(filterReportEvalCount), 1, 0) > 0 ? 'report-text-violetred' : '') : '' } == 'report-text-violetred' ? 'report-text-violetred' : ''"
th:text="${#numbers.formatDecimal(report.getPercentageFilteredFromReport(filterReportEvalCount), 1, 0)} + '%'"></div>
<div class="text-sm pass-fail text-end">
<span class="text-muted" th:text="${#numbers.formatDecimal(report.passed, 0, 'COMMA', 0, 'POINT')} + ' Passed'"></span><br>
<span class="text-muted" th:text="${#numbers.formatDecimal(report.failed, 0, 'COMMA', 0, 'POINT')} + ' Failed'"></span>
</div>
</div>

</div>
<p class="summary-report text-lg-end p-2"><strong th:text="${filterReports.get(filterReports.size() - 1).passed}"></strong> Variants Passed All Filters</p>
<p class="summary-report text-lg-end p-2" th:if="${filterReports.size() > 0}"><strong th:text="${filterReports.get(filterReports.size() - 1).passed}"></strong> Variants Passed All Filters</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -392,6 +393,9 @@ <h6 class="m-0" th:text="${gene.getGeneIdentifier().getGeneSymbol()}">
<div class="col">
<span>Variant Score <b th:text="${#numbers.formatDecimal(gene.getVariantScore(), 1, 3)}">1.00</b></span>
</div>
<div class="col">
<span th:if="${gene.getTopGeneScore().getAcmgAssignments().size() > 0}" th:text="${gene.getTopGeneScore().getAcmgAssignments().get(0)}"></span>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public void testToString() {

@Test
public void testPercentageFailed(){
assertThat(instance.getPercentageFilteredFromBeginning(345), equalTo(((345 - 12) / 345) * 100));
double expected = ((double)(345 - 12) / 345) * 100;
assertThat(instance.getPercentageFilteredFromBeginning(345), equalTo(expected));
}

}

0 comments on commit 06444bc

Please sign in to comment.