From 962820224b5d49ef78eec02327a534f563ce1810 Mon Sep 17 00:00:00 2001 From: Daniel Cameron Date: Tue, 29 Aug 2017 17:04:46 +1000 Subject: [PATCH] Excluding single binversion-like breakpoints from minSize check as the event size is not known from just the single breakpoint --- pom.xml | 2 +- .../VariantContextDirectedBreakpoint.java | 23 ++++++++++++++++++- .../VariantContextDirectedBreakpointTest.java | 7 ++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 557c98756..3d4c76d6a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ au.edu.wehi gridss jar - 1.4.2 + 1.4.3 gridss https://github.com/PapenfussLab/gridss diff --git a/src/main/java/au/edu/wehi/idsv/VariantContextDirectedBreakpoint.java b/src/main/java/au/edu/wehi/idsv/VariantContextDirectedBreakpoint.java index d9080b090..5bce4cb62 100644 --- a/src/main/java/au/edu/wehi/idsv/VariantContextDirectedBreakpoint.java +++ b/src/main/java/au/edu/wehi/idsv/VariantContextDirectedBreakpoint.java @@ -24,17 +24,38 @@ public VariantContextDirectedBreakpoint(GenomicProcessingContext processContext, public Integer getEventSize() { BreakendSummary low = getBreakendSummary().lowBreakend(); BreakendSummary high = getBreakendSummary().highBreakend(); - if (low.referenceIndex != high.referenceIndex) return null; + if (low.referenceIndex != high.referenceIndex) { + return null; + } int sizeAdjustment = -1; // assume indel if (low.direction == high.direction) { // inversion sizeAdjustment = 0; + // requires a second breakpoint to explain - we're not going to assume this breakpoint exists + // as the event could be a large fold-back inversion + return null; } else if (low.direction == BreakendDirection.Backward && high.direction == BreakendDirection.Forward) { // tandem dup sizeAdjustment = 1; } return high.nominal - low.nominal + getUntemplatedSequence().length() + sizeAdjustment; } + /** + * Size of indel event. + * @return size of indel inferred by breakpoint, null otherwise + */ + public Integer getIndelSize() { + BreakendSummary low = getBreakendSummary().lowBreakend(); + BreakendSummary high = getBreakendSummary().highBreakend(); + if (low.direction == high.direction) { + // inversion + return null; + } else if (low.direction == BreakendDirection.Backward && high.direction == BreakendDirection.Forward) { + // tandem dup + return null; + } + return getEventSize(); + } @Override public BreakpointSummary getBreakendSummary() { return (BreakpointSummary)super.getBreakendSummary(); diff --git a/src/test/java/au/edu/wehi/idsv/VariantContextDirectedBreakpointTest.java b/src/test/java/au/edu/wehi/idsv/VariantContextDirectedBreakpointTest.java index f138fca50..719718a2b 100644 --- a/src/test/java/au/edu/wehi/idsv/VariantContextDirectedBreakpointTest.java +++ b/src/test/java/au/edu/wehi/idsv/VariantContextDirectedBreakpointTest.java @@ -77,9 +77,12 @@ public void getEventSize_INSDEL() { public void getEventSize_DUP() { assertEquals(4, (int)BP("dup", new BreakpointSummary(0, FWD, 10, 0, BWD, 7)).getEventSize()); } + /** + * inversion have two breakpoints - we don't know the event size unless we actually have both of them + */ @Test public void getEventSize_INV() { - assertEquals(4, (int)BP("inv", new BreakpointSummary(0, FWD, 6, 0, FWD, 10)).getEventSize()); - assertEquals(4, (int)BP("inv", new BreakpointSummary(0, BWD, 11, 0, BWD, 7)).getEventSize()); + assertEquals(null, BP("inv", new BreakpointSummary(0, FWD, 6, 0, FWD, 10)).getEventSize()); + assertEquals(null, BP("inv", new BreakpointSummary(0, BWD, 11, 0, BWD, 7)).getEventSize()); } }