Search in sources :

Example 6 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_call_simple_fwd_RP.

@Test
public void should_call_simple_fwd_RP() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    SAMEvidenceSource ses = SES(100, 200);
    DiscordantReadPair e = (DiscordantReadPair) NRRP(ses, withSequence("ACGTGGTCGACC", DP(0, 50, "12M", true, 1, 1, "12M", false)));
    List<SAMRecord> output = go(pc, true, e);
    assertEquals(1, output.size());
    SoftClipEvidence ass = SoftClipEvidence.create(AES(ses), FWD, output.get(0));
    assertEquals(e.getBreakendSummary().localBreakend(), ass.getBreakendSummary());
    assertEquals("ACGTGGTCGACC", S(ass.getBreakendSequence()));
    assertEquals("", S(ass.getAnchorSequence()));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) SAMRecord(htsjdk.samtools.SAMRecord) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) Test(org.junit.Test)

Example 7 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_call_suboptimal_contigs_if_graph_size_limit_exceeded.

@Test
public void should_call_suboptimal_contigs_if_graph_size_limit_exceeded() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(10, 10);
    pc.getAssemblyParameters().k = 4;
    pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 1;
    pc.getAssemblyParameters().positional.retainWidthMultiple = 1;
    pc.getAssemblyParameters().positional.flushWidthMultiple = 2;
    List<DirectedEvidence> e = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < i + 1; j++) {
            e.add(SCE(FWD, ses, withReadName(String.format("%d-%d", i, j), withSequence("AACCGGTT", Read(0, i, "4M4S")))[0]));
        }
    }
    List<SAMRecord> output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    assertEquals(100, output.size());
    // unbounded execution would call high->low thus call the last contig first
    // bounded execution will force the early calls to be made first
    List<Integer> startPos = output.stream().map(x -> x.getAlignmentStart()).collect(Collectors.toList());
    assertFalse(Ordering.natural().reverse().isOrdered(startPos));
}
Also used : AssemblyAttributes(au.edu.wehi.idsv.AssemblyAttributes) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) Arrays(java.util.Arrays) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) SequentialIdGenerator(au.edu.wehi.idsv.SequentialIdGenerator) SAMRecordUtil(au.edu.wehi.idsv.sam.SAMRecordUtil) ArrayList(java.util.ArrayList) TestHelper(au.edu.wehi.idsv.TestHelper) Lists(com.google.common.collect.Lists) ProcessingContext(au.edu.wehi.idsv.ProcessingContext) NonReferenceReadPair(au.edu.wehi.idsv.NonReferenceReadPair) Iterator(java.util.Iterator) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Collectors(java.util.stream.Collectors) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) File(java.io.File) SAMRecord(htsjdk.samtools.SAMRecord) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) List(java.util.List) Ordering(com.google.common.collect.Ordering) Assert.assertFalse(org.junit.Assert.assertFalse) Assert(org.junit.Assert) SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) Assert.assertEquals(org.junit.Assert.assertEquals) ProcessingContext(au.edu.wehi.idsv.ProcessingContext) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) SAMRecord(htsjdk.samtools.SAMRecord) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 8 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_not_remove_misassembled_partial_paths_when_could_be_collapsed_with_adjacent_read.

@Test
public void should_not_remove_misassembled_partial_paths_when_could_be_collapsed_with_adjacent_read() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(10, 10);
    pc.getAssemblyParameters().k = 2;
    pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 5;
    pc.getAssemblyParameters().removeMisassembledPartialContigsDuringAssembly = true;
    pc.getAssemblyParameters().positional.flushWidthMultiple = 100000;
    pc.getAssemblyParameters().positional.maxPathLengthMultiple = 4;
    List<DirectedEvidence> e = new ArrayList<>();
    for (int i = 1; i < 1000; i += 1) {
        SAMRecord[] rp = OEA(0, i, "2M", true);
        rp[0].setReadBases(B("GG"));
        // expect reverse comp of read sequence
        rp[1].setReadBases(B("AA"));
        e.add(NRRP(ses, rp));
    }
    go(pc, true, e.toArray(new DirectedEvidence[0]));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) SAMRecord(htsjdk.samtools.SAMRecord) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 9 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_remove_fully_reference_evidence_before_end.

@Test
public void should_remove_fully_reference_evidence_before_end() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    int n = 8;
    DirectedEvidence[] input = new DirectedEvidence[2 * n];
    for (int i = 0; i < n; i++) {
        input[2 * i] = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 1000 * i, "6M6S")));
        input[2 * i + 1] = SCE(FWD, withSequence("AACGTGG", Read(0, 1000 * i - 1, "6M1S")));
    }
    NonReferenceContigAssembler caller = create(pc, true, input);
    for (int i = 0; i < n / 2; i++) {
        caller.next();
    }
    assertTrue(caller.tracking_activeNodes() <= 3);
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) Test(org.junit.Test)

Example 10 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method fwd_anchor_length_calculation_should_not_include_any_nonreference_bases.

@Test
public void fwd_anchor_length_calculation_should_not_include_any_nonreference_bases() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 2;
    List<SAMRecord> output = go(pc, true, SCE(FWD, withSequence("AAAAAAAAAT", Read(0, 1, "9M1S"))), SCE(FWD, withSequence("ATTTTTTTTT", Read(0, 9, "1M9S"))));
    assertEquals(1, output.size());
    assertEquals("AAAAAAAAATTTTTTTTT", S(output.get(0).getReadBases()));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) SAMRecord(htsjdk.samtools.SAMRecord) Test(org.junit.Test)

Aggregations

ProcessingContext (au.edu.wehi.idsv.ProcessingContext)46 Test (org.junit.Test)39 SAMRecord (htsjdk.samtools.SAMRecord)30 AssemblyEvidenceSource (au.edu.wehi.idsv.AssemblyEvidenceSource)15 DirectedEvidence (au.edu.wehi.idsv.DirectedEvidence)14 ArrayList (java.util.ArrayList)14 SoftClipEvidence (au.edu.wehi.idsv.SoftClipEvidence)13 SAMEvidenceSource (au.edu.wehi.idsv.SAMEvidenceSource)10 DiscordantReadPair (au.edu.wehi.idsv.DiscordantReadPair)8 SequentialIdGenerator (au.edu.wehi.idsv.SequentialIdGenerator)8 VariantContextDirectedBreakpoint (au.edu.wehi.idsv.VariantContextDirectedBreakpoint)7 File (java.io.File)7 IntermediateFilesTest (au.edu.wehi.idsv.IntermediateFilesTest)6 VariantCaller (au.edu.wehi.idsv.VariantCaller)5 AutoClosingIterator (au.edu.wehi.idsv.util.AutoClosingIterator)5 AssemblyAttributes (au.edu.wehi.idsv.AssemblyAttributes)3 NonReferenceReadPair (au.edu.wehi.idsv.NonReferenceReadPair)3 BreakendSummary (au.edu.wehi.idsv.BreakendSummary)2 DirectedBreakpoint (au.edu.wehi.idsv.DirectedBreakpoint)2 SingleReadEvidence (au.edu.wehi.idsv.SingleReadEvidence)2