use of gridss.ComputeSamTags in project gridss by PapenfussLab.
the class StaticDeBruijnPathGraphGexfExporterTest method add_tags.
// @Test
// @Ignore("Once-off data import")
public void add_tags() throws IOException {
File in = new File("src/test/resources/chr12-244000.bam");
File insq = new File("src/test/resources/chr12-244000.sq.bam");
File outsq = new File("src/test/resources/chr12-244000.sq.tagged.bam");
File out = new File("src/test/resources/chr12-244000.tagged.bam");
SAMFileUtil.sort(getFSContext(), in, insq, SortOrder.queryname);
File ref = Hg19Tests.findHg19Reference("chr12.fa");
ComputeSamTags cmd = new ComputeSamTags();
cmd.instanceMain(new String[] { "INPUT=" + insq.getAbsolutePath(), "OUTPUT=" + outsq.getAbsolutePath(), "REFERENCE_SEQUENCE=" + ref.getAbsolutePath() });
SAMFileUtil.sort(getFSContext(), outsq, out, SortOrder.coordinate);
}
use of gridss.ComputeSamTags 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);
}
}
Aggregations