Skip to content
Snippets Groups Projects
Commit a8a6af81 authored by Pappas's avatar Pappas
Browse files

Update centrifuge command and add kreport task

parent c5815a22
No related branches found
No related tags found
1 merge request!13Centrifuge classify and kreport tasks
...@@ -56,14 +56,16 @@ task build { ...@@ -56,14 +56,16 @@ task build {
task classify { task classify {
String outputDir String outputDir
Boolean compressOutput = true
String? preCommand String? preCommand
String indexPrefix String indexPrefix
File? unpairedReads File? unpairedReads
File read1 File read1
File? read2 File? read2
Boolean? fastaInput Boolean? fastaInput
String? outputFile = outputDir + "/centrifuge.out" String? outputFilePath = outputDir + "/centrifuge.out"
String? reportFile = outputDir + "/centrifuge_report.tsv" String? reportFilePath = outputDir + "/centrifuge_report.tsv"
String? metFilePath # If this is specified, the report file is empty
Int? assignments Int? assignments
Int? minHitLen Int? minHitLen
Int? minTotalLen Int? minTotalLen
...@@ -84,17 +86,17 @@ task classify { ...@@ -84,17 +86,17 @@ task classify {
${true="-1 " false="-U " defined(read2)} ${read1} \ ${true="-1 " false="-U " defined(read2)} ${read1} \
${"-2 " + read2} \ ${"-2 " + read2} \
${"-U " + unpairedReads} \ ${"-U " + unpairedReads} \
${"--report-file " + reportFile} \ ${"--report-file " + reportFilePath} \
${"--min-hitlen " + minHitLen} \ ${"--min-hitlen " + minHitLen} \
${"--min-totallen " + minTotalLen} \ ${"--min-totallen " + minTotalLen} \
${true="--host-taxids " false="" defined(hostTaxIds)} ${sep=',' hostTaxIds} \ ${true="--host-taxids " false="" defined(hostTaxIds)} ${sep=',' hostTaxIds} \
${true="--exclude-taxids " false="" defined(excludeTaxIds)} ${sep=',' excludeTaxIds} \ ${true="--exclude-taxids " false="" defined(excludeTaxIds)} ${sep=',' excludeTaxIds} \
${"-S " + outputFile} ${true="| gzip -c > " false="-S " compressOutput}${outputFilePath}${true=".gz" false="" compressOutput}
} }
output { output {
File outFile = select_first([outputFile]) File classifiedReads = if (compressOutput) then select_first([outputFilePath + ".gz"]) else select_first([outputFilePath])
File reportFile = select_first([reportFile]) File reportFile = select_first([reportFilePath])
} }
runtime { runtime {
...@@ -163,3 +165,41 @@ task downloadTaxonomy { ...@@ -163,3 +165,41 @@ task downloadTaxonomy {
} }
} }
task kreport {
String? preCommand
String outputDir
File centrifugeOut
Boolean inputIsCompressed
String kreportPath=sub(centrifugeOut, "\\.out.*", "\\.kreport")
String indexPrefix
Boolean? onlyUnique
Boolean? showZeros
Boolean? isCountTable
Int? minScore
Int? minLength
Int? cores
Int? memory
command {
set -e -o pipefail
${preCommand}
centrifuge-kreport \
-x ${indexPrefix} \
${true="--only-unique" false="" onlyUnique} \
${true="show-zeros" false="" showZeros} \
${true="--is-count-table" false="" isCountTable} \
${"--min-score " + minScore} \
${"--min-length " + minLength} \
${true="<(zcat " false="" inputIsCompressed}${centrifugeOut}${true=")" false="" inputIsCompressed} \
> ${kreportPath}
}
output {
File kreport = select_first([kreportPath])
}
runtime {
cpu: select_first([cores, 1])
memory: select_first([memory, 4])
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment