diff --git a/src/main/java/au/edu/wehi/idsv/AssemblyAttributes.java b/src/main/java/au/edu/wehi/idsv/AssemblyAttributes.java index 53f42cb22..c8524cb79 100644 --- a/src/main/java/au/edu/wehi/idsv/AssemblyAttributes.java +++ b/src/main/java/au/edu/wehi/idsv/AssemblyAttributes.java @@ -45,12 +45,14 @@ public AssemblyAttributes(SingleReadEvidence record) { public static void adjustAssemblyAnnotationDueToContigChange(SAMRecord record, int startTruncatedBases) { int[] intervalStart = record.getSignedIntArrayAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START); int[] intervalEnd = record.getSignedIntArrayAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END); - for (int i = 0; i < intervalStart.length; i++) { - intervalStart[i] -= startTruncatedBases; - intervalEnd[i] -= startTruncatedBases; + if (intervalStart != null && intervalEnd != null) { + for (int i = 0; i < intervalStart.length; i++) { + intervalStart[i] -= startTruncatedBases; + intervalEnd[i] -= startTruncatedBases; + } + record.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START, intervalStart); + record.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END, intervalEnd); } - record.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START, intervalStart); - record.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END, intervalEnd); } /** diff --git a/src/main/java/au/edu/wehi/idsv/SingleReadEvidence.java b/src/main/java/au/edu/wehi/idsv/SingleReadEvidence.java index 9afc30e3b..e6d734d27 100644 --- a/src/main/java/au/edu/wehi/idsv/SingleReadEvidence.java +++ b/src/main/java/au/edu/wehi/idsv/SingleReadEvidence.java @@ -412,23 +412,27 @@ public Range getBreakendAssemblyContigBreakpointInterval() { return Range.closed(rl - anchorBases, rl - anchorBases); } } - // Variant has either inserted sequence or homology - Range r; - int insertLength = getUntemplatedSequence().length(); - if (insertLength > 0) { - if ((location.direction == BreakendDirection.Forward && !record.getReadNegativeStrandFlag()) | - (location.direction == BreakendDirection.Backward && record.getReadNegativeStrandFlag())) { - r = Range.closed(nominalBreakendAfterReadOffset, nominalBreakendAfterReadOffset + insertLength); - } else { - r = Range.closed(nominalBreakendAfterReadOffset - insertLength, nominalBreakendAfterReadOffset); - } - } else { - if (!record.getReadNegativeStrandFlag()) { - r = Range.closed(nominalBreakendAfterReadOffset + (location.start - location.nominal), nominalBreakendAfterReadOffset + (location.end - location.nominal)); - } else { - r = Range.closed(nominalBreakendAfterReadOffset - (location.end - location.nominal), nominalBreakendAfterReadOffset - (location.start - location.nominal)); - } - } + Range r; + if (location instanceof BreakpointSummary) { + // Variant has either inserted sequence or homology + int insertLength = getUntemplatedSequence().length(); + if (insertLength > 0) { + if ((location.direction == BreakendDirection.Forward && !record.getReadNegativeStrandFlag()) | + (location.direction == BreakendDirection.Backward && record.getReadNegativeStrandFlag())) { + r = Range.closed(nominalBreakendAfterReadOffset, nominalBreakendAfterReadOffset + insertLength); + } else { + r = Range.closed(nominalBreakendAfterReadOffset - insertLength, nominalBreakendAfterReadOffset); + } + } else { + if (!record.getReadNegativeStrandFlag()) { + r = Range.closed(nominalBreakendAfterReadOffset + (location.start - location.nominal), nominalBreakendAfterReadOffset + (location.end - location.nominal)); + } else { + r = Range.closed(nominalBreakendAfterReadOffset - (location.end - location.nominal), nominalBreakendAfterReadOffset - (location.start - location.nominal)); + } + } + } else { + r = Range.closed(nominalBreakendAfterReadOffset, nominalBreakendAfterReadOffset); + } return r; } public int getBreakendAssemblyContigOffset() { diff --git a/src/main/java/au/edu/wehi/idsv/StructuralVariationCallBuilder.java b/src/main/java/au/edu/wehi/idsv/StructuralVariationCallBuilder.java index 9ac30d040..8aa58e9b7 100644 --- a/src/main/java/au/edu/wehi/idsv/StructuralVariationCallBuilder.java +++ b/src/main/java/au/edu/wehi/idsv/StructuralVariationCallBuilder.java @@ -435,8 +435,10 @@ private double[] prorataAssemblyQualBreakdown( breakdownQual[i] = aa.getSupportingQualScore(offset, ImmutableSet.of(i), null); } double breakdownTotal = DoubleStream.of(breakdownQual).sum(); - for (int i = 0; i < prorata.length; i++) { - prorata[i] += assQual * (breakdownQual[i] / breakdownTotal); + if (breakdownTotal != 0) { // defensive check to mitigate impact of 0 qual assemblies (#156) + for (int i = 0; i < prorata.length; i++) { + prorata[i] += assQual * (breakdownQual[i] / breakdownTotal); + } } totalAssQual += assQual; } diff --git a/src/test/java/au/edu/wehi/idsv/AssemblyFactoryTest.java b/src/test/java/au/edu/wehi/idsv/AssemblyFactoryTest.java index 79396752f..8733e7eb1 100644 --- a/src/test/java/au/edu/wehi/idsv/AssemblyFactoryTest.java +++ b/src/test/java/au/edu/wehi/idsv/AssemblyFactoryTest.java @@ -430,7 +430,7 @@ public void getQual_should_be_sum_of_evidence() { support.add(NRRP(tes, DP(0, 1, "2M", true, 0, 15, "5M", false))); support.add(NRRP(tes, DP(0, 2, "2M", true, 0, 16, "5M", false))); support.add(NRRP(nes, DP(0, 3, "2M", true, 0, 17, "10M", false))); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, null, 0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, fullSupport(support), 0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); SoftClipEvidence asse = SoftClipEvidence.create(AES(), BWD, ass); double[] supportQual = support.stream().mapToDouble(e -> e.getBreakendQual()).toArray(); diff --git a/src/test/java/au/edu/wehi/idsv/SingleReadEvidenceTest.java b/src/test/java/au/edu/wehi/idsv/SingleReadEvidenceTest.java index 2ba26c0de..e37555676 100644 --- a/src/test/java/au/edu/wehi/idsv/SingleReadEvidenceTest.java +++ b/src/test/java/au/edu/wehi/idsv/SingleReadEvidenceTest.java @@ -220,19 +220,34 @@ public void strandBias_should_match_read_strand() { } @Test public void getBreakendReadOffsetInterval_should_consider_mapping_strand() { - Range r = SingleReadEvidence.createEvidence(SES(), 0, Read(0, 1, "2M3S")).get(0).getBreakendAssemblyContigBreakpointInterval(); + Range r = SingleReadEvidence.createEvidence(SES(), 0, withSequence("NNNNN", Read(0, 1, "2M3S"))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); // 01234 // MMSSS assertEquals(2, (int)r.lowerEndpoint()); assertEquals(2, (int)r.upperEndpoint()); - r = SingleReadEvidence.createEvidence(SES(), 0, onNegative(Read(0, 1, "1M4S"))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); + r = SingleReadEvidence.createEvidence(SES(), 0, withSequence("NNNNN", onNegative(Read(0, 1, "1M4S")))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); // 43210 // MSSSS assertEquals(4, (int)r.lowerEndpoint()); assertEquals(4, (int)r.upperEndpoint()); } @Test + public void getBreakendReadOffsetInterval_should_untemplated_inserted_Sequence() { + Range r = SingleReadEvidence.createEvidence(SES(), 0, withAttr("SA", "polyA,10,+,3S2M,20,0", withSequence("NNNNN", Read(0, 1, "2M3S")))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); + // 01234 + // MMSSS + assertEquals(2, (int)r.lowerEndpoint()); + assertEquals(3, (int)r.upperEndpoint()); + + r = SingleReadEvidence.createEvidence(SES(), 0, withAttr("SA", "polyA,10,+,2M3S,20,0", withSequence("NNNNN", onNegative(Read(0, 1, "1M4S"))))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); + // 43210 + // MSSSS + // SSSMM + assertEquals(2, (int)r.lowerEndpoint()); + assertEquals(4, (int)r.upperEndpoint()); + } + @Test public void getBreakendReadOffsetInterval_should_consider_homology() { Range r = SingleReadEvidence.createEvidence(SES(), 0, withAttr("SA", "polyA,10,+,2S3M,20,0", withSequence("NAAANN", Read(0, 1, "2M4S")))[0]).get(0).getBreakendAssemblyContigBreakpointInterval(); // 01234 diff --git a/src/test/java/au/edu/wehi/idsv/SplitReadEvidenceTest.java b/src/test/java/au/edu/wehi/idsv/SplitReadEvidenceTest.java index 2c92a272f..57a371e18 100644 --- a/src/test/java/au/edu/wehi/idsv/SplitReadEvidenceTest.java +++ b/src/test/java/au/edu/wehi/idsv/SplitReadEvidenceTest.java @@ -404,8 +404,8 @@ public void should_handle_multiple_overlapping_fragments() { Assert.assertEquals(e3.get(0).getEvidenceID(), e2.get(1).getRemoteEvidenceID()); } @Test - public void should_pro_rata_assembly_support() { - SAMRecord primary = withSequence("NNNN", Read(1, 200, "1M3S"))[0]; + public void untemplated_inserted_sequence_should_report_max_over_interval() { + SAMRecord primary = withSequence("NNNNNN", Read(1, 200, "1M5S"))[0]; primary.setMappingQuality(100); SAMRecord r = Read(1, 100, "2M4S"); r.setMappingQuality(100); @@ -415,14 +415,37 @@ public void should_pro_rata_assembly_support() { r.setAttribute(SamTags.ASSEMBLY_DIRECTION, "f"); r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_TYPE, new byte[] { 0, 1, 1}); r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_CATEGORY, new int[] { 0, 0, 1}); - r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START, new int[] { 3, 2, 3}); - r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END, new int[] { 4, 3, 5}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START, new int[] { 0, 2, 3}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END, new int[] { 6, 3, 5}); r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_QUAL, new float[] { 10, 20, 5}); r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_EVIDENCEID, "1 2 3"); r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_FRAGMENTID, "1 2 3"); AssemblyEvidenceSource aes = new MockAssemblyEvidenceSource(getContext(), ImmutableList.of(SES(0), SES(1)), new File("test.bam")); SplitReadEvidence e = SplitReadEvidence.create(aes, r).get(0); - Assert.assertEquals(15, e.getBreakpointQual(), 0); + // 0 1 2 3 4 5 6 + // M S S S primary + // S S S S M M realigned + Assert.assertEquals(10, e.getBreakpointQual(), 0); + } + @Test + public void homology_should_report_min_over_interval() { + SAMRecord primary = withSequence("NAAAAN", Read(1, 200, "1M5S"))[0]; + primary.setMappingQuality(100); + SAMRecord r = withSequence("NAAAAN", Read(1, 300, "1S5M"))[0]; + r.setMappingQuality(100); + r.setAttribute("SA", new ChimericAlignment(primary).toString()); + r.setAttribute(SamTags.IS_ASSEMBLY, 1); + r.setAttribute(SamTags.ASSEMBLY_DIRECTION, "f"); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_TYPE, new byte[] { 0, 1, 1}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_CATEGORY, new int[] { 0, 0, 1}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_START, new int[] { 3, 2, 3}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_OFFSET_END, new int[] { 4, 3, 5}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_QUAL, new float[] { 10, 20, 5}); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_EVIDENCEID, "1 2 3"); + r.setAttribute(SamTags.ASSEMBLY_EVIDENCE_FRAGMENTID, "1 2 3"); + AssemblyEvidenceSource aes = new MockAssemblyEvidenceSource(getContext(), ImmutableList.of(SES(0), SES(1)), new File("test.bam")); + SplitReadEvidence e = SplitReadEvidence.create(aes, r).get(0); + Assert.assertEquals(0, e.getBreakpointQual(), 0); } @Test public void FWD_unanchored_assembly_should_pro_rata_support_to_start_of_contig() { diff --git a/src/test/java/au/edu/wehi/idsv/StructuralVariationCallBuilderTest.java b/src/test/java/au/edu/wehi/idsv/StructuralVariationCallBuilderTest.java index 6df802aec..16b359836 100644 --- a/src/test/java/au/edu/wehi/idsv/StructuralVariationCallBuilderTest.java +++ b/src/test/java/au/edu/wehi/idsv/StructuralVariationCallBuilderTest.java @@ -199,19 +199,19 @@ public VariantContextDirectedBreakpoint complex_bp() { cb.addEvidence(new dp(2, true)); List support = Lists.newArrayList(new rsc(5, false)); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(incorporateRealignment(AES(), ass, ImmutableList.of(withMapq(44, onNegative(Read(BP.referenceIndex2, BP.start2, "1M")))[0]))); support = Lists.newArrayList(new um(6, true)); - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm2"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm2"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(asAssemblyEvidence(ass)); support = Lists.newArrayList(new rsc(6, false)); - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm3"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TA"), B("TA")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm3"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TA"), B("TA")); cb.addEvidence(incorporateRealignment(aes, ass, ImmutableList.of(withMapq(1, onNegative(Read(BP.referenceIndex2, BP.start2, "1M")))[0]))); support = Lists.newArrayList(new sc(4, false)); - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm4"), BP.direction, support, null, BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm4"), BP.direction, support, fullSupport(support),BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); SAMRecord remote = withMapq(44, onNegative(Read(BP.referenceIndex, BP.start, "1M")))[0]; incorporateRealignment(aes, ass, ImmutableList.of(remote)); cb.addEvidence(asAssemblyEvidence(remote)); @@ -288,7 +288,7 @@ public void should_set_VcfAttribute_BREAKPOINT_ASSEMBLY_READPAIR_COUNT() { List support = Lists.newArrayList( new dp(2, true), new dp(4, true).asRemote()); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support), BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(incorporateRealignment(AES(), ass, ImmutableList.of(withMapq(44, onNegative(Read(BP.referenceIndex2, BP.start2, "1M")))[0]))); support = Lists.newArrayList( @@ -296,7 +296,7 @@ public void should_set_VcfAttribute_BREAKPOINT_ASSEMBLY_READPAIR_COUNT() { new dp(3, false), new dp(5, true), new dp(6, true)); - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support), BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); SAMRecord remote = withMapq(44, onNegative(Read(BP.referenceIndex, BP.start, "1M")))[0]; incorporateRealignment(aes, ass, ImmutableList.of(remote)); cb.addEvidence(asAssemblyEvidence(remote)); @@ -319,14 +319,14 @@ public void should_set_VcfAttribute_BREAKPOINT_ASSEMBLY_READ_COUNT() { List support = Lists.newArrayList( new rsc(4, true)); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support), BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(incorporateRealignment(AES(), ass, ImmutableList.of(withMapq(44, onNegative(Read(BP.referenceIndex2, BP.start2, "1M")))[0]))); support = Lists.newArrayList( new rsc(3, false), new rsc(7, false), // not supporting new rsc(8, false)); // not supporting - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support,null, BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support), BP.referenceIndex2, BP.end2, 1, B("TT"), B("TT")); SAMRecord remote = withMapq(44, onNegative(Read(BP.referenceIndex, BP.start, "1M")))[0]; incorporateRealignment(aes, ass, ImmutableList.of(remote)); cb.addEvidence(asAssemblyEvidence(remote)); @@ -349,7 +349,7 @@ public void should_exclude_breakpoint_evidence_contributing_to_breakend_assembly StructuralVariationCallBuilder cb = new StructuralVariationCallBuilder(getContext(), (VariantContextDirectedEvidence)minimalBreakend() .breakpoint(BP, "GT").make()); List support = Lists.newArrayList(new rsc_not_supporting_breakpoint(1, true)); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(getContext(), AES(), new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(getContext(), AES(), new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support), BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(asAssemblyEvidence(ass)); VariantContextDirectedBreakpoint call = (VariantContextDirectedBreakpoint)cb.make(); Assert.assertEquals(0, call.getAttribute(VcfInfoAttributes.BREAKPOINT_SPLITREAD_COUNT.attribute())); @@ -421,7 +421,7 @@ public SoftClipEvidence ass1() { support.add(NRRP(tes, DP(0, 1, "2M", true, 0, 15, "5M", false))); support.add(NRRP(tes, DP(0, 2, "2M", true, 0, 16, "5M", false))); support.add(NRRP(nes, DP(0, 3, "2M", true, 0, 17, "10M", false))); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, null, 0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, fullSupport(support),0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); return (SoftClipEvidence)asAssemblyEvidence(ass); } public SplitReadEvidence ass2() { @@ -439,7 +439,7 @@ public SplitReadEvidence ass2() { support.add(NRRP(tes, DP(0, 1, "2M", true, 0, 15, "5M", false))); support.add(NRRP(tes, DP(0, 2, "2M", true, 0, 16, "5M", false))); support.add(NRRP(nes, DP(0, 3, "2M", true, 0, 17, "10M", false))); - SAMRecord e = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, null, 0, 10, 5, B("GGTAAAAC"), new byte[] { 7,6,5,4,3,2,1,0}); + SAMRecord e = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, fullSupport(support),0, 10, 5, B("GGTAAAAC"), new byte[] { 7,6,5,4,3,2,1,0}); SAMRecord ra = Read(1, 102, "1S1M1S"); ra.setReadBases(B("GGT")); ra.setMappingQuality(45); @@ -497,7 +497,7 @@ public void should_call_somatic_from_assembly_evidence() { support.add(NRRP(tes, OEA(0, 17, "5M", false))); support.add(NRRP(tes, DP(0, 10, "2M", false, 1, 100, "5M", false))); support.add(NRRP(tes, DP(0, 10, "2M", false, 1, 101, "5M", false))); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, null, 0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, AES(), new SequentialIdGenerator("asm"), BWD, support, fullSupport(support),0, 10, 5, B("CGTAAAAT"), new byte[] { 0,1,2,3,4,5,6,7}); support.add(asAssemblyEvidence(ass)); VariantContextDirectedEvidence e = (VariantContextDirectedEvidence)cb(support.toArray(new DirectedEvidence[0])) .referenceReads(new int[] { 10, 10 }) @@ -875,7 +875,7 @@ public void compound_assembly_not_originating_from_either_breakend_should_be_ann StructuralVariationCallBuilder cb = new StructuralVariationCallBuilder(pc, (VariantContextDirectedEvidence)minimalBreakend() .breakpoint(new BreakpointSummary(0, FWD, 10, 0, BWD, 20), "GT").make()); List support = Lists.newArrayList(new rsc(5, false)); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), FWD, support, null, 1, 1, 1, B("NNN"), B("AAA")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), FWD, support, fullSupport(support),1, 1, 1, B("NNN"), B("AAA")); ass.setMappingQuality(44); SAMRecord r1 = withMapq(44, Read(0, 10, "1M1S"))[0]; SAMRecord r2 = withMapq(44, Read(0, 20, "1S1M"))[0]; @@ -941,7 +941,7 @@ public void should_set_VcfAttribute_BREAKEND_ASSEMBLY_READPAIR_COUNT() { List support = Lists.newArrayList( new dp(2, true), new dp(4, true).asRemote()); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(asAssemblyEvidence(ass)); VariantContextDirectedEvidence bp = cb.make(); @@ -960,11 +960,11 @@ public void should_count_unique_supporting_fragments() { cb.addEvidence(new um(0, false)); List support = Lists.newArrayList(new rsc(1, true)); - SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + SAMRecord ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(incorporateRealignment(AES(), ass, ImmutableList.of(withMapq(44, onNegative(Read(BP.referenceIndex2, BP.start2, "1M")))[0]))); support = Lists.newArrayList(new rsc(1, true), new um(0, false)); - ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm2"), BP.direction, support, null, BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); + ass = AssemblyFactory.createAnchoredBreakend(pc, aes, new SequentialIdGenerator("asm2"), BP.direction, support, fullSupport(support),BP.referenceIndex, BP.end, 1, B("TT"), B("TT")); cb.addEvidence(asAssemblyEvidence(ass)); VariantContextDirectedEvidence bp = cb.make(); diff --git a/src/test/java/au/edu/wehi/idsv/TestHelper.java b/src/test/java/au/edu/wehi/idsv/TestHelper.java index ad0656881..36b6e023f 100644 --- a/src/test/java/au/edu/wehi/idsv/TestHelper.java +++ b/src/test/java/au/edu/wehi/idsv/TestHelper.java @@ -22,16 +22,12 @@ import java.util.stream.StreamSupport; import au.edu.wehi.idsv.sam.SamTags; +import com.google.common.collect.*; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.lang3.StringUtils; import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.google.common.collect.Iterators; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import au.edu.wehi.idsv.configuration.GridssConfiguration; import au.edu.wehi.idsv.debruijn.DeBruijnGraph; @@ -1274,4 +1270,9 @@ public static SingleReadEvidence incorporateRealignment(SAMEvidenceSource aes, S public static SingleReadEvidence incorporateRealignment(SAMEvidenceSource aes, SAMRecord assembly, SAMRecord... realignments) { return incorporateRealignment(aes, assembly, Lists.newArrayList(realignments)); } + public static List fullSupport(Collection support) { + return support.stream() + .map(e -> new AssemblyEvidenceSupport(e, Range.closed(-100000, 100000))) + .collect(Collectors.toList()); + } }