Search in sources :

Example 31 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_not_assembly_when_graph_density_exceeds_maximum.

@Test
public void should_not_assembly_when_graph_density_exceeds_maximum() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(10, 10);
    pc.getAssemblyParameters().k = 4;
    pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 1;
    pc.getAssemblyParameters().positional.maximumNodeDensity = 0.1f;
    List<DirectedEvidence> e = new ArrayList<>();
    for (int i = 1; i < 101; i++) {
        e.add(SCE(FWD, ses, withReadName(String.format("%d-%d", i, 0), withSequence("AAAATTGG", Read(0, i, "4M4S")))[0]));
        e.add(SCE(FWD, ses, withReadName(String.format("%d-%d", i, 1), withSequence("AAAACCGG", Read(0, i, "4M4S")))[0]));
    }
    List<SAMRecord> output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    // the final advance doesn't get flushed since the underlying stream
    // is considered to advance to Integer.MAX_VALUE at end of input
    assertTrue(output.size() <= 20);
    // shouldn't get throttled
    pc.getAssemblyParameters().positional.maximumNodeDensity = 10;
    output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    assertEquals(2 * 100, output.size());
}
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 32 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_call_overlapping_sc_rp.

@Test
public void should_call_overlapping_sc_rp() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    SoftClipEvidence sce = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
    DiscordantReadPair e = (DiscordantReadPair) NRRP(SES(10, 200), withSequence("GACCTCTACT", DP(0, 25, "10M", true, 1, 1, "10M", false)));
    List<SAMRecord> output = go(pc, true, sce, e);
    assertEquals(1, output.size());
    assertEquals("ACGTGGTCGACCTCTACT", S(output.get(0).getReadBases()));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) SAMRecord(htsjdk.samtools.SAMRecord) DiscordantReadPair(au.edu.wehi.idsv.DiscordantReadPair) Test(org.junit.Test)

Example 33 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_remove_misassembled_partial_paths.

@Test
public void should_remove_misassembled_partial_paths() {
    ProcessingContext pc = getContext();
    MockSAMEvidenceSource ses = SES(10, 10);
    pc.getAssemblyParameters().k = 4;
    pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 1;
    List<DirectedEvidence> e = new ArrayList<>();
    for (int i = 1; i < 100; i++) {
        e.add(SCE(FWD, ses, withReadName(String.format("%d-%d", 0, i), withSequence("TAAAAAAAAAAAAAAAAAAAAAAAAAAAA", Read(0, i * 20, "4M25S")))[0]));
    }
    List<SAMRecord> output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    // the rest should have been removed
    assertEquals(1, output.size());
}
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 34 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_removeMisassembledPartialContigsDuringAssembly.

@Test
public void should_removeMisassembledPartialContigsDuringAssembly() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().removeMisassembledPartialContigsDuringAssembly = false;
    MockSAMEvidenceSource ses = new MockSAMEvidenceSource(getContext(), 50, 100);
    pc.getAssemblyParameters().k = 4;
    pc.getAssemblyParameters().maxExpectedBreakendLengthMultiple = 1.5f;
    List<DirectedEvidence> e = new ArrayList<>();
    for (int i = 1; i < 1000; i++) {
        e.add(NRRP(ses, OEA(0, i, "10M", true)));
    }
    List<SAMRecord> output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    assertEquals(1, output.size());
    SAMRecord r = output.get(0);
    int sclenFull = SAMRecordUtil.getStartClipLength(r) + SAMRecordUtil.getEndClipLength(r);
    pc.getAssemblyParameters().removeMisassembledPartialContigsDuringAssembly = true;
    output = go(pc, false, e.toArray(new DirectedEvidence[0]));
    assertEquals(1, output.size());
    r = output.get(0);
    int sclenTruncated = SAMRecordUtil.getStartClipLength(r) + SAMRecordUtil.getEndClipLength(r);
    Assert.assertNotEquals(sclenFull, sclenTruncated);
}
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 35 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_call_simple_fwd_SC.

@Test
public void should_call_simple_fwd_SC() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    SoftClipEvidence sce = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 5, "6M6S")));
    List<SAMRecord> output = go(pc, true, sce);
    assertEquals(1, output.size());
    assertEquals("ACGTGGTCGACC", S(output.get(0).getReadBases()));
    assertEquals("6M6S", output.get(0).getCigarString());
    assertEquals(0, (int) output.get(0).getReferenceIndex());
    assertEquals(5, output.get(0).getAlignmentStart());
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) SoftClipEvidence(au.edu.wehi.idsv.SoftClipEvidence) 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