Search in sources :

Example 1 with PositionalAssembler

use of au.edu.wehi.idsv.debruijn.positional.PositionalAssembler in project gridss by PapenfussLab.

the class AssemblyEvidenceSource method getAllAssemblies_single_threaded.

@SuppressWarnings("unused")
private Iterator<SAMRecord> getAllAssemblies_single_threaded() {
    ProgressLogger progressLog = new ProgressLogger(log);
    List<Iterator<SAMRecord>> list = new ArrayList<>();
    for (BreakendDirection direction : BreakendDirection.values()) {
        CloseableIterator<DirectedEvidence> it = mergedIterator(source, false);
        Iterator<DirectedEvidence> throttledIt = throttled(it);
        ProgressLoggingDirectedEvidenceIterator<DirectedEvidence> loggedIt = new ProgressLoggingDirectedEvidenceIterator<>(getContext(), throttledIt, progressLog);
        Iterator<SAMRecord> evidenceIt = new PositionalAssembler(getContext(), this, new SequentialIdGenerator("asm"), loggedIt, direction);
        list.add(evidenceIt);
    }
    return Iterators.concat(list.iterator());
}
Also used : PositionalAssembler(au.edu.wehi.idsv.debruijn.positional.PositionalAssembler) ArrayList(java.util.ArrayList) ProgressLogger(htsjdk.samtools.util.ProgressLogger) SAMRecord(htsjdk.samtools.SAMRecord) CloseableIterator(htsjdk.samtools.util.CloseableIterator) Iterator(java.util.Iterator)

Example 2 with PositionalAssembler

use of au.edu.wehi.idsv.debruijn.positional.PositionalAssembler in project gridss by PapenfussLab.

the class AssemblyEvidenceSource method assembleChunk.

private void assembleChunk(SAMFileWriter writer, SAMFileWriter filteredWriter, int chunkNumber, QueryInterval[] intervals, BreakendDirection direction, AssemblyIdGenerator assemblyNameGenerator) {
    QueryInterval[] expanded = getExpanded(intervals);
    try (CloseableIterator<DirectedEvidence> input = mergedIterator(source, expanded)) {
        Iterator<DirectedEvidence> throttledIt = throttled(input);
        PositionalAssembler assembler = new PositionalAssembler(getContext(), AssemblyEvidenceSource.this, assemblyNameGenerator, throttledIt, direction);
        if (telemetry != null) {
            assembler.setTelemetry(telemetry.getTelemetry(chunkNumber, direction));
        }
        while (assembler.hasNext()) {
            SAMRecord asm = assembler.next();
            // transform before chunk bounds checking as the position may have moved
            asm = transformAssembly(asm);
            if (QueryIntervalUtil.overlaps(intervals, asm.getReferenceIndex(), asm.getAlignmentStart())) {
                // only output assemblies that start within our chunk
                if (shouldFilterAssembly(asm)) {
                    if (filteredWriter != null) {
                        filteredWriter.addAlignment(asm);
                    }
                } else {
                    writer.addAlignment(asm);
                }
            }
        }
    }
}
Also used : PositionalAssembler(au.edu.wehi.idsv.debruijn.positional.PositionalAssembler) SAMRecord(htsjdk.samtools.SAMRecord) QueryInterval(htsjdk.samtools.QueryInterval)

Aggregations

PositionalAssembler (au.edu.wehi.idsv.debruijn.positional.PositionalAssembler)2 SAMRecord (htsjdk.samtools.SAMRecord)2 QueryInterval (htsjdk.samtools.QueryInterval)1 CloseableIterator (htsjdk.samtools.util.CloseableIterator)1 ProgressLogger (htsjdk.samtools.util.ProgressLogger)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1