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

Requested changes

parent a7a1986c
No related branches found
No related tags found
1 merge request!13Centrifuge classify and kreport tasks
...@@ -22,7 +22,8 @@ task build { ...@@ -22,7 +22,8 @@ task build {
File? nameTable File? nameTable
File? sizeTable File? sizeTable
Int? seed Int? seed
Int? threads = 1 Int? threads
Int? memory
Int? kmerCount Int? kmerCount
command { command {
...@@ -50,22 +51,25 @@ task build { ...@@ -50,22 +51,25 @@ task build {
${centrifugeIndexBase} ${centrifugeIndexBase}
} }
runtime { runtime {
cpu: select_first([threads]) cpu: select_first([threads, 8])
memory: select_first([memory, 20])
} }
} }
task classify { task classify {
String outputDir String outputDir
Boolean compressOutput = true 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? outputFilePath = outputDir + "/centrifuge.out" # Variables for handling output
String? reportFilePath = outputDir + "/centrifuge_report.tsv" String outputFileName = outputDir + "/centrifuge.out"
String? metFilePath # If this is specified, the report file is empty String reportFileName = outputDir + "/centrifuge_report.tsv"
String finalOutputName = if (compressOutput == true) then outputFileName + ".gz" else outputFileName
String? metFileName # If this is specified, the report file is empty
Int? assignments Int? assignments
Int? minHitLen Int? minHitLen
Int? minTotalLen Int? minTotalLen
...@@ -86,17 +90,18 @@ task classify { ...@@ -86,17 +90,18 @@ 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 " + reportFilePath} \ ${"--report-file " + reportFileName} \
${"--min-hitlen " + minHitLen} \ ${"--min-hitlen " + minHitLen} \
${"--min-totallen " + minTotalLen} \ ${"--min-totallen " + minTotalLen} \
${"--met-file " + metFileName} \
${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} \
${true="| gzip -c > " false="-S " compressOutput}${outputFilePath}${true=".gz" false="" compressOutput} ${true="| gzip -c >" false="-S" compressOutput} ${finalOutputName}
} }
output { output {
File classifiedReads = if (compressOutput) then select_first([outputFilePath + ".gz"]) else select_first([outputFilePath]) File classifiedReads = finalOutputName
File reportFile = select_first([reportFilePath]) File reportFile = reportFileName
} }
runtime { runtime {
...@@ -167,10 +172,9 @@ task downloadTaxonomy { ...@@ -167,10 +172,9 @@ task downloadTaxonomy {
task kreport { task kreport {
String? preCommand String? preCommand
String outputDir
File centrifugeOut File centrifugeOut
Boolean inputIsCompressed Boolean inputIsCompressed
String kreportPath=sub(centrifugeOut, "\\.out.*", "\\.kreport") String kreportFileName=sub(centrifugeOut, "\\.out$|\\.out\\.gz$", "\\.kreport")
String indexPrefix String indexPrefix
Boolean? onlyUnique Boolean? onlyUnique
Boolean? showZeros Boolean? showZeros
...@@ -181,21 +185,22 @@ task kreport { ...@@ -181,21 +185,22 @@ task kreport {
Int? memory Int? memory
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ${preCommand}
centrifuge-kreport \ centrifuge-kreport \
-x ${indexPrefix} \ -x ${indexPrefix} \
${true="--only-unique" false="" onlyUnique} \ ${true="--only-unique" false="" onlyUnique} \
${true="show-zeros" false="" showZeros} \ ${true="--show-zeros" false="" showZeros} \
${true="--is-count-table" false="" isCountTable} \ ${true="--is-count-table" false="" isCountTable} \
${"--min-score " + minScore} \ ${"--min-score " + minScore} \
${"--min-length " + minLength} \ ${"--min-length " + minLength} \
${true="<(zcat " false="" inputIsCompressed}${centrifugeOut}${true=")" false="" inputIsCompressed} \ ${true="<(zcat" false="" inputIsCompressed} ${centrifugeOut}\
> ${kreportPath} ${true=")" false="" inputIsCompressed} \
> ${kreportFileName}
} }
output { output {
File kreport = select_first([kreportPath]) File kreport = kreportFileName
} }
runtime { runtime {
......
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