Search in sources :

Example 1 with SoftClipsToSplitReads

use of gridss.SoftClipsToSplitReads in project gridss by PapenfussLab.

the class SAMEvidenceSource method ensureExtracted.

public void ensureExtracted() throws IOException {
    File svFile = getContext().getFileSystemContext().getSVBam(getFile());
    File extractedFile = FileSystemContext.getWorkingFileFor(svFile, "gridss.tmp.extracted.");
    File querysortedFile = FileSystemContext.getWorkingFileFor(svFile, "gridss.tmp.querysorted.");
    File taggedFile = FileSystemContext.getWorkingFileFor(svFile, "gridss.tmp.tagged.");
    File withsplitreadsFile = FileSystemContext.getWorkingFileFor(svFile, "gridss.tmp.splitreads.");
    ensureMetrics();
    // have the same tags
    if (!svFile.exists()) {
        if (!withsplitreadsFile.exists()) {
            if (!taggedFile.exists()) {
                if (!querysortedFile.exists()) {
                    if (!extractedFile.exists()) {
                        log.info("Extracting SV reads from " + getFile().getAbsolutePath());
                        File in = getFile(SortOrder.queryname);
                        if (in == null || !in.exists()) {
                            in = getFile();
                        }
                        List<String> args = Lists.newArrayList("INPUT=" + in.getAbsolutePath(), "OUTPUT=" + extractedFile.getAbsolutePath(), // saves intermediate file space
                        "UNMAPPED_READS=false", "METRICS_OUTPUT=" + getContext().getFileSystemContext().getSVMetrics(getFile()), "MIN_CLIP_LENGTH=" + getContext().getConfig().getSoftClip().minLength, "READ_PAIR_CONCORDANCE_METHOD=" + rpcMethod.name(), "FIXED_READ_PAIR_CONCORDANCE_MIN_FRAGMENT_SIZE=" + rpcMinFragmentSize, "FIXED_READ_PAIR_CONCORDANCE_MAX_FRAGMENT_SIZE=" + rpcMaxFragmentSize, "READ_PAIR_CONCORDANT_PERCENT=" + rpcConcordantPercentage, "INSERT_SIZE_METRICS=" + getContext().getFileSystemContext().getInsertSizeMetrics(getFile()));
                        execute(new ExtractSVReads(), args);
                    }
                    SAMFileUtil.sort(getContext().getFileSystemContext(), extractedFile, querysortedFile, SortOrder.queryname);
                    if (gridss.Defaults.DELETE_TEMPORARY_FILES) {
                        FileHelper.delete(extractedFile, true);
                    }
                }
                log.info("Computing SAM tags for " + svFile);
                List<String> args = Lists.newArrayList("INPUT=" + querysortedFile.getAbsolutePath(), "OUTPUT=" + taggedFile.getAbsolutePath());
                execute(new ComputeSamTags(), args);
                if (gridss.Defaults.DELETE_TEMPORARY_FILES) {
                    FileHelper.delete(querysortedFile, true);
                }
            }
            log.info("Identifying split reads for " + getFile().getAbsolutePath());
            List<String> args = Lists.newArrayList("WORKER_THREADS=" + getProcessContext().getWorkerThreadCount(), "INPUT=" + taggedFile.getAbsolutePath(), "OUTPUT=" + withsplitreadsFile.getAbsolutePath());
            // realignment.* not soft-clip
            // "MIN_CLIP_LENGTH=" + getContext().getConfig().
            // "MIN_CLIP_QUAL=" + getContext().getConfig().getSoftClip().minAverageQual);
            execute(new SoftClipsToSplitReads(), args);
            if (gridss.Defaults.DELETE_TEMPORARY_FILES) {
                FileHelper.delete(taggedFile, true);
            }
        }
        SAMFileUtil.sort(getContext().getFileSystemContext(), withsplitreadsFile, svFile, SortOrder.coordinate);
        if (gridss.Defaults.DELETE_TEMPORARY_FILES) {
            FileHelper.delete(withsplitreadsFile, true);
        }
    }
    if (gridss.Defaults.DELETE_TEMPORARY_FILES) {
        FileHelper.delete(extractedFile, true);
        FileHelper.delete(querysortedFile, true);
        FileHelper.delete(taggedFile, true);
        FileHelper.delete(withsplitreadsFile, true);
    }
}
Also used : ComputeSamTags(gridss.ComputeSamTags) MetricsFile(htsjdk.samtools.metrics.MetricsFile) File(java.io.File) ExtractSVReads(gridss.ExtractSVReads) SoftClipsToSplitReads(gridss.SoftClipsToSplitReads)

Example 2 with SoftClipsToSplitReads

use of gridss.SoftClipsToSplitReads in project gridss by PapenfussLab.

the class AssemblyEvidenceSource method ensureExtracted.

@Override
public void ensureExtracted() throws IOException {
    ensureMetrics();
    File svFile = getContext().getFileSystemContext().getSVBam(getFile());
    File withsplitreadsFile = FileSystemContext.getWorkingFileFor(svFile, "gridss.tmp.withsplitreads.");
    ensureMetrics();
    if (!svFile.exists()) {
        log.info("Identifying split reads for " + getFile().getAbsolutePath());
        List<String> args = Lists.newArrayList("WORKER_THREADS=" + getProcessContext().getWorkerThreadCount(), "INPUT=" + getFile().getAbsolutePath(), "OUTPUT=" + svFile.getAbsolutePath());
        execute(new SoftClipsToSplitReads(), args);
    }
    SAMFileUtil.sort(getContext().getFileSystemContext(), withsplitreadsFile, svFile, SortOrder.coordinate);
}
Also used : File(java.io.File) SoftClipsToSplitReads(gridss.SoftClipsToSplitReads)

Aggregations

SoftClipsToSplitReads (gridss.SoftClipsToSplitReads)2 File (java.io.File)2 ComputeSamTags (gridss.ComputeSamTags)1 ExtractSVReads (gridss.ExtractSVReads)1 MetricsFile (htsjdk.samtools.metrics.MetricsFile)1