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);
}
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());
}
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());
}
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());
}
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;
}
Aggregations