Commit 9a3356a5 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Convert pipe to SortSam again

parent 0c43aaf3
......@@ -31,31 +31,32 @@ class SortSam(val root: Configurable) extends Picard {
var output: File = _
@Argument(doc = "Sort order of output file Required. Possible values: {unsorted, queryname, coordinate} ", required = true)
var sortOrder: String = _
var sortOrder: String = config("sort_order", default = "coordinate")
@Output(doc = "Bam Index", required = true)
private var outputIndex: File = _
override def beforeGraph() {
super.beforeGraph()
if (outputAsStsout) createIndex = false
if (createIndex) outputIndex = new File(output.getAbsolutePath.stripSuffix(".bam") + ".bai")
}
/** Returns command to execute */
override def cmdLine = super.cmdLine +
required("INPUT=", input, spaceSeparated = false) +
required("OUTPUT=", output, spaceSeparated = false) +
(if (inputAsStdin) required("INPUT=", new File("/dev/stdin"), spaceSeparated = false)
else required("INPUT=", input, spaceSeparated = false)) +
(if (outputAsStsout) required("OUTPUT=", new File("/dev/stdout"), spaceSeparated = false)
else required("OUTPUT=", output, spaceSeparated = false)) +
required("SORT_ORDER=", sortOrder, spaceSeparated = false)
}
object SortSam {
/** Returns default SortSam */
def apply(root: Configurable, input: File, output: File, sortOrder: String = null): SortSam = {
def apply(root: Configurable, input: File, output: File): SortSam = {
val sortSam = new SortSam(root)
sortSam.input = input
sortSam.output = output
if (sortOrder == null) sortSam.sortOrder = "coordinate"
else sortSam.sortOrder = sortOrder
sortSam
}
}
\ No newline at end of file
......@@ -334,16 +334,18 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
bwaCommand.deps = deps
bwaCommand.R = Some(getReadGroupBwa)
bwaCommand.isIntermediate = true
val sortSam = new SortSam(this)
sortSam.output = output
if (config("use_pipes", default = true).asBoolean) {
val samtoolsSort = new SamtoolsSort(this)
samtoolsSort.outputFormat = Some("bam")
samtoolsSort.output = output
add(bwaCommand | samtoolsSort)
add(bwaCommand | samtoolsSort, chunking || !skipMarkduplicates)
} else {
bwaCommand.output = swapExt(output.getParent, output, ".bam", ".sam")
add(bwaCommand)
val sortSam = SortSam(this, bwaCommand.output, output)
if (chunking || !skipMarkduplicates) sortSam.isIntermediate = true
sortSam.input = bwaCommand.output
sortSam.isIntermediate = chunking || !skipMarkduplicates
add(sortSam)
}
output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment