Search in sources :

Example 11 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method should_handle_multiple_candidate_offsets_for_a_single_kmer_position.

@Test
public void should_handle_multiple_candidate_offsets_for_a_single_kmer_position() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 4;
    pc.getAssemblyParameters().includePairAnchors = false;
    List<SAMRecord> output = go(pc, true, NRRP(SES(1, 100), withSequence("TAAAAA", DP(1, 100, "6M", false, 0, 1, "6M", true))));
    assertEquals(1, output.size());
    assertEquals("TAAAAA" + "NN", S(output.get(0).getReadBases()));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) SAMRecord(htsjdk.samtools.SAMRecord) Test(org.junit.Test)

Example 12 with ProcessingContext

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

the class NonReferenceContigAssemblerTest method bwd_anchor_length_calculation_should_not_include_any_nonreference_bases.

@Test
public void bwd_anchor_length_calculation_should_not_include_any_nonreference_bases() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().k = 2;
    List<SAMRecord> output = go(pc, true, SCE(BWD, withSequence("AAAAAAAAAT", Read(0, 10, "9S1M"))), SCE(BWD, withSequence("ATTTTTTTTT", Read(0, 10, "1S9M"))));
    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)

Example 13 with ProcessingContext

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

the class KmerEvidence method getReferenceContigLength.

/**
 * Finds the length of the reference sequence on which this kmer is placed
 * @param e
 * @return
 */
private static int getReferenceContigLength(DirectedEvidence e) {
    int refIndex = e.getBreakendSummary().referenceIndex;
    EvidenceSource source = e.getEvidenceSource();
    if (source != null) {
        ProcessingContext context = source.getContext();
        if (context != null) {
            return context.getReference().getSequenceDictionary().getSequence(refIndex).getSequenceLength();
        }
    }
    return Integer.MAX_VALUE;
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) EvidenceSource(au.edu.wehi.idsv.EvidenceSource)

Example 14 with ProcessingContext

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

the class AllocateEvidenceTest method should_annotate_reads.

@Test
public void should_annotate_reads() throws IOException {
    final ProcessingContext pc = getCommandlineContext();
    pc.getVariantCallingParameters().minScore = 0;
    pc.getVariantCallingParameters().minSize = 0;
    createInput(RP(0, 1, 10), DP(0, 1, "5M5S", true, 1, 10, "5M", true), DP(0, 2, "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));
    // both breakends
    assertEquals(2 * 1, vcfs.size());
    assertSymmetrical(vcfs);
    List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
    assertSymmetrical(results);
    assertEquals(vcfs.size(), results.size());
    VariantContextDirectedBreakpoint e = results.get(0);
    assertEquals(2, e.getBreakpointEvidenceCount());
    assertEquals(2, e.getBreakendEvidenceCountSoftClip());
}
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 15 with ProcessingContext

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

the class AllocateEvidenceTest method should_apply_filters.

@Test
public void should_apply_filters() throws IOException {
    final ProcessingContext pc = getCommandlineContext();
    pc.getVariantCallingParameters().minScore = 0;
    pc.getVariantCallingParameters().minSize = 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));
    // both breakends
    assertEquals(2 * 1, vcfs.size());
    assertSymmetrical(vcfs);
    List<VariantContextDirectedBreakpoint> results = Lists.newArrayList(cmd.iterator(new AutoClosingIterator<>(vcfs.iterator()), MoreExecutors.newDirectExecutorService()));
    assertSymmetrical(results);
    // single read support
    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)

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