use of com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg 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.variant.structural.StructuralVariantLeg in project hmftools by hartwigmedical.
the class StructuralVariantPloidyFactoryTest method testExcludeNegativeAndZeroCopyNumbers.
@Test
public void testExcludeNegativeAndZeroCopyNumbers() {
final StructuralVariantLeg positiveLeg = createLeg(1001, 1, 0.25);
final StructuralVariantLeg negativeLeg = createLeg(2001, -1, 0.25);
final PurpleCopyNumber left = copyNumber(1, 1000, -0.01);
final PurpleCopyNumber right = copyNumber(2001, 3000, 0);
assertFalse(PURE_PLOIDY_FACTORY.create(positiveLeg, GenomeRegionSelectorFactory.create(singleton(left))).isPresent());
assertFalse(PURE_PLOIDY_FACTORY.create(negativeLeg, GenomeRegionSelectorFactory.create(singleton(right))).isPresent());
}
use of com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg in project hmftools by hartwigmedical.
the class StructuralVariantPloidyFactoryTest method testSingleValidLeg.
@Test
public void testSingleValidLeg() {
final StructuralVariantLeg start = createLeg(1001, 1, 0.25);
final PurpleCopyNumber left = copyNumber(1, 1000, 4);
final PurpleCopyNumber middle = copyNumber(1001, 2000, 3);
final PurpleCopyNumber right = copyNumber(2001, 3000, 4);
final StructuralVariantLegs legs = ImmutableStructuralVariantLegs.builder().start(start).end(Optional.empty()).build();
final ListMultimap<String, PurpleCopyNumber> copyNumbers = copyNumbers(left, middle, right);
final List<StructuralVariantLegPloidy> ploidies = PURE_PLOIDY_FACTORY.create(legs, copyNumbers);
assertEquals(1, ploidies.size());
for (StructuralVariantLegPloidy ploidy : ploidies) {
assertEquals(1d, ploidy.averageImpliedPloidy(), EPSILON);
assertEquals(1d, ploidy.weight(), EPSILON);
}
}
Aggregations