FilterGermlineVariants { @NotNull public static List<DriverGermlineVariant> filterGermlineVariantsForReporting( @NotNull List<ReportableGermlineVariant> germlineVariants, @NotNull GermlineReportingModel germlineReportingModel, @NotNull List<GeneCopyNumber> allGeneCopyNumbers, @NotNull List<DriverSomaticVariant> somaticDriverVariantsToReport, @NotNull ChordStatus chordStatus) { List<DriverGermlineVariant> reportableGermlineVariants = Lists.newArrayList(); Set<String> reportableGermlineGenes = germlineReportingModel.reportableGermlineGenes(); for (ReportableGermlineVariant germlineVariant : presentInTumorOnly(germlineVariants)) { if (reportableGermlineGenes.contains(germlineVariant.gene())) { if (germlineVariant.gene().equals("KIT")) { reportableGermlineVariants.add(reportableGermlineVariantWithDriverLikelihood(germlineVariant, 1.0)); } else { boolean filterBiallelic = germlineVariant.biallelic(); boolean filterMinCopyNumberTumor = false; GeneCopyNumber geneCopyNumber = lookupGeneCopyNumber(allGeneCopyNumbers, germlineVariant.gene()); if (Math.round(geneCopyNumber.minCopyNumber()) <= 1 && (Math.round(germlineVariant.adjustedCopyNumber()) >= 2)) { filterMinCopyNumberTumor = true; } boolean filterSomaticVariantInSameGene = false; for (DriverSomaticVariant driverVariant : somaticDriverVariantsToReport) { if (driverVariant.variant().gene().equals(germlineVariant.gene())) { filterSomaticVariantInSameGene = true; } } boolean filterGermlineVariantInSameGene = false; for (ReportableGermlineVariant variant : germlineVariants) { if (variant != germlineVariant && variant.gene().equals(germlineVariant.gene())) { filterGermlineVariantInSameGene = true; } } if (filterBiallelic || filterSomaticVariantInSameGene || filterGermlineVariantInSameGene) { reportableGermlineVariants.add(reportableGermlineVariantWithDriverLikelihood(germlineVariant, 1.0)); } else if (filterMinCopyNumberTumor || chordStatus == ChordStatus.HR_DEFICIENT) { reportableGermlineVariants.add(reportableGermlineVariantWithDriverLikelihood(germlineVariant, 0.5)); } } } } return reportableGermlineVariants; } private  FilterGermlineVariants(); @NotNull static List<DriverGermlineVariant> filterGermlineVariantsForReporting(
            @NotNull List<ReportableGermlineVariant> germlineVariants, @NotNull GermlineReportingModel germlineReportingModel,
            @NotNull List<GeneCopyNumber> allGeneCopyNumbers, @NotNull List<DriverSomaticVariant> somaticDriverVariantsToReport,
            @NotNull ChordStatus chordStatus);  }
@Test public void checkForGermlineGenesReportedONCO() { GermlineReportingModel germlineReportingModel = createTestGermlineGenesReporting(); List<GeneCopyNumber> geneCopyNumbers = Lists.newArrayList(); List<DriverSomaticVariant> somaticVariants = Lists.newArrayList(); List<ReportableGermlineVariant> germlineVariantsNotPresentInTumor = createTestGermlineVariantsONCOGeneNotPresentInTumor(); List<DriverGermlineVariant> filteredGermlineVariantMatchNotPresentInTumor = FilterGermlineVariants.filterGermlineVariantsForReporting(germlineVariantsNotPresentInTumor, germlineReportingModel, geneCopyNumbers, somaticVariants, ChordStatus.HR_PROFICIENT); assertEquals(0, filteredGermlineVariantMatchNotPresentInTumor.size()); List<ReportableGermlineVariant> germlineVariantsPresentInTumor = createTestGermlineVariantsONCOGenePresentInTumor(); List<DriverGermlineVariant> filteredGermlineVariantMatchPresentInTumor = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsPresentInTumor, germlineReportingModel, geneCopyNumbers, somaticVariants, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantMatchPresentInTumor.size()); }
@Test public void checkForGermlineGenesReportedTSG() { GermlineReportingModel germlineReportingModel = createTestGermlineGenesReporting(); List<ReportableGermlineVariant> germlineVariantsMatch = createTestGermlineVariantsTSGGene(true, 1); List<ReportableGermlineVariant> germlineVariantsNonMatch = createTestGermlineVariantsTSGGene(false, 2); List<GeneCopyNumber> geneCopyNumbersMatch = createCopyNumberListForTSG(1); List<GeneCopyNumber> geneCopyNumbersNonMatch = createCopyNumberListForTSG(2); List<DriverSomaticVariant> variantsMatch = createSomaticVariantListForGene(TSG); List<DriverSomaticVariant> variantsNonMatch = createSomaticVariantListForGene("AAAA"); List<DriverGermlineVariant> filteredGermlineVariantAllMatch = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsMatch, germlineReportingModel, geneCopyNumbersMatch, variantsMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantAllMatch.size()); List<DriverGermlineVariant> filteredGermlineVariantNonMatchBiallelic = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsNonMatch, germlineReportingModel, geneCopyNumbersMatch, variantsMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantNonMatchBiallelic.size()); List<DriverGermlineVariant> filteredGermlineVariantNonMatchVariant = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsMatch, germlineReportingModel, geneCopyNumbersMatch, variantsNonMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantNonMatchVariant.size()); List<DriverGermlineVariant> filteredGermlineVariantNonMatchCopy = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsMatch, germlineReportingModel, geneCopyNumbersNonMatch, variantsMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantNonMatchCopy.size()); List<DriverGermlineVariant> filteredGermlineVariantNonMatch = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsNonMatch, germlineReportingModel, geneCopyNumbersNonMatch, variantsNonMatch, ChordStatus.HR_PROFICIENT); assertEquals(0, filteredGermlineVariantNonMatch.size()); List<DriverGermlineVariant> filteredGermlineVariantOptionBiallelic = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsMatch, germlineReportingModel, geneCopyNumbersNonMatch, variantsNonMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantOptionBiallelic.size()); List<DriverGermlineVariant> filteredGermlineVariantOptionVariant = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsNonMatch, germlineReportingModel, geneCopyNumbersNonMatch, variantsMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantOptionVariant.size()); List<DriverGermlineVariant> filteredGermlineVariantOptionCopyNumberPartialLoss = FilterGermlineVariants.filterGermlineVariantsForReporting(germlineVariantsNonMatch, germlineReportingModel, geneCopyNumbersMatch, variantsNonMatch, ChordStatus.HR_PROFICIENT); assertEquals(1, filteredGermlineVariantOptionCopyNumberPartialLoss.size()); List<DriverGermlineVariant> filteredGermlineVariantOptionCopyNumberHRD = FilterGermlineVariants.filterGermlineVariantsForReporting( germlineVariantsNonMatch, germlineReportingModel, geneCopyNumbersNonMatch, variantsNonMatch, ChordStatus.HR_DEFICIENT); assertEquals(1, filteredGermlineVariantOptionCopyNumberHRD.size()); }