Skip to content
Snippets Groups Projects
Commit 37f0afb7 authored by Ruben Vorderman's avatar Ruben Vorderman
Browse files

centrifuge to 1.0

parent 1c1f8955
No related branches found
No related tags found
1 merge request!34Move all files to version 1.0
version 1.0
# Copyright Sequencing Analysis Support Core - Leiden University Medical Center 2018 # Copyright Sequencing Analysis Support Core - Leiden University Medical Center 2018
# #
# Tasks from centrifuge # Tasks from centrifuge
task Build { task Build {
File conversionTable input {
File taxonomyTree File conversionTable
File inputFasta File taxonomyTree
String centrifugeIndexBase File inputFasta
String? preCommand String centrifugeIndexBase
String? centrifugeBuildExecutable = "centrifuge-build" String? preCommand
#Boolean? c = false String? centrifugeBuildExecutable = "centrifuge-build"
Boolean? largeIndex = false #Boolean? c = false
Boolean? noAuto = false Boolean? largeIndex = false
Int? bMax Boolean? noAuto = false
Int? bMaxDivn Int? bMax
Boolean? noDiffCover = false Int? bMaxDivn
Boolean? noRef = false Boolean? noDiffCover = false
Boolean? justRef = false Boolean? noRef = false
Int? offRate Boolean? justRef = false
Int? fTabChars Int? offRate
File? nameTable Int? fTabChars
File? sizeTable File? nameTable
Int? seed File? sizeTable
Int? kmerCount Int? seed
Int? kmerCount
Int? threads
Int? memory Int? threads
Int? memory
}
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ~{preCommand}
${"mkdir -p $(dirname " + centrifugeIndexBase + ")"} ~{"mkdir -p $(dirname " + centrifugeIndexBase + ")"}
${centrifugeBuildExecutable} \ ~{centrifugeBuildExecutable} \
${true='--large-index' false='' largeIndex} \ ~{true='--large-index' false='' largeIndex} \
${true='--noauto' false='' noAuto} \ ~{true='--noauto' false='' noAuto} \
${'--bmax ' + bMax} \ ~{'--bmax ' + bMax} \
${'--bmaxdivn ' + bMaxDivn} \ ~{'--bmaxdivn ' + bMaxDivn} \
${true='--nodc' false='' noDiffCover} \ ~{true='--nodc' false='' noDiffCover} \
${true='--noref' false='' noRef} \ ~{true='--noref' false='' noRef} \
${true='--justref' false='' justRef} \ ~{true='--justref' false='' justRef} \
${'--offrate ' + offRate} \ ~{'--offrate ' + offRate} \
${'--ftabchars ' + fTabChars} \ ~{'--ftabchars ' + fTabChars} \
${'--name-table ' + nameTable } \ ~{'--name-table ' + nameTable } \
${'--size-table ' + sizeTable} \ ~{'--size-table ' + sizeTable} \
${'--seed ' + seed} \ ~{'--seed ' + seed} \
${'--kmer-count' + kmerCount} \ ~{'--kmer-count' + kmerCount} \
${'--threads ' + threads} \ ~{'--threads ' + threads} \
--conversion-table ${conversionTable} \ --conversion-table ~{conversionTable} \
--taxonomy-tree ${taxonomyTree} \ --taxonomy-tree ~{taxonomyTree} \
${inputFasta} \ ~{inputFasta} \
${centrifugeIndexBase} ~{centrifugeIndexBase}
} }
runtime { runtime {
cpu: select_first([threads, 8]) cpu: select_first([threads, 8])
...@@ -57,49 +59,53 @@ task Build { ...@@ -57,49 +59,53 @@ task Build {
} }
task Classify { task Classify {
String outputDir input {
Boolean? compressOutput = true String outputDir
String? preCommand Boolean? compressOutput = true
String indexPrefix String? preCommand
Array[File]? unpairedReads String indexPrefix
Array[File]+ read1 Array[File]? unpairedReads
Array[File]? read2 Array[File]+ read1
Boolean? fastaInput Array[File]? read2
# Variables for handling output Boolean? fastaInput
# Variables for handling output
String? metFilePath # If this is specified, the report file is empty
Int? assignments
Int? minHitLen
Int? minTotalLen
Array[String]? hostTaxIds
Array[String]? excludeTaxIds
Int? threads
Int? memory
}
String outputFilePath = outputDir + "/centrifuge.out" String outputFilePath = outputDir + "/centrifuge.out"
String reportFilePath = outputDir + "/centrifuge_report.tsv" String reportFilePath = outputDir + "/centrifuge_report.tsv"
String finalOutputPath = if (compressOutput == true) String finalOutputPath = if (compressOutput == true)
then outputFilePath + ".gz" then outputFilePath + ".gz"
else outputFilePath else outputFilePath
String? metFilePath # If this is specified, the report file is empty
Int? assignments
Int? minHitLen
Int? minTotalLen
Array[String]? hostTaxIds
Array[String]? excludeTaxIds
Int? threads
Int? memory
command { command {
set -e -o pipefail set -e -o pipefail
mkdir -p ${outputDir} mkdir -p ~{outputDir}
${preCommand} ~{preCommand}
centrifuge \ centrifuge \
${"-p " + select_first([threads, 4])} \ ~{"-p " + select_first([threads, 4])} \
${"-x " + indexPrefix} \ ~{"-x " + indexPrefix} \
${true="-f" false="" fastaInput} \ ~{true="-f" false="" fastaInput} \
${true="-k" false="" defined(assignments)} ${assignments} \ ~{true="-k" false="" defined(assignments)} ~{assignments} \
${true="-1" false="-U" defined(read2)} ${sep=',' read1} \ ~{true="-1" false="-U" defined(read2)} ~{sep=',' read1} \
${true="-2" false="" defined(read2)} ${sep=',' read2} \ ~{true="-2" false="" defined(read2)} ~{sep=',' read2} \
${true="-U" false="" defined(unpairedReads)} ${sep=',' unpairedReads} \ ~{true="-U" false="" defined(unpairedReads)} ~{sep=',' unpairedReads} \
${"--report-file " + reportFilePath} \ ~{"--report-file " + reportFilePath} \
${"--min-hitlen " + minHitLen} \ ~{"--min-hitlen " + minHitLen} \
${"--min-totallen " + minTotalLen} \ ~{"--min-totallen " + minTotalLen} \
${"--met-file " + metFilePath} \ ~{"--met-file " + metFilePath} \
${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} ${finalOutputPath} ~{true="| gzip -c >" false="-S" compressOutput} ~{finalOutputPath}
} }
output { output {
...@@ -114,58 +120,60 @@ task Classify { ...@@ -114,58 +120,60 @@ task Classify {
} }
task Download { task Download {
String libraryPath input {
Array[String]? domain String libraryPath
String? executable = "centrifuge-download" Array[String]? domain
String? preCommand String? executable = "centrifuge-download"
String? seqTaxMapPath String? preCommand
String? database = "refseq" String? seqTaxMapPath
String? assemblyLevel String? database = "refseq"
String? refseqCategory String? assemblyLevel
Array[String]? taxIds String? refseqCategory
Boolean? filterUnplaced = false Array[String]? taxIds
Boolean? maskLowComplexRegions = false Boolean? filterUnplaced = false
Boolean? downloadRnaSeqs = false Boolean? maskLowComplexRegions = false
Boolean? modifyHeader = false Boolean? downloadRnaSeqs = false
Boolean? downloadGiMap = false Boolean? modifyHeader = false
Boolean? downloadGiMap = false
}
# This will use centrifuge-download to download. # This will use centrifuge-download to download.
# The bash statement at the beginning is to make sure # The bash statement at the beginning is to make sure
# the directory for the SeqTaxMapPath exists. # the directory for the SeqTaxMapPath exists.
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ~{preCommand}
${"mkdir -p $(dirname " + seqTaxMapPath + ")"} ~{"mkdir -p $(dirname " + seqTaxMapPath + ")"}
${executable} \ ~{executable} \
-o ${libraryPath} \ -o ~{libraryPath} \
${true='-d ' false='' defined(domain)}${sep=',' domain} \ ~{true='-d ' false='' defined(domain)}~{sep=',' domain} \
${'-a "' + assemblyLevel + '"'} \ ~{'-a "' + assemblyLevel + '"'} \
${"-c " + refseqCategory} \ ~{"-c " + refseqCategory} \
${true='-t' false='' defined(taxIds)} '${sep=',' taxIds}' \ ~{true='-t' false='' defined(taxIds)} '~{sep=',' taxIds}' \
${true='-r' false='' downloadRnaSeqs} \ ~{true='-r' false='' downloadRnaSeqs} \
${true='-u' false='' filterUnplaced} \ ~{true='-u' false='' filterUnplaced} \
${true='-m' false='' maskLowComplexRegions} \ ~{true='-m' false='' maskLowComplexRegions} \
${true='-l' false='' modifyHeader} \ ~{true='-l' false='' modifyHeader} \
${true='-g' false='' downloadGiMap} \ ~{true='-g' false='' downloadGiMap} \
${database} ${">> " + seqTaxMapPath} ~{database} ~{">> " + seqTaxMapPath}
} }
output { output {
File seqTaxMap = "${seqTaxMapPath}" File seqTaxMap = "~{seqTaxMapPath}"
File library = libraryPath File library = libraryPath
Array[File] fastaFiles = glob(libraryPath + "/*/*.fna") Array[File] fastaFiles = glob(libraryPath + "/*/*.fna")
} }
} }
task DownloadTaxonomy { task DownloadTaxonomy {
String centrifugeTaxonomyDir input {
String? executable = "centrifuge-download" String centrifugeTaxonomyDir
String? preCommand String? executable = "centrifuge-download"
String? preCommand
}
command { command {
set -e -o pipefail set -e -o pipefail
${preCommand} ~{preCommand}
${executable} \ ~{executable} \
-o ${centrifugeTaxonomyDir} \ -o ~{centrifugeTaxonomyDir} \
taxonomy taxonomy
} }
...@@ -176,36 +184,37 @@ task DownloadTaxonomy { ...@@ -176,36 +184,37 @@ task DownloadTaxonomy {
} }
task Kreport { task Kreport {
String? preCommand input {
File centrifugeOut String? preCommand
Boolean inputIsCompressed File centrifugeOut
String outputDir Boolean inputIsCompressed
String? suffix = "kreport" String outputDir
String? prefix = "centrifuge" String? suffix = "kreport"
String? prefix = "centrifuge"
String indexPrefix
Boolean? onlyUnique
Boolean? showZeros
Boolean? isCountTable
Int? minScore
Int? minLength
Int? cores
Int? memory
}
String kreportFilePath = outputDir + "/" + prefix + "." + suffix String kreportFilePath = outputDir + "/" + prefix + "." + suffix
String indexPrefix
Boolean? onlyUnique
Boolean? showZeros
Boolean? isCountTable
Int? minScore
Int? minLength
Int? cores
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="<(zcat" false="" inputIsCompressed} ~{centrifugeOut}\
${true=")" false="" inputIsCompressed} \ ~{true=")" false="" inputIsCompressed} \
> ${kreportFilePath} > ~{kreportFilePath}
} }
output { output {
......
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