Search in sources :

Example 6 with BreakendSummary

use of au.edu.wehi.idsv.BreakendSummary in project gridss by PapenfussLab.

the class ModelsTest method calculateBreakend_should_return_overlap_for_multiple_evidence.

@Test
public void calculateBreakend_should_return_overlap_for_multiple_evidence() {
    BreakendSummary bs = Models.calculateBreakend(getContext().getLinear(), Lists.newArrayList(new MockDirectedBreakpoint(new BreakpointSummary(0, FWD, 1, 1, 4, 1, BWD, 2, 2, 2)), new MockDirectedEvidence(new BreakendSummary(0, FWD, 3, 3, 5))));
    assertEquals(new BreakendSummary(0, FWD, 3, 3, 4), bs);
}
Also used : MockDirectedEvidence(au.edu.wehi.idsv.MockDirectedEvidence) BreakendSummary(au.edu.wehi.idsv.BreakendSummary) MockDirectedBreakpoint(au.edu.wehi.idsv.MockDirectedBreakpoint) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 7 with BreakendSummary

use of au.edu.wehi.idsv.BreakendSummary in project gridss by PapenfussLab.

the class ModelsTest method calculateBreakend_should_return_breakend.

@Test
public void calculateBreakend_should_return_breakend() {
    BreakendSummary bs = Models.calculateBreakend(getContext().getLinear(), Lists.newArrayList(new MockDirectedBreakpoint(new BreakpointSummary(0, FWD, 1, 1, 2, 1, BWD, 2, 2, 2))));
    assertEquals(new BreakendSummary(0, FWD, 1, 1, 2), bs);
    assertEquals(BreakendSummary.class, bs.getClass());
}
Also used : BreakendSummary(au.edu.wehi.idsv.BreakendSummary) MockDirectedBreakpoint(au.edu.wehi.idsv.MockDirectedBreakpoint) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 8 with BreakendSummary

use of au.edu.wehi.idsv.BreakendSummary in project gridss by PapenfussLab.

the class ModelsTest method calculateBreakend_should_return_interval_for_single_evidence.

@Test
public void calculateBreakend_should_return_interval_for_single_evidence() {
    BreakendSummary bs = Models.calculateBreakend(getContext().getLinear(), Lists.newArrayList(new MockDirectedBreakpoint(new BreakpointSummary(0, FWD, 1, 1, 2, 1, BWD, 2, 2, 2))));
    assertEquals(new BreakendSummary(0, FWD, 1, 1, 2), bs);
}
Also used : BreakendSummary(au.edu.wehi.idsv.BreakendSummary) MockDirectedBreakpoint(au.edu.wehi.idsv.MockDirectedBreakpoint) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 9 with BreakendSummary

use of au.edu.wehi.idsv.BreakendSummary in project gridss by PapenfussLab.

the class ModelsTest method calculateBreakend_should_ignore_overlaps_resulting_in_no_breakend.

@Test
public void calculateBreakend_should_ignore_overlaps_resulting_in_no_breakend() {
    BreakendSummary bs = Models.calculateBreakend(getContext().getLinear(), Lists.newArrayList(new MockDirectedBreakpoint(new BreakpointSummary(0, FWD, 1, 1, 4, 1, BWD, 2, 2, 2)), new MockDirectedEvidence(new BreakendSummary(0, FWD, 3, 3, 5)), new MockDirectedEvidence(new BreakendSummary(0, FWD, 5, 5, 5))));
    assertEquals(new BreakendSummary(0, FWD, 3, 3, 4), bs);
}
Also used : MockDirectedEvidence(au.edu.wehi.idsv.MockDirectedEvidence) BreakendSummary(au.edu.wehi.idsv.BreakendSummary) MockDirectedBreakpoint(au.edu.wehi.idsv.MockDirectedBreakpoint) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 10 with BreakendSummary

use of au.edu.wehi.idsv.BreakendSummary in project gridss by PapenfussLab.

the class TruthAnnotator method annotate.

public VariantContextDirectedEvidence annotate(VariantContextDirectedEvidence variant) {
    BreakendSummary variantBreakend = variant.getBreakendSummary();
    BreakpointSummary variantBreakpoint = null;
    if (variantBreakend instanceof BreakpointSummary) {
        variantBreakpoint = (BreakpointSummary) variantBreakend;
        variantBreakend = variantBreakpoint.localBreakend();
    }
    HashSet<String> breakpointHits = Sets.newHashSet();
    HashSet<String> breakendHits = Sets.newHashSet();
    for (IdsvVariantContext truthVariant : truth) {
        if ((truthVariant.hasAttribute(VcfSvConstants.SV_TYPE_KEY) && truthVariant.getAttributeAsString(VcfSvConstants.SV_TYPE_KEY, "").equals("INS")) || (truthVariant.hasAttribute(VcfSvConstants.SV_TYPE_KEY) && truthVariant.getAttributeAsString(VcfSvConstants.SV_TYPE_KEY, "").equals("DEL"))) {
            int svLen = truthVariant.getAttributeAsInt(VcfSvConstants.SV_LENGTH_KEY, 0);
            int untemplatedSequence = 0;
            if (variant instanceof VariantContextDirectedEvidence) {
                untemplatedSequence = ((VariantContextDirectedEvidence) variant).getBreakendSequence().length;
            }
            // two breakpoints: forward & backward
            BreakendSummary truthBreakendStart = new BreakendSummary(truthVariant.getReferenceIndex(), BreakendDirection.Forward, truthVariant.getStart());
            int endOffset = Math.max(0, -truthVariant.getAttributeAsInt(VcfSvConstants.SV_LENGTH_KEY, 0));
            endOffset = truthVariant.getStart() + endOffset + 1;
            BreakendSummary truthBreakendEnd = new BreakendSummary(truthVariant.getReferenceIndex(), BreakendDirection.Backward, endOffset);
            BreakpointSummary truthBreakpoint = new BreakpointSummary(truthBreakendStart, truthBreakendEnd);
            if (matches(truthBreakpoint, variantBreakpoint, svLen, untemplatedSequence)) {
                breakpointHits.add(truthVariant.getID());
            } else if (matches(truthBreakpoint, variantBreakend, svLen, untemplatedSequence)) {
                breakendHits.add(truthVariant.getID());
            }
        } else {
            throw new RuntimeException(String.format("Matching of truth variant at %s:%d not yet implemented.", truthVariant.getContig(), truthVariant.getStart()));
        }
    }
    if (!breakpointHits.isEmpty() || !breakendHits.isEmpty()) {
        IdsvVariantContextBuilder builder = new IdsvVariantContextBuilder(processContext, variant);
        builder.attribute("TRUTH_MATCHES", Lists.newArrayList(breakpointHits));
        builder.attribute("TRUTH_MISREALIGN", Lists.newArrayList(breakendHits));
        return (VariantContextDirectedEvidence) builder.make();
    }
    return variant;
}
Also used : IdsvVariantContextBuilder(au.edu.wehi.idsv.IdsvVariantContextBuilder) VariantContextDirectedEvidence(au.edu.wehi.idsv.VariantContextDirectedEvidence) BreakendSummary(au.edu.wehi.idsv.BreakendSummary) IdsvVariantContext(au.edu.wehi.idsv.IdsvVariantContext) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary)

Aggregations

BreakendSummary (au.edu.wehi.idsv.BreakendSummary)19 Test (org.junit.Test)13 BreakpointSummary (au.edu.wehi.idsv.BreakpointSummary)10 MockDirectedEvidence (au.edu.wehi.idsv.MockDirectedEvidence)5 MockDirectedBreakpoint (au.edu.wehi.idsv.MockDirectedBreakpoint)4 ArrayList (java.util.ArrayList)4 AssemblyEvidenceSource (au.edu.wehi.idsv.AssemblyEvidenceSource)3 BreakendDirection (au.edu.wehi.idsv.BreakendDirection)3 DirectedEvidence (au.edu.wehi.idsv.DirectedEvidence)3 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)2 SequentialIdGenerator (au.edu.wehi.idsv.SequentialIdGenerator)2 SingleReadEvidence (au.edu.wehi.idsv.SingleReadEvidence)2 Node (au.edu.wehi.idsv.graph.MaximumCliqueIntervalGraph.Node)2 AssemblyFactory (au.edu.wehi.idsv.AssemblyFactory)1 AssemblyIdGenerator (au.edu.wehi.idsv.AssemblyIdGenerator)1 Defaults (au.edu.wehi.idsv.Defaults)1 IdsvVariantContext (au.edu.wehi.idsv.IdsvVariantContext)1 IdsvVariantContextBuilder (au.edu.wehi.idsv.IdsvVariantContextBuilder)1 SanityCheckFailureException (au.edu.wehi.idsv.SanityCheckFailureException)1 VariantContextDirectedEvidence (au.edu.wehi.idsv.VariantContextDirectedEvidence)1