ReportableVariantAnalyzer { @NotNull public static ReportableVariantAnalysis mergeSomaticAndGermlineVariants(@NotNull List<DriverSomaticVariant> somaticVariantsReport, @NotNull List<DriverGermlineVariant> germlineVariantsToReport, @NotNull GermlineReportingModel germlineReportingModel, @NotNull LimsGermlineReportingLevel germlineReportingChoice, @NotNull ActionabilityAnalyzer actionabilityAnalyzer, @Nullable PatientTumorLocation patientTumorLocation) { List<ReportableVariant> allReportableVariants = ReportableVariantFactory.mergeSomaticAndGermlineVariants(somaticVariantsReport, germlineVariantsToReport, germlineReportingModel, germlineReportingChoice); String primaryTumorLocation = patientTumorLocation != null ? patientTumorLocation.primaryTumorLocation() : null; Map<ReportableVariant, List<EvidenceItem>> evidencePerVariant = filterHighDriverLikelihood(actionabilityAnalyzer.evidenceForAllVariants(allReportableVariants, primaryTumorLocation)); return ImmutableReportableVariantAnalysis.of(allReportableVariants, ReportableEvidenceItemFactory.toReportableFlatList(evidencePerVariant)); } private  ReportableVariantAnalyzer(); @NotNull static ReportableVariantAnalysis mergeSomaticAndGermlineVariants(@NotNull List<DriverSomaticVariant> somaticVariantsReport,
            @NotNull List<DriverGermlineVariant> germlineVariantsToReport, @NotNull GermlineReportingModel germlineReportingModel,
            @NotNull LimsGermlineReportingLevel germlineReportingChoice, @NotNull ActionabilityAnalyzer actionabilityAnalyzer,
            @Nullable PatientTumorLocation patientTumorLocation);  }
@Test public void overruleDriverLikelihoodOfSomaticVariants() { DriverSomaticVariant variant1 = ImmutableDriverSomaticVariant.builder() .variant(PatientReporterTestFactory.createTestSomaticVariantBuilder().gene(ONCO).build()) .driverLikelihood(0D) .build(); DriverSomaticVariant variant2 = ImmutableDriverSomaticVariant.builder() .variant(PatientReporterTestFactory.createTestSomaticVariantBuilder().gene(TSG).build()) .driverLikelihood(0D) .build(); List<DriverSomaticVariant> somaticVariantsToReport = Lists.newArrayList(variant1, variant2); List<DriverGermlineVariant> germlineVariantsToReport = createBiallelicGermlineVariantsOnOncoAndTSG(); ReportableVariantAnalysis reportableVariantsAnalysis = ReportableVariantAnalyzer.mergeSomaticAndGermlineVariants(somaticVariantsToReport, germlineVariantsToReport, PatientReporterTestFactory.createTestEmptyGermlineGenesReporting(), LimsGermlineReportingLevel.REPORT_WITH_NOTIFICATION, testAnalysedReportData().actionabilityAnalyzer(), null); List<ReportableVariant> reportableVariants = reportableVariantsAnalysis.variantsToReport(); assertEquals(4, reportableVariants.size()); assertEquals(1.0, reportableVariants.get(0).driverLikelihood(), EPSILON); assertEquals(0.5, reportableVariants.get(1).driverLikelihood(), EPSILON); assertEquals(1.0, reportableVariants.get(2).driverLikelihood(), EPSILON); assertEquals(0.5, reportableVariants.get(3).driverLikelihood(), EPSILON); }
@Test public void mergeSomaticAndGermlineVariantWithNotifyGermline() { List<DriverSomaticVariant> somaticVariantsToReport = Lists.newArrayList(ImmutableDriverSomaticVariant.builder() .variant(PatientReporterTestFactory.createTestSomaticVariantBuilder().gene(TSG).build()) .driverLikelihood(0D) .build()); List<DriverGermlineVariant> germlineVariantsToReport = createBiallelicGermlineVariantsOnOncoAndTSG(); GermlineReportingModel germlineReportingModel = createGermlineReportingModelWithOncoAndTSG(); ReportableVariantAnalysis reportableVariantsAnalysis = ReportableVariantAnalyzer.mergeSomaticAndGermlineVariants(somaticVariantsToReport, germlineVariantsToReport, germlineReportingModel, LimsGermlineReportingLevel.REPORT_WITH_NOTIFICATION, testAnalysedReportData().actionabilityAnalyzer(), null); List<ReportableVariant> reportableVariants = reportableVariantsAnalysis.variantsToReport(); assertEquals(3, reportableVariants.size()); assertEquals(TSG, reportableVariants.get(0).gene()); assertFalse(reportableVariants.get(0).notifyClinicalGeneticist()); assertEquals(ONCO, reportableVariants.get(1).gene()); assertTrue(reportableVariants.get(1).notifyClinicalGeneticist()); assertTrue(reportableVariants.get(1).biallelic()); assertEquals(TSG, reportableVariants.get(2).gene()); assertFalse(reportableVariants.get(2).notifyClinicalGeneticist()); assertFalse(reportableVariants.get(2).biallelic()); }
@Test public void mergeSomaticAndGermlineVariantWithoutNotifyGermline() { List<DriverSomaticVariant> somaticVariantsToReport = Lists.newArrayList(ImmutableDriverSomaticVariant.builder() .variant(PatientReporterTestFactory.createTestSomaticVariantBuilder().gene(TSG).build()) .driverLikelihood(0D) .build()); List<DriverGermlineVariant> germlineVariantsToReport = createBiallelicGermlineVariantsOnOncoAndTSG(); GermlineReportingModel germlineReportingModel = createGermlineReportingModelWithOncoAndTSG(); ReportableVariantAnalysis reportableVariantsAnalysis = ReportableVariantAnalyzer.mergeSomaticAndGermlineVariants(somaticVariantsToReport, germlineVariantsToReport, germlineReportingModel, LimsGermlineReportingLevel.NO_REPORTING, testAnalysedReportData().actionabilityAnalyzer(), null); List<ReportableVariant> reportableVariants = reportableVariantsAnalysis.variantsToReport(); assertEquals(3, reportableVariants.size()); assertEquals(TSG, reportableVariants.get(0).gene()); assertFalse(reportableVariants.get(0).notifyClinicalGeneticist()); assertTrue(reportableVariants.get(0).biallelic()); assertEquals(ONCO, reportableVariants.get(1).gene()); assertFalse(reportableVariants.get(1).notifyClinicalGeneticist()); assertTrue(reportableVariants.get(1).biallelic()); assertEquals(TSG, reportableVariants.get(2).gene()); assertFalse(reportableVariants.get(2).notifyClinicalGeneticist()); assertFalse(reportableVariants.get(2).biallelic()); }