Search in sources :

Example 11 with StructuralVariantLeg

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);
}
Also used : PurityAdjuster(com.hartwig.hmftools.common.purple.PurityAdjuster) StructuralVariantLeg(com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 12 with StructuralVariantLeg

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());
}
Also used : StructuralVariantLeg(com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 13 with StructuralVariantLeg

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);
    }
}
Also used : StructuralVariantLeg(com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg) PurpleCopyNumber(com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Aggregations

StructuralVariantLeg (com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg)13 PurpleDatamodelTest (com.hartwig.hmftools.common.purple.PurpleDatamodelTest)7 Test (org.junit.Test)7 PurpleCopyNumber (com.hartwig.hmftools.common.purple.copynumber.PurpleCopyNumber)6 NotNull (org.jetbrains.annotations.NotNull)5 StructuralVariant (com.hartwig.hmftools.common.variant.structural.StructuralVariant)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 Lists (com.google.common.collect.Lists)2 Multimap (com.google.common.collect.Multimap)2 Doubles (com.hartwig.hmftools.common.numeric.Doubles)2 GenomePosition (com.hartwig.hmftools.common.position.GenomePosition)2 GenomePositions (com.hartwig.hmftools.common.position.GenomePositions)2 PurityAdjuster (com.hartwig.hmftools.common.purple.PurityAdjuster)2 Collections (java.util.Collections)2 List (java.util.List)2 Optional (java.util.Optional)2 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)1 ListMultimap (com.google.common.collect.ListMultimap)1 GenomeRegion (com.hartwig.hmftools.common.region.GenomeRegion)1 GenomeRegionSelector (com.hartwig.hmftools.common.region.GenomeRegionSelector)1