CNADrivers { @NotNull public List<DriverCatalog> deletions(@NotNull final List<GeneCopyNumber> geneCopyNumbers) { Predicate<GeneCopyNumber> qcStatusPredicate = qcStatus.contains(PurpleQCStatus.WARN_DELETED_GENES) || qcStatus.contains(PurpleQCStatus.WARN_HIGH_COPY_NUMBER_NOISE) ? x -> supportedByTwoSVs(x) || shortAndSupportedByOneSVAndMere(x) : x -> true; return geneCopyNumbers.stream() .filter(x -> x.minCopyNumber() < MAX_COPY_NUMBER_DEL) .filter(x -> tsGenes.contains(x.gene()) | deletionTargets.contains(x.gene())) .filter(x -> x.germlineHet2HomRegions() == 0 && x.germlineHomRegions() == 0) .filter(qcStatusPredicate) .map(x -> ImmutableDriverCatalog.builder() .chromosome(x.chromosome()) .chromosomeBand(x.chromosomeBand()) .gene(x.gene()) .missense(0) .nonsense(0) .inframe(0) .frameshift(0) .splice(0) .dndsLikelihood(0) .driverLikelihood(1) .driver(DriverType.DEL) .likelihoodMethod(LikelihoodMethod.DEL) .category(oncoGenes.contains(x.gene()) ? DriverCategory.ONCO : DriverCategory.TSG) .biallelic(true) .minCopyNumber(x.minCopyNumber()) .maxCopyNumber(x.maxCopyNumber()) .build()) .collect(Collectors.toList()); } CNADrivers(Set<PurpleQCStatus> qcStatus, DriverGenePanel panel); static int deletedGenes(@NotNull final List<GeneCopyNumber> geneCopyNumbers); @NotNull List<DriverCatalog> amplifications(final double ploidy, @NotNull final List<GeneCopyNumber> geneCopyNumbers); @NotNull List<DriverCatalog> deletions(@NotNull final List<GeneCopyNumber> geneCopyNumbers);  }
@Test public void testDeletionsInGermlineAsStillReportable() { List<String> driverGenes = Lists.newArrayList(genePanel.deletionTargets()); GeneCopyNumber somatic = createTestCopyNumberBuilder(driverGenes.get(0)).germlineHet2HomRegions(0).germlineHomRegions(0).build(); GeneCopyNumber germline1 = createTestCopyNumberBuilder(driverGenes.get(1)).germlineHet2HomRegions(1).germlineHomRegions(0).build(); GeneCopyNumber germline2 = createTestCopyNumberBuilder(driverGenes.get(2)).germlineHet2HomRegions(0).germlineHomRegions(1).build(); List<DriverCatalog> drivers = new CNADrivers(Sets.newHashSet(PurpleQCStatus.PASS), genePanel).deletions(Lists.newArrayList(somatic, germline1, germline2)); assertEquals(1, drivers.size()); assertEquals(somatic.gene(), drivers.get(0).gene()); }
@Test public void testDelWithWarn() { String gene = Lists.newArrayList(genePanel.deletionTargets()).get(0); GeneCopyNumber longDelNoSupport = createTestCopyNumberBuilder(gene).gene(gene) .minRegionStart(1) .minRegionEnd(100_000_000) .minCopyNumber(0.01) .minRegionStartSupport(SegmentSupport.NONE) .minRegionEndSupport(SegmentSupport.NONE) .build(); GeneCopyNumber longDelStartSupport = ImmutableGeneCopyNumber.builder() .from(longDelNoSupport) .minRegionStartSupport(SegmentSupport.BND) .minRegionEndSupport(SegmentSupport.TELOMERE) .build(); GeneCopyNumber longDelEndSupport =ImmutableGeneCopyNumber.builder() .from(longDelNoSupport) .minRegionStartSupport(SegmentSupport.CENTROMERE) .minRegionStartSupport(SegmentSupport.BND) .build(); GeneCopyNumber shortDelStartSupport = ImmutableGeneCopyNumber.builder() .from(longDelNoSupport) .minRegionStartSupport(SegmentSupport.BND) .minRegionEndSupport(SegmentSupport.TELOMERE) .minRegionStart(1) .minRegionEnd(100) .build(); GeneCopyNumber shortDelEndSupport =ImmutableGeneCopyNumber.builder() .from(longDelNoSupport) .minRegionStartSupport(SegmentSupport.CENTROMERE) .minRegionEndSupport(SegmentSupport.BND) .minRegionStart(1) .minRegionEnd(100) .build(); GeneCopyNumber longDelBothSupport = ImmutableGeneCopyNumber.builder() .from(longDelNoSupport) .minRegionStartSupport(SegmentSupport.BND) .minRegionEndSupport(SegmentSupport.BND) .build(); Set<PurpleQCStatus> noWarn = Sets.newHashSet(); assertEquals(1, new CNADrivers(noWarn, genePanel).deletions(Collections.singletonList(longDelNoSupport)).size()); Set<PurpleQCStatus> warnDeletedGenes = Sets.newHashSet(PurpleQCStatus.WARN_DELETED_GENES); assertEquals(0, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(longDelNoSupport)).size()); assertEquals(0, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(longDelStartSupport)).size()); assertEquals(0, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(longDelEndSupport)).size()); assertEquals(1, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(shortDelStartSupport)).size()); assertEquals(1, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(shortDelEndSupport)).size()); assertEquals(1, new CNADrivers(warnDeletedGenes, genePanel).deletions(Collections.singletonList(longDelBothSupport)).size()); Set<PurpleQCStatus> warnCopyNumber = Sets.newHashSet(PurpleQCStatus.WARN_HIGH_COPY_NUMBER_NOISE); assertEquals(0, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(longDelNoSupport)).size()); assertEquals(0, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(longDelStartSupport)).size()); assertEquals(0, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(longDelEndSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(shortDelStartSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(shortDelEndSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).deletions(Collections.singletonList(longDelBothSupport)).size()); }