diff --git a/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReporting.java b/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReporting.java new file mode 100644 index 0000000000..4c445be9e2 --- /dev/null +++ b/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReporting.java @@ -0,0 +1,22 @@ +package com.hartwig.hmftools.common.cuppa.interpretation; + +import org.immutables.value.Value; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@Value.Immutable +@Value.Style(passAnnotations = { NotNull.class, Nullable.class }) +public abstract class CuppaReporting { + + @NotNull + public abstract String bestCancerType(); + + public abstract double bestLikelihood(); + + @NotNull + public abstract String interpretCancerType(); + + @Nullable + public abstract Double interpretLikelihood(); + +} \ No newline at end of file diff --git a/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactory.java b/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactory.java new file mode 100644 index 0000000000..d391ce6e5f --- /dev/null +++ b/hmf-common/src/main/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactory.java @@ -0,0 +1,49 @@ +package com.hartwig.hmftools.common.cuppa.interpretation; + +import org.apache.logging.log4j.util.Strings; +import org.jetbrains.annotations.NotNull; + +public class CuppaReportingFactory { + + private CuppaReportingFactory() { + } + + private static final String RESULTS_INCONCLUSIVE = "results inconclusive"; + + @NotNull + public static String curatedTumorLocation(@NotNull String cancerType) { + if (cancerType.equals("Uterus: Endometrium")) { + cancerType = "Endometrium"; + } else if (cancerType.equals("Colorectum/Appendix/SmallIntestine")) { + cancerType = "Lower GI tract"; + } + return cancerType; + } + + @NotNull + public static String interpretTumorLocation(double likelihood, @NotNull String cancerType) { + // our cut-off is 80% likelihood. When this is below 80% then the results is inconclusive + String interpretCancerType = Strings.EMPTY; + if (likelihood <= 0.8) { + interpretCancerType = RESULTS_INCONCLUSIVE; + } else { + interpretCancerType = cancerType; + } + return interpretCancerType; + } + + @NotNull + public static CuppaReporting createCuppaReportingData(@NotNull CuppaPrediction bestPrediction) { + double likelihood = bestPrediction.likelihood(); + String cancerType = curatedTumorLocation(bestPrediction.cancerType()); + String interpretCancerType = interpretTumorLocation(likelihood, cancerType); + Double interpretLikelihood = likelihood >= 0.5 ? likelihood : null; + + return ImmutableCuppaReporting.builder() + .bestCancerType(cancerType) + .bestLikelihood(likelihood) + .interpretCancerType(interpretCancerType) + .interpretLikelihood(interpretLikelihood) + .build(); + } +} \ No newline at end of file diff --git a/hmf-common/src/test/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactoryTest.java b/hmf-common/src/test/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactoryTest.java new file mode 100644 index 0000000000..1f068922b2 --- /dev/null +++ b/hmf-common/src/test/java/com/hartwig/hmftools/common/cuppa/interpretation/CuppaReportingFactoryTest.java @@ -0,0 +1,60 @@ +package com.hartwig.hmftools.common.cuppa.interpretation; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CuppaReportingFactoryTest { + + private static final double EPSILON = 1.0E-10; + + @Test + public void canCreateCuppaReportingKnown() { + CuppaPrediction prediction = ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(0.90).build(); + CuppaReporting reporting = CuppaReportingFactory.createCuppaReportingData(prediction); + assertEquals("Melanoma", reporting.bestCancerType()); + assertEquals(0.90, reporting.bestLikelihood(), EPSILON); + assertEquals("Melanoma", reporting.interpretCancerType()); + assertEquals(0.90, reporting.interpretLikelihood(), EPSILON); + } + + @Test + public void canCreateCuppaReportingKnownUterus() { + CuppaPrediction prediction = ImmutableCuppaPrediction.builder().cancerType("Uterus: Endometrium").likelihood(0.90).build(); + CuppaReporting reporting = CuppaReportingFactory.createCuppaReportingData(prediction); + assertEquals("Endometrium", reporting.bestCancerType()); + assertEquals(0.90, reporting.bestLikelihood(), EPSILON); + assertEquals("Endometrium", reporting.interpretCancerType()); + assertEquals(0.90, reporting.interpretLikelihood(), EPSILON); + } + + @Test + public void canCreateCuppaReportingKnownColon() { + CuppaPrediction prediction = ImmutableCuppaPrediction.builder().cancerType("Colorectum/Appendix/SmallIntestine").likelihood(0.90).build(); + CuppaReporting reporting = CuppaReportingFactory.createCuppaReportingData(prediction); + assertEquals("Lower GI tract", reporting.bestCancerType()); + assertEquals(0.90, reporting.bestLikelihood(), EPSILON); + assertEquals("Lower GI tract", reporting.interpretCancerType()); + assertEquals(0.90, reporting.interpretLikelihood(), EPSILON); + } + + @Test + public void canCreateCuppaReportingInconclusiveWithLikelihood() { + CuppaPrediction prediction = ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(0.60).build(); + CuppaReporting reporting = CuppaReportingFactory.createCuppaReportingData(prediction); + assertEquals("Melanoma", reporting.bestCancerType()); + assertEquals(0.60, reporting.bestLikelihood(), EPSILON); + assertEquals("results inconclusive", reporting.interpretCancerType()); + assertEquals(0.60, reporting.interpretLikelihood(), EPSILON); + } + + @Test + public void canCreateCuppaReportingInconclusiveWithoutLikelihood() { + CuppaPrediction prediction = ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(0.40).build(); + CuppaReporting reporting = CuppaReportingFactory.createCuppaReportingData(prediction); + assertEquals("Melanoma", reporting.bestCancerType()); + assertEquals(0.40, reporting.bestLikelihood(), EPSILON); + assertEquals("results inconclusive", reporting.interpretCancerType()); + assertNull(reporting.interpretLikelihood()); + } +} \ No newline at end of file diff --git a/lilac/src/main/java/com/hartwig/hmftools/lilac/qc/HaplotypeQC.java b/lilac/src/main/java/com/hartwig/hmftools/lilac/qc/HaplotypeQC.java index cebad826f2..dde159f321 100644 --- a/lilac/src/main/java/com/hartwig/hmftools/lilac/qc/HaplotypeQC.java +++ b/lilac/src/main/java/com/hartwig/hmftools/lilac/qc/HaplotypeQC.java @@ -113,13 +113,13 @@ public static HaplotypeQC create( if(inPon(unmatched)) { pon++; - LL_LOGGER.info(" UNMATCHED_PON_HAPLTOYPE - {}", unmatched); + LL_LOGGER.info(" UNMATCHED_PON_HAPLOTYPE - {}", unmatched); } else { maxSupport = max(maxSupport, unmatched.matchingFragmentCount()); unusedCount++; - LL_LOGGER.info(" UNMATCHED_HAPLTOYPE {}", unmatched); + LL_LOGGER.info(" UNMATCHED_HAPLOTYPE {}", unmatched); } } diff --git a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReport.java b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReport.java index 748977cdde..273a7fc743 100644 --- a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReport.java +++ b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReport.java @@ -3,7 +3,7 @@ import java.util.List; import java.util.Optional; -import com.hartwig.hmftools.common.cuppa.interpretation.CuppaPrediction; +import com.hartwig.hmftools.common.cuppa.interpretation.CuppaReporting; import com.hartwig.hmftools.common.peach.PeachGenotype; import com.hartwig.hmftools.patientreporter.PatientReport; import com.hartwig.hmftools.patientreporter.SampleReport; @@ -38,7 +38,7 @@ public abstract class AnalysedPatientReport implements PatientReport { public abstract GenomicAnalysis genomicAnalysis(); @Nullable - public abstract CuppaPrediction cuppaPrediction(); + public abstract CuppaReporting cuppaReporting(); @Nullable public abstract String cuppaPlot(); diff --git a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReporter.java b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReporter.java index 482b5f7b8b..1f94e502bd 100644 --- a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReporter.java +++ b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/algo/AnalysedPatientReporter.java @@ -14,7 +14,8 @@ import com.hartwig.hmftools.common.cuppa.CuppaDataFile; import com.hartwig.hmftools.common.cuppa.interpretation.CuppaPrediction; import com.hartwig.hmftools.common.cuppa.interpretation.CuppaPredictionFactory; -import com.hartwig.hmftools.common.cuppa.interpretation.ImmutableCuppaPrediction; +import com.hartwig.hmftools.common.cuppa.interpretation.CuppaReporting; +import com.hartwig.hmftools.common.cuppa.interpretation.CuppaReportingFactory; import com.hartwig.hmftools.common.lims.LimsGermlineReportingLevel; import com.hartwig.hmftools.common.peach.PeachGenotype; import com.hartwig.hmftools.common.peach.PeachGenotypeFile; @@ -95,12 +96,7 @@ public AnalysedPatientReport run(@NotNull SampleMetadata sampleMetadata, @NotNul List predictions = CuppaPredictionFactory.create(cuppaEntries); CuppaPrediction best = predictions.get(0); - if (best.likelihood() > 0.8) { - best = predictions.get(0); - } else { - // our cut-off is 80% likelihood. When this is below 80% then the results is inconclusive - best = ImmutableCuppaPrediction.builder().cancerType("results inconclusive").likelihood(0).build(); - } + CuppaReporting cuppaReporting = CuppaReportingFactory.createCuppaReportingData(best); LOGGER.info(" Predicted cancer type '{}' with likelihood {}", best.cancerType(), best.likelihood()); @@ -117,10 +113,10 @@ public AnalysedPatientReport run(@NotNull SampleMetadata sampleMetadata, @NotNul .specialRemark(specialRemark) .pipelineVersion(pipelineVersion) .genomicAnalysis(curateGeneName) - .cuppaPrediction( + .cuppaReporting( curateGeneName.purpleQCStatus().contains(PurpleQCStatus.FAIL_CONTAMINATION) || !curateGeneName.hasReliablePurity() ? null - : best) + : cuppaReporting) .cuppaPlot(config.cuppaPlot()) .circosPath(config.purpleCircosPlot()) .comments(Optional.ofNullable(config.comments())) @@ -179,8 +175,8 @@ private static void printReportState(@NotNull AnalysedPatientReport report) { GenomicAnalysis analysis = report.genomicAnalysis(); LOGGER.info("Printing genomic analysis results for {}:", report.sampleReport().tumorSampleId()); - if (report.cuppaPrediction() != null) { - LOGGER.info(" Molecular tissue origin conclusion: {}", report.cuppaPrediction().cancerType()); + if (report.cuppaReporting() != null) { + LOGGER.info(" Molecular tissue origin conclusion: {}", report.cuppaReporting().interpretCancerType()); } LOGGER.info(" Somatic variants to report: {}", analysis.reportableVariants().size()); if (report.sampleReport().germlineReportingLevel() != LimsGermlineReportingLevel.NO_REPORTING) { diff --git a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/cfreport/chapters/analysed/SummaryChapter.java b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/cfreport/chapters/analysed/SummaryChapter.java index 427f344732..66e6c1f580 100644 --- a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/cfreport/chapters/analysed/SummaryChapter.java +++ b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/cfreport/chapters/analysed/SummaryChapter.java @@ -205,9 +205,15 @@ private void renderTumorCharacteristics(@NotNull Document reportDocument) { TumorPurity.RANGE_MAX, table); - String cuppaPrediction = patientReport.cuppaPrediction() != null && patientReport.genomicAnalysis().hasReliablePurity() - ? patientReport.cuppaPrediction().cancerType() + " (" + patientReport.cuppaPrediction().likelihood() + ")" - : DataUtil.NA_STRING; + String cuppaPrediction = Strings.EMPTY; + if (patientReport.cuppaReporting() != null && patientReport.genomicAnalysis().hasReliablePurity()) { + if (patientReport.cuppaReporting().interpretLikelihood() == null) { + cuppaPrediction = patientReport.cuppaReporting().interpretCancerType(); + } else { + cuppaPrediction = patientReport.cuppaReporting().interpretCancerType() + " (" + patientReport.cuppaReporting().interpretLikelihood() + ")"; + } + } + Style dataStyleMolecularTissuePrediction = hasReliablePurity ? ReportResources.dataHighlightStyle() : ReportResources.dataHighlightNaStyle(); @@ -445,17 +451,15 @@ private void renderGermlineText(@NotNull Document reportDocument) { String text = "Data concerning cancer predisposition genes may be requested by a clinical geneticist after the patient has " + "given informed consent."; - Div div = createSectionStartDiv(contentWidth()); - div.add(new Paragraph("Germline results").addStyle(ReportResources.sectionTitleStyle())); + Div div = createSectionStartDiv(contentWidth()); + div.add(new Paragraph("Germline results").addStyle(ReportResources.sectionTitleStyle())); - div.add(new Paragraph(text).setWidth(contentWidth()).addStyle(ReportResources.bodyTextStyle()).setFixedLeading(11)); + div.add(new Paragraph(text).setWidth(contentWidth()).addStyle(ReportResources.bodyTextStyle()).setFixedLeading(11)); - reportDocument.add(div); + reportDocument.add(div); } - - @NotNull @VisibleForTesting static Set sortGenes(@NotNull Set driverVariantGenes) { diff --git a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/xml/XMLFactory.java b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/xml/XMLFactory.java index cf3f72e19b..761cf703aa 100644 --- a/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/xml/XMLFactory.java +++ b/patient-reporter/src/main/java/com/hartwig/hmftools/patientreporter/xml/XMLFactory.java @@ -29,23 +29,29 @@ private XMLFactory() { public static ReportXML generateXMLData(@NotNull AnalysedPatientReport report) { Map mapXml = Maps.newHashMap(); mapXml.put("itemVrbAanvrager", ImmutableKeyXML.builder().keyPath("VrbAanvrager").valuePath(Map.of("value", Strings.EMPTY)).build()); - mapXml.put("itemVrbOnderzoekNummers", - ImmutableKeyXML.builder().keyPath("VrbOnderzoekNummers").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemVrbAanvragerAnders", ImmutableKeyXML.builder().keyPath("VrbAanvragerAnders").valuePath(Map.of("value", Strings.EMPTY)).build()); + mapXml.put("itemVrbOnderzoekNummers", + ImmutableKeyXML.builder().keyPath("VrbOnderzoekNummers").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemVrbProcedure", ImmutableKeyXML.builder().keyPath("VrbProcedure").valuePath(Map.of("value", "wgs")).build()); mapXml.put("itemRefNummerWgs", ImmutableKeyXML.builder() .keyPath("RefNummerWgs") - .valuePath(Map.of("value", report.sampleReport().tumorSampleId())) + .valuePath(Map.of("value", + !report.sampleReport().hospitalPatientId().isEmpty() + ? report.sampleReport().hospitalPatientId() + : report.sampleReport().tumorSampleId())) .build()); mapXml.put("importwgs.wgs_reference_number", ImmutableKeyXML.builder() .keyPath("importwgs.wgs_reference_number") - .valuePath(Map.of("value", report.sampleReport().tumorSampleId())) + .valuePath(Map.of("value", + !report.sampleReport().hospitalPatientId().isEmpty() + ? report.sampleReport().hospitalPatientId() + : report.sampleReport().tumorSampleId())) .build()); mapXml.put("itemWgsRedenAanvraag", - ImmutableKeyXML.builder().keyPath("WgsRedenAanvraag").valuePath(Map.of("value", "therapiekeuze")).build()); + ImmutableKeyXML.builder().keyPath("WgsRedenAanvraag").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsGevrOndzTher", ImmutableKeyXML.builder().keyPath("WgsGevrOndzTher").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsGevrOndzTherAnd", @@ -54,19 +60,12 @@ public static ReportXML generateXMLData(@NotNull AnalysedPatientReport report) { ImmutableKeyXML.builder().keyPath("WgsGevrOndzDiffDiag").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsGevrOndzDiffDiagAnd", ImmutableKeyXML.builder().keyPath("WgsGevrOndzDiffDiagAnd").valuePath(Map.of("value", Strings.EMPTY)).build()); - // mapXml.put("itemWgsRefNummer", ImmutableKeyXML.builder().keyPath("wgsRefNummer").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsPercNeoCellenEx", ImmutableKeyXML.builder().keyPath("WgsPercNeoCellenEx").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsPercNeoCellenBeoord", ImmutableKeyXML.builder().keyPath("WgsPercNeoCellenBeoord").valuePath(Map.of("value", Strings.EMPTY)).build()); - // mapXml.put("itemWgsPercNeoCellen", - // ImmutableKeyXML.builder().keyPath("wgsPercNeoCellen").valuePath(Map.of("value", Strings.EMPTY)).build()); - // mapXml.put("itemWgsDatasheetSeqAnaPanel", - // ImmutableKeyXML.builder().keyPath("wgsDatasheetSeqAnaPanel").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsPlatform", ImmutableKeyXML.builder().keyPath("WgsPlatform").valuePath(Map.of("value", "Illumina NovaSeq")).build()); - // mapXml.put("itemWgsPlatformAnd", - // ImmutableKeyXML.builder().keyPath("wgsPlatformAnd").valuePath(Map.of("value", Strings.EMPTY)).build()); mapXml.put("itemWgsTumorPurity", ImmutableKeyXML.builder() .keyPath("WgsTumorPurity") @@ -77,24 +76,32 @@ public static ReportXML generateXMLData(@NotNull AnalysedPatientReport report) { .keyPath("WgsGemTuPloid") .valuePath(Map.of("value", String.valueOf(report.genomicAnalysis().averageTumorPloidy()))) .build()); - // mapXml.put("itemWgsCupAnalyse", - // ImmutableKeyXML.builder().keyPath("wgsCupAnalyse").valuePath(Map.of("value", Strings.EMPTY)).build()); + + String cupAnalyse = Strings.EMPTY; + if (report.cuppaReporting().interpretLikelihood() == null) { + cupAnalyse = report.cuppaReporting().interpretCancerType(); + } else { + cupAnalyse = report.cuppaReporting().interpretCancerType() + " (" + report.cuppaReporting().interpretLikelihood() + ")"; + } + mapXml.put("itemWgsCupAnalyse", ImmutableKeyXML.builder().keyPath("wgsCupAnalyse").valuePath(Map.of("value", cupAnalyse)).build()); + + String disclaimer = Strings.EMPTY; + disclaimer += report.genomicAnalysis().hasReliablePurity() ? Strings.EMPTY : "Disclaimer. "; + disclaimer += !report.specialRemark().isEmpty() ? report.specialRemark() : Strings.EMPTY; mapXml.put("itemWgsDisclaimerTonen", - ImmutableKeyXML.builder().keyPath("WgsDisclaimerTonen").valuePath(Map.of("value", Strings.EMPTY)).build()); + ImmutableKeyXML.builder().keyPath("WgsDisclaimerTonen").valuePath(Map.of("value", disclaimer)).build()); + mapXml.put("itemWgsMolecInter", - ImmutableKeyXML.builder().keyPath("WgsMolecInter").valuePath(Map.of("value", Strings.EMPTY)).build()); + ImmutableKeyXML.builder() + .keyPath("WgsMolecInter") + .valuePath(Map.of("value", report.clinicalSummary() != null ? report.clinicalSummary() : Strings.EMPTY)) + .build()); mapXml.put("itemWgsKlinInter", ImmutableKeyXML.builder().keyPath("WgsKlinInter").valuePath(Map.of("value", Strings.EMPTY)).build()); - // mapXml.put("itemWgsAutoKMBP", ImmutableKeyXML.builder().keyPath("wgsAutoKMBP").valuePath(Map.of("value", Strings.EMPTY)).build()); addReportableVariantsToXML(report.genomicAnalysis().reportableVariants(), mapXml); addGainLossesToXML(report.genomicAnalysis().gainsAndLosses(), report.genomicAnalysis().cnPerChromosome(), mapXml); addFusionToXML(report.genomicAnalysis().geneFusions(), mapXml); - // mapXml.put("importwgs.wgsms.line[1]export", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsms.line[1]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("importwgs.wgsms.line[1]msscore", ImmutableKeyXML.builder() .keyPath("importwgs.wgsms.line[1]msscore") @@ -130,8 +137,6 @@ public static ReportXML generateXMLData(@NotNull AnalysedPatientReport report) { .keyPath("importwgs.wgsms.line[1]horestu") .valuePath(Map.of("value", report.genomicAnalysis().chordHrdStatus().name())) .build()); - // mapXml.put("importwgs.wgsms.line[1]geenpv", - // ImmutableKeyXML.builder().keyPath("importwgs.wgsms.line[1]geenpv").valuePath(Map.of("value", Strings.EMPTY)).build()); addHomozygousDisruptionsToXML(report.genomicAnalysis().homozygousDisruptions(), mapXml); addVirussesToXML(report.genomicAnalysis().reportableViruses(), mapXml); @@ -158,11 +163,6 @@ public static void addGainLossesToXML(@NotNull List gainLosses, @NotNu @NotNull Map mapXml) { int count = 1; for (GainLoss gainLoss : gainLosses) { - // mapXml.put("item[" + count + "importwgs.wgscnv.line[" + count + "]export", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgscnv.line[" + count + "]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("item[" + count + "importwgs.wgscnv.line[" + count + "]chr", ImmutableKeyXML.builder() .keyPath("importwgs.wgscnv.line[" + count + "]chr") @@ -193,11 +193,6 @@ public static void addGainLossesToXML(@NotNull List gainLosses, @NotNu .keyPath("importwgs.wgscnv.line[" + count + "]charmco") .valuePath(Map.of("value", GainsAndLosses.chromosomeArmCopyNumber(chromosomeArmData, gainLoss))) .build()); - // mapXml.put("item[" + count + "importwgs.wgscnv.line[" + count + "]geenpv", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgscnv.line[" + count + "]geenpv") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); count += 1; } } @@ -206,11 +201,6 @@ public static void addHomozygousDisruptionsToXML(@NotNull List mapXml) { int count = 1; for (HomozygousDisruption homozygousDisruption : homozygousDisruptions) { - // mapXml.put("item[" + count + "importw.wgsgshzy.line[" + count + "]export", - // ImmutableKeyXML.builder() - // .keyPath("importw.wgsgshzy.line[" + count + "]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("item[" + count + "importwgs.wgshzy.line[" + count + "]gen", ImmutableKeyXML.builder() .keyPath("importwgs.wgshzy.line[" + count + "]gen") @@ -226,11 +216,6 @@ public static void addHomozygousDisruptionsToXML(@NotNull List r @NotNull Map mapXml) { int count = 1; for (ReportableVariant reportableVariant : reportableVariants) { - - // mapXml.put("item[" + count + "importwgs.wgsgene.line[" + count + "]export", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsgene.line[" + count + "]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("item[" + count + "importwgs.wgsgene.line[" + count + "]name", ImmutableKeyXML.builder() .keyPath("importwgs.wgsgene.line[" + count + "]name") @@ -298,11 +277,6 @@ public static void addReportableVariantsToXML(@NotNull List r .keyPath("importwgs.wgsgene.line[" + count + "]driver") .valuePath(Map.of("value", reportableVariant.driverLikelihoodInterpretation().name())) .build()); - // mapXml.put("item[" + count + "importwgs.wgsgene.line[" + count + "]geenpv", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsgene.line[" + count + "]geenpv") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); count += 1; } } @@ -310,21 +284,11 @@ public static void addReportableVariantsToXML(@NotNull List r public static void addVirussesToXML(@NotNull List annotatedVirusList, @NotNull Map mapXml) { int count = 1; for (AnnotatedVirus virus : annotatedVirusList) { - // mapXml.put("item[" + count + "importwgs.wgsvrs.line[" + count + "]export", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsvrs.line[" + count + "]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("item[" + count + "importwgs.wgsvrs.line[" + count + "]name", ImmutableKeyXML.builder() .keyPath("importwgs.wgsvrs.line[" + count + "]name") .valuePath(Map.of("value", virus.name())) .build()); - // mapXml.put("item[" + count + "importwgs.wgsvrs.line[" + count + "]geenpv", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsvrs.line[" + count + "]geenpv") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); count += 1; } } @@ -332,11 +296,6 @@ public static void addVirussesToXML(@NotNull List annotatedVirus public static void addFusionToXML(@NotNull List linxFusions, @NotNull Map mapXml) { int count = 1; for (LinxFusion fusion : linxFusions) { - // mapXml.put("item[" + count + "[importwgs.wgsfusie.line[" + count + "]export", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsfusie.line[" + count + "]export") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); mapXml.put("item[" + count + "importwgs.wgsfusie.line[" + count + "]name", ImmutableKeyXML.builder() .keyPath("importwgs.wgsfusie.line[" + count + "]name") @@ -387,11 +346,6 @@ public static void addFusionToXML(@NotNull List linxFusions, @NotNul .keyPath("importwgs.wgsfusie.line[" + count + "]driver") .valuePath(Map.of("value", fusion.likelihood().name())) .build()); - // mapXml.put("item[" + count + "importwgs.wgsfusie.line[" + count + "]geenpv", - // ImmutableKeyXML.builder() - // .keyPath("importwgs.wgsfusie.line[" + count + "]geenpv") - // .valuePath(Map.of("value", Strings.EMPTY)) - // .build()); count += 1; } } diff --git a/patient-reporter/src/test/java/com/hartwig/hmftools/patientreporter/ExampleAnalysisTestFactory.java b/patient-reporter/src/test/java/com/hartwig/hmftools/patientreporter/ExampleAnalysisTestFactory.java index 8816577e50..0a93d42079 100644 --- a/patient-reporter/src/test/java/com/hartwig/hmftools/patientreporter/ExampleAnalysisTestFactory.java +++ b/patient-reporter/src/test/java/com/hartwig/hmftools/patientreporter/ExampleAnalysisTestFactory.java @@ -13,8 +13,8 @@ import com.google.common.collect.Sets; import com.hartwig.hmftools.common.chord.ChordStatus; import com.hartwig.hmftools.common.clinical.ImmutablePatientPrimaryTumor; -import com.hartwig.hmftools.common.cuppa.interpretation.CuppaPrediction; -import com.hartwig.hmftools.common.cuppa.interpretation.ImmutableCuppaPrediction; +import com.hartwig.hmftools.common.cuppa.interpretation.CuppaReporting; +import com.hartwig.hmftools.common.cuppa.interpretation.ImmutableCuppaReporting; import com.hartwig.hmftools.common.fusion.KnownFusionType; import com.hartwig.hmftools.common.genome.chromosome.HumanChromosome; import com.hartwig.hmftools.common.genotype.GenotypeStatus; @@ -197,7 +197,12 @@ public static AnalysedPatientReport createWithCOLO829Data(@NotNull ExampleAnalys .suspectGeneCopyNumbersHRDWithLOH(HRDLOHGenes()) .build(); - CuppaPrediction cuppaPrediction = ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(99.6).build(); + CuppaReporting cuppaReporting = ImmutableCuppaReporting.builder() + .bestCancerType("Melanoma") + .bestLikelihood(99.1) + .interpretCancerType("Melanoma") + .interpretLikelihood(99.1) + .build(); return ImmutableAnalysedPatientReport.builder() .sampleReport(sampleReport) @@ -206,7 +211,7 @@ public static AnalysedPatientReport createWithCOLO829Data(@NotNull ExampleAnalys .specialRemark(specialremark) .genomicAnalysis(analysis) .circosPath(REPORTER_CONFIG.purpleCircosPlot()) - .cuppaPrediction(cuppaPrediction) + .cuppaReporting(cuppaReporting) .cuppaPlot(REPORTER_CONFIG.cuppaPlot()) .comments(Optional.ofNullable(config.comments())) .isCorrectedReport(config.isCorrectionReport()) diff --git a/rose/src/main/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgo.java b/rose/src/main/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgo.java index 33a242cdd0..07fd81812d 100644 --- a/rose/src/main/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgo.java +++ b/rose/src/main/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgo.java @@ -126,10 +126,11 @@ public static Map generateDriverGenesMap(@NotNull List conclusion){ + public static void generateStartSentence(@NotNull List conclusion) { conclusion.add("Sample showing: "); } + public static void generateCUPPAConclusion(@NotNull List conclusion, CuppaPrediction cuppaPrediction, @NotNull Map actionabilityMap) { @@ -139,8 +140,10 @@ public static void generateCUPPAConclusion(@NotNull List conclusion, Cup ActionabilityEntry entry = actionabilityMap.get(keyCuppaInconclusice); if (entry != null && entry.condition() == Condition.OTHER) { - if (cuppaPrediction.likelihood()>= 0.5) { - conclusion.add("- " + entry.conclusion().replace("xxx - xx%", cuppaPrediction.cancerType() + "-" + cuppaPrediction.likelihood())); + if (cuppaPrediction.likelihood() >= 0.5) { + conclusion.add("- " + entry.conclusion() + .replace("xxx - xx%", + cuppaPrediction.cancerType() + "-" + cuppaPrediction.likelihood())); } else { conclusion.add("- " + entry.conclusion().replace(" (highest likelihood: xxx - xx%)", "")); } @@ -151,7 +154,7 @@ public static void generateCUPPAConclusion(@NotNull List conclusion, Cup ActionabilityEntry entry = actionabilityMap.get(keyCuppa); if (entry != null && entry.condition() == Condition.OTHER) { - conclusion.add("- " + entry.conclusion() .replace("XXXX", cuppaPrediction.cancerType())); + conclusion.add("- " + entry.conclusion().replace("XXXX", cuppaPrediction.cancerType())); } } } @@ -213,7 +216,8 @@ public static void generateVariantConclusion(@NotNull List conclusion, @ actionable.add("variant"); } - if (driverGenesMap.get(keyMap.getKey()).likelihoodType().equals(DriverCategory.TSG) && variantMerging.toString().split(",").length == 1) { + if (driverGenesMap.get(keyMap.getKey()).likelihoodType().equals(DriverCategory.TSG) + && variantMerging.toString().split(",").length == 1) { if (!keyMap.getValue().get(0).bialleic()) { ActionabilityKey keyBiallelic = ImmutableActionabilityKey.builder().match("NOT_BIALLELIC").type(TypeAlteration.NOT_BIALLELIC).build(); diff --git a/rose/src/test/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgoTest.java b/rose/src/test/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgoTest.java index 075ee967a4..1467f6281e 100644 --- a/rose/src/test/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgoTest.java +++ b/rose/src/test/java/com/hartwig/hmftools/rose/conclusion/ConclusionAlgoTest.java @@ -60,10 +60,18 @@ public class ConclusionAlgoTest { public void canGenerateCUPPAConclusion() { List conclusion = Lists.newArrayList(); Map actionabilityMap = Maps.newHashMap(); - actionabilityMap = testActionabilityMap(actionabilityMap, "CUPPA", TypeAlteration.CUPPA, "CUPPA", Condition.OTHER, "Molecular Tissue of Origin classifier: XXXX."); + actionabilityMap = testActionabilityMap(actionabilityMap, + "CUPPA", + TypeAlteration.CUPPA, + "CUPPA", + Condition.OTHER, + "Molecular Tissue of Origin classifier: XXXX."); + + CuppaPrediction cuppaPrediction = ImmutableCuppaPrediction.builder() + .cancerType("Melanoma") + .likelihood(99.6) + .build(); - CuppaPrediction cuppaPrediction = - ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(99.6).build(); ConclusionAlgo.generateCUPPAConclusion(conclusion, cuppaPrediction, actionabilityMap); assertEquals(1, conclusion.size()); @@ -82,8 +90,10 @@ public void canGenerateCUPPAConclusionInconclusive() { Condition.OTHER, "Molecular Tissue of Origin classifier: Inconclusive (highest likelihood: xxx - xx%)."); - CuppaPrediction cuppaPrediction = - ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(0).build(); + CuppaPrediction cuppaPrediction = ImmutableCuppaPrediction.builder() + .cancerType("Melanoma") + .likelihood(0.45) + .build(); ConclusionAlgo.generateCUPPAConclusion(conclusion, cuppaPrediction, actionabilityMap); @@ -103,8 +113,10 @@ public void canGenerateCUPPAConclusionInconclusiveWithLocation() { Condition.OTHER, "Molecular Tissue of Origin classifier: Inconclusive (highest likelihood: xxx - xx%)."); - CuppaPrediction cuppaPrediction = - ImmutableCuppaPrediction.builder().cancerType("Melanoma").likelihood(0.60).build(); + CuppaPrediction cuppaPrediction = ImmutableCuppaPrediction.builder() + .cancerType("Melanoma") + .likelihood(0.60) + .build(); ConclusionAlgo.generateCUPPAConclusion(conclusion, cuppaPrediction, actionabilityMap);