Search in sources :

Example 26 with ProcessingContext

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

the class AllocateEvidenceTest method should_filter_if_insufficient_reads.

@Test
public void should_filter_if_insufficient_reads() throws IOException {
    final ProcessingContext pc = getCommandlineContext();
    pc.getVariantCallingParameters().minScore = 0;
    pc.getVariantCallingParameters().minSize = 0;
    pc.getVariantCallingParameters().minReads = 3;
    createInput(RP(0, 1, 10), DP(0, 1, "5M5S", true, 1, 10, "5M", true));
    SAMEvidenceSource ses = new SAMEvidenceSource(getContext(), input, null, 0);
    ses.ensureMetrics();
    File assemblyFile = new File(testFolder.getRoot(), "assembly.bam");
    AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(ses), assemblyFile);
    aes.assembleBreakends(null);
    aes.ensureExtracted();
    VariantCaller caller = new VariantCaller(pc, ImmutableList.of(ses), aes);
    caller.callBreakends(output, MoreExecutors.newDirectExecutorService());
    AllocateEvidence cmd = new AllocateEvidence();
    cmd.INPUT_VCF = output;
    cmd.setContext(pc);
    cmd.setAssemblySource(aes);
    cmd.setSamEvidenceSources(ImmutableList.of(ses));
    cmd.OUTPUT_VCF = new File(testFolder.getRoot(), "annotated.vcf");
    List<VariantContextDirectedBreakpoint> vcfs = Lists.newArrayList(Iterables.filter(getVcf(output, null), VariantContextDirectedBreakpoint.class));
    List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
    assertEquals(2, vcfs.size());
    assertEquals(0, results.size());
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) AutoClosingIterator(au.edu.wehi.idsv.util.AutoClosingIterator) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) VariantCaller(au.edu.wehi.idsv.VariantCaller) File(java.io.File) IntermediateFilesTest(au.edu.wehi.idsv.IntermediateFilesTest) Test(org.junit.Test)

Example 27 with ProcessingContext

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

the class AllocateEvidenceTest method should_filter_if_insufficient_quality.

@Test
public void should_filter_if_insufficient_quality() throws IOException {
    final ProcessingContext pc = getCommandlineContext();
    pc.getVariantCallingParameters().minScore = 1000;
    pc.getVariantCallingParameters().minSize = 0;
    pc.getVariantCallingParameters().minReads = 0;
    createInput(RP(0, 1, 10), DP(0, 1, "5M5S", true, 1, 10, "5M", true));
    SAMEvidenceSource ses = new SAMEvidenceSource(getContext(), input, null, 0);
    ses.ensureMetrics();
    File assemblyFile = new File(testFolder.getRoot(), "assembly.bam");
    AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(ses), assemblyFile);
    aes.assembleBreakends(null);
    aes.ensureExtracted();
    VariantCaller caller = new VariantCaller(pc, ImmutableList.of(ses), aes);
    caller.callBreakends(output, MoreExecutors.newDirectExecutorService());
    AllocateEvidence cmd = new AllocateEvidence();
    cmd.INPUT_VCF = output;
    cmd.setContext(pc);
    cmd.setAssemblySource(aes);
    cmd.setSamEvidenceSources(ImmutableList.of(ses));
    cmd.OUTPUT_VCF = new File(testFolder.getRoot(), "annotated.vcf");
    List<VariantContextDirectedBreakpoint> vcfs = Lists.newArrayList(Iterables.filter(getVcf(output, null), VariantContextDirectedBreakpoint.class));
    List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
    assertEquals(0, results.size());
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) AutoClosingIterator(au.edu.wehi.idsv.util.AutoClosingIterator) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) VariantCaller(au.edu.wehi.idsv.VariantCaller) File(java.io.File) IntermediateFilesTest(au.edu.wehi.idsv.IntermediateFilesTest) Test(org.junit.Test)

Example 28 with ProcessingContext

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

the class AnnotateInexactHomologyTest method should_calculate_inexact_homology.

@Test
public void should_calculate_inexact_homology() {
    ProcessingContext pc = getContext();
    StructuralVariationCallBuilder builder = new StructuralVariationCallBuilder(pc, (VariantContextDirectedEvidence) new IdsvVariantContextBuilder(getContext()) {

        {
            breakpoint(new BreakpointSummary(2, FWD, 78, 6, BWD, 79), "");
            phredScore(50);
        }
    }.make());
    builder.addEvidence(SR(Read(2, 78, "1M1S"), Read(6, 79, "1M")));
    VariantContextDirectedBreakpoint e = (VariantContextDirectedBreakpoint) builder.make();
    AnnotateInexactHomology aih = new AnnotateInexactHomology();
    aih.setContext(pc);
    ExecutorService threadpool = Executors.newSingleThreadExecutor();
    e = aih.iterator(new AutoClosingIterator<>(ImmutableList.of(e).iterator()), threadpool).next();
    assertEquals(-78, ((int[]) e.getAttribute(VcfInfoAttributes.INEXACT_HOMPOS.attribute()))[0]);
    assertEquals(300, ((int[]) e.getAttribute(VcfInfoAttributes.INEXACT_HOMPOS.attribute()))[1]);
    threadpool.shutdown();
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) IdsvVariantContextBuilder(au.edu.wehi.idsv.IdsvVariantContextBuilder) StructuralVariationCallBuilder(au.edu.wehi.idsv.StructuralVariationCallBuilder) ExecutorService(java.util.concurrent.ExecutorService) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint) BreakpointSummary(au.edu.wehi.idsv.BreakpointSummary) Test(org.junit.Test)

Example 29 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_truncate_anchored_polyA_expansion_bwd.

@Test
public void should_truncate_anchored_polyA_expansion_bwd() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    SoftClipEvidence sce = SCE(BWD, withSequence("AAAAGTAC", Read(0, 100, "4S4M")));
    DiscordantReadPair dp = (DiscordantReadPair) NRRP(SES(11, 100), withSequence("CAAAAG", DP(0, 110, "6M", false, 1, 1, "6M", true)));
    List<SAMRecord> output = go(pc, true, sce, dp);
    assertEquals(1, output.size());
    assertEquals("AAAAGTAC", 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 30 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_remove_fully_reference_evidence.

@Test
public void should_remove_fully_reference_evidence() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    SoftClipEvidence sce = SCE(FWD, withSequence("ACGTGGTCGACC", Read(0, 50, "6M6S")));
    SoftClipEvidence fullref = SCE(FWD, withSequence("ACGTGG", Read(0, 50, "5M1S")));
    List<SAMRecord> output = go(pc, true, sce, fullref);
    assertEquals(1, output.size());
    assertEquals("ACGTGGTCGACC", S(output.get(0).getReadBases()));
    assertEquals(2, tracker.tracking_evidenceTotal());
    assertEquals(0, tracker.tracking_evidenceActive());
    assertEquals(0, caller.tracking_activeNodes());
}
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