From 06444bc14d3e34a06071275f0b5d371a5fb86975 Mon Sep 17 00:00:00 2001 From: iimpulse Date: Mon, 6 Jan 2025 12:41:28 -0700 Subject: [PATCH] fixing tests for result writers and reports --- .../exomiser/core/filters/FilterReport.java | 4 ++++ .../exomiser/core/writers/HtmlResultsWriter.java | 1 + .../src/main/resources/templates/results.html | 12 ++++++++---- .../exomiser/core/filters/FilterReportTest.java | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/filters/FilterReport.java b/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/filters/FilterReport.java index cd4b2ee38..7e457c02a 100644 --- a/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/filters/FilterReport.java +++ b/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/filters/FilterReport.java @@ -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; } diff --git a/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/writers/HtmlResultsWriter.java b/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/writers/HtmlResultsWriter.java index 9a3fecbd3..465b75069 100644 --- a/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/writers/HtmlResultsWriter.java +++ b/exomiser-core/src/main/java/org/monarchinitiative/exomiser/core/writers/HtmlResultsWriter.java @@ -115,6 +115,7 @@ private Context buildContext(AnalysisResults analysisResults, OutputSettings out //write out the analysis reports section List 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 sampleNames = analysisResults.getSampleNames(); List variantTypeCounters = ResultsWriterUtils.makeVariantEffectCounters(sampleNames, analysisResults diff --git a/exomiser-core/src/main/resources/templates/results.html b/exomiser-core/src/main/resources/templates/results.html index 4552a016c..ba8cc3041 100644 --- a/exomiser-core/src/main/resources/templates/results.html +++ b/exomiser-core/src/main/resources/templates/results.html @@ -341,7 +341,7 @@

-
+
Frequency

Frequency

-
+

@@ -360,7 +361,7 @@
Frequency
-

Variants Passed All Filters

+

Variants Passed All Filters

@@ -392,6 +393,9 @@
Variant Score 1.00
+
+ +
diff --git a/exomiser-core/src/test/java/org/monarchinitiative/exomiser/core/filters/FilterReportTest.java b/exomiser-core/src/test/java/org/monarchinitiative/exomiser/core/filters/FilterReportTest.java index c5cb0ef34..e55654fc3 100644 --- a/exomiser-core/src/test/java/org/monarchinitiative/exomiser/core/filters/FilterReportTest.java +++ b/exomiser-core/src/test/java/org/monarchinitiative/exomiser/core/filters/FilterReportTest.java @@ -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)); } }