Search in sources :

Example 6 with StructuralVariant

use of com.hartwig.hmftools.common.variant.structural.StructuralVariant in project hmftools by hartwigmedical.

the class StructuralVariantImpliedTest method testSVSmoothing.

@Test
public void testSVSmoothing() {
    final StructuralVariant firstSV = sv(1001, 4001, StructuralVariantType.DEL, 0.25, 0.25);
    final StructuralVariant secondSV = sv(2001, 3001, StructuralVariantType.DEL, 1 / 3d, 1 / 3d);
    final CombinedRegion firstCN = copyNumber(1, 1000, 40, SegmentSupport.NONE);
    final CombinedRegion secondCN = copyNumber(1001, 2000, 0, SegmentSupport.DEL);
    final CombinedRegion thirdCN = copyNumber(2001, 3000, 0, SegmentSupport.NONE);
    final CombinedRegion forthCN = copyNumber(3001, 4000, 0, SegmentSupport.DEL);
    final CombinedRegion fifthCN = copyNumber(4001, 5000, 10, SegmentSupport.NONE);
    final List<StructuralVariant> svs = Lists.newArrayList(firstSV, secondSV);
    final ListMultimap<String, CombinedRegion> copyNumbers = copyNumbers(firstCN, secondCN, thirdCN, forthCN, fifthCN);
    final StructuralVariantImplied victim = new StructuralVariantImplied(PURE);
    final List<CombinedRegion> result = victim.svImpliedCopyNumber(svs, copyNumbers).get(CHROMOSOME);
    assertEquals(4, result.size());
    assertEquals(40.00, result.get(0).tumorCopyNumber(), EPSILON);
    assertEquals(33.75, result.get(1).tumorCopyNumber(), EPSILON);
    assertEquals(03.75, result.get(2).tumorCopyNumber(), EPSILON);
    assertEquals(10.00, result.get(3).tumorCopyNumber(), EPSILON);
}
Also used : StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 7 with StructuralVariant

use of com.hartwig.hmftools.common.variant.structural.StructuralVariant in project hmftools by hartwigmedical.

the class StructuralVariantLegsFactoryTest method testOpposingSign.

@Test
public void testOpposingSign() {
    final StructuralVariant first = sv(100, 200, StructuralVariantType.DEL, 0.25, 0.4);
    final StructuralVariant second = sv(200, 300, StructuralVariantType.BND, 0.25, 0.25);
    final List<StructuralVariant> variants = Lists.newArrayList(first, second);
    final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants);
    assertEquals(3, legs.size());
    assertTrue(legs.get(0).start().isPresent());
    assertLeg(1, 0.25, legs.get(0).start().get());
    assertFalse(legs.get(0).end().isPresent());
    assertFalse(legs.get(1).start().isPresent());
    assertTrue(legs.get(1).end().isPresent());
    assertLeg(1, 0.25, legs.get(1).end().get());
    assertTrue(legs.get(2).start().isPresent());
    assertLeg(-1, 0.15, legs.get(2).start().get());
    assertFalse(legs.get(2).end().isPresent());
}
Also used : StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 8 with StructuralVariant

use of com.hartwig.hmftools.common.variant.structural.StructuralVariant in project hmftools by hartwigmedical.

the class StructuralVariantLegsFactoryTest method testIgnoreInserts.

@Test
public void testIgnoreInserts() {
    final StructuralVariant first = sv(100, 200, StructuralVariantType.INS, 0.25, 0.25);
    final StructuralVariant second = sv(300, 400, StructuralVariantType.INS, 0.25, 0.25);
    final List<StructuralVariant> variants = Lists.newArrayList(first, second);
    final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants);
    assertEquals(0, legs.size());
}
Also used : StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 9 with StructuralVariant

use of com.hartwig.hmftools.common.variant.structural.StructuralVariant in project hmftools by hartwigmedical.

the class StructuralVariantLegsFactoryTest method testMaxPositive.

@Test
public void testMaxPositive() {
    final StructuralVariant first = sv(100, 200, StructuralVariantType.INV, 0.25, 0.25);
    final StructuralVariant second = sv(200, 300, StructuralVariantType.BND, 0.4, 0.25);
    final List<StructuralVariant> variants = Lists.newArrayList(first, second);
    final List<StructuralVariantLegs> legs = StructuralVariantLegsFactory.create(variants);
    assertEquals(2, legs.size());
    assertTrue(legs.get(0).start().isPresent());
    assertLeg(1, 0.25, legs.get(0).start().get());
    assertFalse(legs.get(0).end().isPresent());
    assertTrue(legs.get(1).start().isPresent());
    assertLeg(1, 0.4, legs.get(1).start().get());
    assertTrue(legs.get(1).end().isPresent());
    assertLeg(1, 0.25, legs.get(1).end().get());
}
Also used : StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) Test(org.junit.Test) PurpleDatamodelTest(com.hartwig.hmftools.common.purple.PurpleDatamodelTest)

Example 10 with StructuralVariant

use of com.hartwig.hmftools.common.variant.structural.StructuralVariant in project hmftools by hartwigmedical.

the class StructuralVariantLegsFactory method createLegs.

@NotNull
private static List<ModifiableStructuralVariantLegs> createLegs(boolean allowInserts, @NotNull final List<StructuralVariant> variants) {
    final List<ModifiableStructuralVariantLegs> result = Lists.newArrayList();
    for (StructuralVariant variant : variants) {
        if (allowInserts || variant.type() != StructuralVariantType.INS) {
            final Optional<StructuralVariantLeg> start = Optional.of(variant.start()).filter(x -> x.alleleFrequency() != null);
            final Optional<StructuralVariantLeg> end = Optional.of(variant.end()).filter(x -> x.alleleFrequency() != null);
            if (start.isPresent() || end.isPresent()) {
                final ModifiableStructuralVariantLegs legs = ModifiableStructuralVariantLegs.create().setStart(start).setEnd(end);
                result.add(legs);
            }
        }
    }
    return result;
}
Also used : StructuralVariantLeg(com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg) StructuralVariant(com.hartwig.hmftools.common.variant.structural.StructuralVariant) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StructuralVariant (com.hartwig.hmftools.common.variant.structural.StructuralVariant)15 PurpleDatamodelTest (com.hartwig.hmftools.common.purple.PurpleDatamodelTest)7 Test (org.junit.Test)7 IOException (java.io.IOException)4 Path (java.nio.file.Path)4 NotNull (org.jetbrains.annotations.NotNull)4 StructuralVariantLeg (com.hartwig.hmftools.common.variant.structural.StructuralVariantLeg)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 EnrichedStructuralVariant (com.hartwig.hmftools.common.variant.structural.EnrichedStructuralVariant)2 Optional (java.util.Optional)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)1 ListMultimap (com.google.common.collect.ListMultimap)1 Lists (com.google.common.collect.Lists)1 Multimap (com.google.common.collect.Multimap)1 ProductionRunContextFactory (com.hartwig.hmftools.common.context.ProductionRunContextFactory)1 RunContext (com.hartwig.hmftools.common.context.RunContext)1 CosmicFusionModel (com.hartwig.hmftools.common.cosmic.fusions.CosmicFusionModel)1 TumorLocationDoidMapping (com.hartwig.hmftools.common.ecrf.doid.TumorLocationDoidMapping)1