Search in sources :

Example 6 with AssemblyEvidenceSource

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

the class PositionalAssemblerTest method rp_anchor_should_set_non_reference_bases_as_anchoring.

@Test
public void rp_anchor_should_set_non_reference_bases_as_anchoring() {
    ProcessingContext pc = getContext();
    pc.getAssemblyParameters().anchorLength = 1;
    AssemblyEvidenceSource aes = AES(pc);
    pc.getAssemblyParameters().k = 4;
    List<DirectedEvidence> input = new ArrayList<DirectedEvidence>();
    // 12345678901234567890
    // ACGTTGGTTA
    // MMMMMSSSSS
    // GCAACGTTGGTTAA
    // MMMMMMMMSSSSSS
    // TTTTTGCAACGTTGGTTAA
    input.add(SCE(FWD, withSequence("ACGTTGGTTA", Read(0, 10, "5M5S"))[0]));
    input.add(SCE(FWD, withSequence("TTTTTGCAACGTTGGTTAA", Read(0, 2, "13M6S"))[0]));
    input.add(NRRP(withSequence("TTTTTGCAACGTTGGTTAA", DP(0, 2, "13M6S", true, 1, 1, "19M", false))));
    input.sort(DirectedEvidenceOrder.ByStartEnd);
    List<SingleReadEvidence> r = asAssemblyEvidence(aes, Lists.newArrayList(new PositionalAssembler(pc, aes, new SequentialIdGenerator("asm"), input.iterator())));
    assertEquals(2, r.size());
    // race condition w.r.t which assembly returns first
    assertEquals(new BreakendSummary(0, FWD, 14), r.get(0).getBreakendSummary());
    // anchor length to match breakend length
    assertEquals("AACGTT", S(r.get(0).getAnchorSequence()));
    assertEquals("GGTTAA", S(r.get(0).getBreakendSequence()));
    assertEquals("AACGTTGGTTAA", S(r.get(0).getSAMRecord().getReadBases()));
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) DirectedEvidence(au.edu.wehi.idsv.DirectedEvidence) ArrayList(java.util.ArrayList) BreakendSummary(au.edu.wehi.idsv.BreakendSummary) SequentialIdGenerator(au.edu.wehi.idsv.SequentialIdGenerator) SingleReadEvidence(au.edu.wehi.idsv.SingleReadEvidence) Test(org.junit.Test)

Example 7 with AssemblyEvidenceSource

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

Example 8 with AssemblyEvidenceSource

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

the class AssembleBreakends method doWork.

@Override
public int doWork(ExecutorService threadpool) throws IOException {
    IOUtil.assertFileIsWritable(OUTPUT);
    ProcessingContext pc = getContext();
    List<SAMEvidenceSource> sources = getSamEvidenceSources();
    AssemblyEvidenceSource assembler = new AssemblyEvidenceSource(pc, sources, OUTPUT);
    assembler.assembleBreakends(threadpool);
    return 0;
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource)

Example 9 with AssemblyEvidenceSource

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

the class AnnotateReferenceCoverage method iterator.

@Override
public CloseableIterator<VariantContextDirectedBreakpoint> iterator(CloseableIterator<VariantContextDirectedBreakpoint> calls, ExecutorService threadpool) {
    ProcessingContext context = getContext();
    List<SAMEvidenceSource> sources = getSamEvidenceSources();
    AssemblyEvidenceSource asm = getAssemblySource();
    int windowSize = SAMEvidenceSource.maximumWindowSize(context, sources, asm);
    return new SequentialCoverageAnnotator<VariantContextDirectedBreakpoint>(context, sources, calls, 2 * windowSize + WINDOW_SIZE_SAFETY_MARGIN, threadpool);
}
Also used : ProcessingContext(au.edu.wehi.idsv.ProcessingContext) AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) SAMEvidenceSource(au.edu.wehi.idsv.SAMEvidenceSource) SequentialCoverageAnnotator(au.edu.wehi.idsv.SequentialCoverageAnnotator) VariantContextDirectedBreakpoint(au.edu.wehi.idsv.VariantContextDirectedBreakpoint)

Example 10 with AssemblyEvidenceSource

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

the class CallVariants method doWork.

@Override
public int doWork(ExecutorService threadpool) throws IOException, InterruptedException, ExecutionException {
    IOUtil.assertFileIsWritable(OUTPUT);
    File lockFile = FileSystemContext.getWorkingFileFor(OUTPUT, "gridss.lock.");
    if (lockFile.mkdir()) {
        log.debug("Created lock ", lockFile);
        // Set up lock file clean-up if GRIDSS execution is forcibly terminated using SIGINT
        Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                lockFile.delete();
            }
        });
        extractEvidence(threadpool, getSamEvidenceSources());
        AssemblyEvidenceSource assemblyEvidence = new AssemblyEvidenceSource(getContext(), getSamEvidenceSources(), ASSEMBLY);
        if (!ASSEMBLY.exists()) {
            assemblyEvidence.assembleBreakends(threadpool);
        }
        // convert breakend assemblies into breakpoint via split read identification
        assemblyEvidence.ensureExtracted();
        // call and annotate variants
        callVariants(threadpool);
        lockFile.delete();
    } else {
        log.error("Aborting since lock " + lockFile + " already exists. GRIDSS does not support multiple simultaneous instances running on the same data.");
        return 3;
    }
    return 0;
}
Also used : AssemblyEvidenceSource(au.edu.wehi.idsv.AssemblyEvidenceSource) File(java.io.File)

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