use of com.hartwig.hmftools.common.purple.PurityAdjuster in project hmftools by hartwigmedical.
the class LoadStructuralVariants method enrichStructuralVariants.
@NotNull
private static List<EnrichedStructuralVariant> enrichStructuralVariants(@NotNull List<StructuralVariant> variants, @NotNull DatabaseAccess dbAccess, @NotNull String tumorSample) {
final PurityContext purityContext = dbAccess.readPurityContext(tumorSample);
if (purityContext == null) {
LOGGER.warn("Unable to retrieve purple data. Enrichment may be incomplete.");
}
final PurityAdjuster purityAdjuster = purityContext == null ? new PurityAdjuster(Gender.FEMALE, 1, 1) : new PurityAdjuster(purityContext.gender(), purityContext.bestFit().purity(), purityContext.bestFit().normFactor());
final List<PurpleCopyNumber> copyNumberList = dbAccess.readCopynumbers(tumorSample);
final Multimap<String, PurpleCopyNumber> copyNumbers = Multimaps.index(copyNumberList, PurpleCopyNumber::chromosome);
return EnrichedStructuralVariantFactory.enrich(variants, purityAdjuster, copyNumbers);
}
use of com.hartwig.hmftools.common.purple.PurityAdjuster in project hmftools by hartwigmedical.
the class StructuralVariantPloidyFactoryTest method testPurityAdjustedPloidy.
@Test
public void testPurityAdjustedPloidy() {
final StructuralVariantLeg leg = createLeg(1001, 1, 0.5);
final List<PurpleCopyNumber> copyNumbers = Lists.newArrayList(copyNumber(1, 1000, 2), copyNumber(1001, 200, 1));
Optional<ModifiableStructuralVariantLegPloidy> purePloidy = PURE_PLOIDY_FACTORY.create(leg, GenomeRegionSelectorFactory.create(copyNumbers));
assertPloidy(1d, purePloidy);
final PurityAdjuster diluted = new PurityAdjuster(Gender.FEMALE, 0.8, 1);
final StructuralVariantLegPloidyFactory<PurpleCopyNumber> dilutedFactory = new StructuralVariantLegPloidyFactory<>(diluted, PurpleCopyNumber::averageTumorCopyNumber);
Optional<ModifiableStructuralVariantLegPloidy> dilutedPloidy = dilutedFactory.create(leg, GenomeRegionSelectorFactory.create(copyNumbers));
assertPloidy(1.25d, dilutedPloidy);
final PurityAdjuster male = new PurityAdjuster(Gender.MALE, 0.8, 1);
final StructuralVariantLegPloidyFactory<PurpleCopyNumber> maleFactory = new StructuralVariantLegPloidyFactory<>(male, PurpleCopyNumber::averageTumorCopyNumber);
Optional<ModifiableStructuralVariantLegPloidy> malePloidy = maleFactory.create(leg, GenomeRegionSelectorFactory.create(copyNumbers));
assertPloidy(1.125d, malePloidy);
}
use of com.hartwig.hmftools.common.purple.PurityAdjuster in project hmftools by hartwigmedical.
the class ClonalityTest method testClonality.
@Test
public void testClonality() {
final String chromosome = "1";
final PurityAdjuster purityAdjuster = new PurityAdjuster(Gender.FEMALE, 0.3, 1);
assertEquals(Clonality.SUBCLONAL, Clonality.fromSample(purityAdjuster, chromosome, 3, create(4, 100)));
assertEquals(Clonality.CLONAL, Clonality.fromSample(purityAdjuster, chromosome, 3, create(5, 100)));
assertEquals(Clonality.CLONAL, Clonality.fromSample(purityAdjuster, chromosome, 3, create(60, 100)));
assertEquals(Clonality.INCONSISTENT, Clonality.fromSample(purityAdjuster, chromosome, 3, create(61, 100)));
}
Aggregations