CNADrivers { @NotNull public List<DriverCatalog> amplifications(final double ploidy, @NotNull final List<GeneCopyNumber> geneCopyNumbers) { Predicate<GeneCopyNumber> qcStatusPredicate = qcStatus.contains(PurpleQCStatus.WARN_HIGH_COPY_NUMBER_NOISE) ? CNADrivers::supportedByOneSV : x -> true; return geneCopyNumbers.stream() .filter(x -> x.minCopyNumber() / ploidy > MIN_COPY_NUMBER_RELATIVE_INCREASE) .filter(x -> oncoGenes.contains(x.gene()) | amplificationTargets.contains(x.gene())) .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.AMP) .likelihoodMethod(LikelihoodMethod.AMP) .category(tsGenes.contains(x.gene()) ? DriverCategory.TSG : DriverCategory.ONCO) .biallelic(false) .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 testAmpWithWarn() { String gene = Lists.newArrayList(genePanel.amplificationTargets()).get(0); GeneCopyNumber ampNoSupport = createTestCopyNumberBuilder(gene).gene(gene) .minCopyNumber(100) .minRegionStartSupport(SegmentSupport.NONE) .minRegionEndSupport(SegmentSupport.NONE) .build(); GeneCopyNumber ampStartSupport = ImmutableGeneCopyNumber.builder().from(ampNoSupport).minRegionStartSupport(SegmentSupport.BND).build(); GeneCopyNumber ampEndSupport = ImmutableGeneCopyNumber.builder().from(ampNoSupport).minRegionEndSupport(SegmentSupport.BND).build(); GeneCopyNumber ampBothSupport = ImmutableGeneCopyNumber.builder() .from(ampNoSupport) .minRegionStartSupport(SegmentSupport.BND) .minRegionEndSupport(SegmentSupport.BND) .build(); Set<PurpleQCStatus> warnDeletedGenes = Sets.newHashSet(PurpleQCStatus.WARN_DELETED_GENES); assertEquals(1, new CNADrivers(warnDeletedGenes, genePanel).amplifications(1, Collections.singletonList(ampNoSupport)).size()); Set<PurpleQCStatus> warnCopyNumber = Sets.newHashSet(PurpleQCStatus.WARN_HIGH_COPY_NUMBER_NOISE); assertEquals(0, new CNADrivers(warnCopyNumber, genePanel).amplifications(1, Collections.singletonList(ampNoSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).amplifications(1, Collections.singletonList(ampStartSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).amplifications(1, Collections.singletonList(ampEndSupport)).size()); assertEquals(1, new CNADrivers(warnCopyNumber, genePanel).amplifications(1, Collections.singletonList(ampBothSupport)).size()); }