Search in sources :

Example 1 with SAMEvidenceSource

use of au.edu.wehi.idsv.SAMEvidenceSource 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 2 with SAMEvidenceSource

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

the class AggregateNodeIteratorTest method should_aggregate_kmer_weights.

@Test
public void should_aggregate_kmer_weights() {
    int k = 4;
    SAMEvidenceSource ses = SES(30, 60);
    List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
    input.add(NRRP(ses, withQual(new byte[] { 1, 1, 1, 1, 1 }, withSequence("ACGTT", DP(0, 1, "5M", false, 1, 1, "5M", false)))));
    input.add(NRRP(ses, withQual(new byte[] { 1, 1, 1, 1, 1 }, withSequence("ACGTT", DP(0, 2, "5M", false, 1, 1, "5M", false)))));
    Collections.sort(input, DirectedEvidence.ByStartEnd);
    List<KmerSupportNode> snList = Lists.newArrayList(new SupportNodeIterator(k, input.iterator(), ses.getMaxConcordantFragmentSize(), null, false, 0));
    List<KmerNode> anList = Lists.newArrayList(new AggregateNodeIterator(snList.iterator()));
    assertTrue(KmerNodeUtil.ByLastStart.isOrdered(anList));
    assertEquals(4, snList.size());
    assertEquals(6, anList.size());
}
Also used : DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) ArrayList(java.util.ArrayList) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) Test(org.junit.Test)

Example 3 with SAMEvidenceSource

use of au.edu.wehi.idsv.SAMEvidenceSource 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 4 with SAMEvidenceSource

use of au.edu.wehi.idsv.SAMEvidenceSource 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)

Example 5 with SAMEvidenceSource

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

the class StaticDeBruijnPathGraphGexfExporterTest method positional_should_export_dot.

@Test
@Category(Hg19Tests.class)
public void positional_should_export_dot() throws IOException {
    File output = new File(super.testFolder.getRoot(), "chr12-244000.vcf");
    setReference(Hg19Tests.findHg19Reference("chr12.fa"));
    createInput(new File("src/test/resources/chr12-244000.tagged.bam"));
    BuildBamIndex bbi = new BuildBamIndex();
    bbi.instanceMain(new String[] { "I=" + input.getAbsolutePath() });
    ProcessingContext pc = getCommandlineContext();
    SAMEvidenceSource ses = new SAMEvidenceSource(pc, input, null, 0);
    AssemblyEvidenceSource aes = new AssemblyEvidenceSource(pc, ImmutableList.of(ses), output);
    aes.assembleBreakends(null);
    File dir = new File(super.testFolder.getRoot(), "visualisation");
    File[] export = dir.listFiles((FileFilter) new WildcardFileFilter("*.dot"));
    // TODO: change graph write timing
    assertTrue(export != null && export.length > 0);
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) File(java.io.File) BuildBamIndex(picard.sam.BuildBamIndex) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) Category(org.junit.experimental.categories.Category) IntermediateFilesTest(au.edu.wehi.idsv.IntermediateFilesTest) Test(org.junit.Test)

Aggregations

SAMEvidenceSource (au.edu.wehi.idsv.SAMEvidenceSource)12 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)9 AssemblyEvidenceSource (au.edu.wehi.idsv.AssemblyEvidenceSource)8 Test (org.junit.Test)8 IntermediateFilesTest (au.edu.wehi.idsv.IntermediateFilesTest)6 VariantContextDirectedBreakpoint (au.edu.wehi.idsv.VariantContextDirectedBreakpoint)6 File (java.io.File)6 VariantCaller (au.edu.wehi.idsv.VariantCaller)5 AutoClosingIterator (au.edu.wehi.idsv.util.AutoClosingIterator)5 DirectedEvidence (au.edu.wehi.idsv.DirectedEvidence)3 ArrayList (java.util.ArrayList)3 DiscordantReadPair (au.edu.wehi.idsv.DiscordantReadPair)2 SAMRecord (htsjdk.samtools.SAMRecord)2 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 DirectedEvidenceOrder (au.edu.wehi.idsv.DirectedEvidenceOrder)1 IdsvVariantContext (au.edu.wehi.idsv.IdsvVariantContext)1 NonReferenceReadPair (au.edu.wehi.idsv.NonReferenceReadPair)1 SequentialCoverageAnnotator (au.edu.wehi.idsv.SequentialCoverageAnnotator)1 SoftClipEvidence (au.edu.wehi.idsv.SoftClipEvidence)1