Search in sources :

Example 11 with AssemblyEvidenceSource

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

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

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

the class PositionalAssemblerTest method anchor_should_not_overrun_contig_start.

@Test
public void anchor_should_not_overrun_contig_start() {
    ProcessingContext pc = getContext();
    AssemblyEvidenceSource aes = AES(pc);
    pc.getAssemblyParameters().k = 4;
    List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
    input.add(SCE(FWD, withSequence("CGTAACCGGTTC", Read(0, 1, "1M2I4M5S"))));
    ArrayList<SAMRecord> r = Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator()));
    assertEquals(1, r.size());
    assertEquals(1, r.get(0).getAlignmentStart());
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) SAMRecord(htsjdk.samtools.SAMRecord) ArrayList(java.util.ArrayList) SequentialIdGenerator(au.edu.wehi.idsv.SequentialIdGenerator) Test(org.junit.Test)

Example 14 with AssemblyEvidenceSource

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

the class PositionalAssemblerTest method anchor_should_not_overrun_contig_end.

@Test
public void anchor_should_not_overrun_contig_end() {
    ProcessingContext pc = getContext();
    AssemblyEvidenceSource aes = AES(pc);
    pc.getAssemblyParameters().k = 4;
    List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
    input.add(SCE(BWD, withSequence("CGTAACCGGTTC", Read(0, 9996, "5S4M2I1M"))));
    ArrayList<SAMRecord> r = Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator()));
    assertEquals(1, r.size());
    assertEquals(10000, r.get(0).getAlignmentEnd());
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) SAMRecord(htsjdk.samtools.SAMRecord) ArrayList(java.util.ArrayList) SequentialIdGenerator(au.edu.wehi.idsv.SequentialIdGenerator) Test(org.junit.Test)

Example 15 with AssemblyEvidenceSource

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

the class PositionalAssemblerTest method should_assemble_each_read_alignment_only_once.

@Test
public void should_assemble_each_read_alignment_only_once() {
    ProcessingContext pc = getContext();
    AssemblyEvidenceSource aes = AES(pc);
    pc.getAssemblyParameters().k = 4;
    String seq = "AACCGGTTAA";
    List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
    input.add(SCE(FWD, withSequence(seq, Read(0, 10, "5M5S"))[0]));
    input.add(SCE(FWD, withSequence(seq, Read(0, 10, "5M5S"))[0]));
    input.add(SCE(FWD, withSequence(seq, Read(0, 10, "5M5S"))[0]));
    input.add(IE(withSequence(seq, Read(0, 10, "5M100D5M"))[0]));
    input.add(IE(withSequence(seq, Read(0, 10, "5M100D5M"))[0]));
    input.add(IE(withSequence(seq, Read(0, 10, "5M100D5M"))[0]));
    input.sort(DirectedEvidenceOrder.ByStartEnd);
    ArrayList<SAMRecord> r = Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator()));
    assertEquals(2, ((int[]) r.get(0).getAttribute("sc"))[0]);
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) SAMRecord(htsjdk.samtools.SAMRecord) ArrayList(java.util.ArrayList) SequentialIdGenerator(au.edu.wehi.idsv.SequentialIdGenerator) Test(org.junit.Test)

Aggregations

AssemblyEvidenceSource (au.edu.wehi.idsv.AssemblyEvidenceSource)15 ProcessingContext (au.edu.wehi.idsv.ProcessingContext)13 Test (org.junit.Test)11 SAMEvidenceSource (au.edu.wehi.idsv.SAMEvidenceSource)7 SequentialIdGenerator (au.edu.wehi.idsv.SequentialIdGenerator)7 File (java.io.File)7 DirectedEvidence (au.edu.wehi.idsv.DirectedEvidence)6 ArrayList (java.util.ArrayList)6 IntermediateFilesTest (au.edu.wehi.idsv.IntermediateFilesTest)5 VariantContextDirectedBreakpoint (au.edu.wehi.idsv.VariantContextDirectedBreakpoint)5 VariantCaller (au.edu.wehi.idsv.VariantCaller)4 AutoClosingIterator (au.edu.wehi.idsv.util.AutoClosingIterator)4 SAMRecord (htsjdk.samtools.SAMRecord)4 BreakendSummary (au.edu.wehi.idsv.BreakendSummary)2 SingleReadEvidence (au.edu.wehi.idsv.SingleReadEvidence)2 SequentialCoverageAnnotator (au.edu.wehi.idsv.SequentialCoverageAnnotator)1 WildcardFileFilter (org.apache.commons.io.filefilter.WildcardFileFilter)1 Category (org.junit.experimental.categories.Category)1 BuildBamIndex (picard.sam.BuildBamIndex)1