mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-11-25 20:09:55 +00:00
chore: update krakenuniq
This commit is contained in:
parent
ddcf38de22
commit
af8ce2cbfd
3 changed files with 182 additions and 75 deletions
|
@ -99,7 +99,7 @@
|
||||||
},
|
},
|
||||||
"krakenuniq/preloadedkrakenuniq": {
|
"krakenuniq/preloadedkrakenuniq": {
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"git_sha": "13b9d4854593c03e5e25e8a8f47462542c2c0dd4"
|
"git_sha": "05649975c6611c6e007537a7984e186e12ae03af"
|
||||||
},
|
},
|
||||||
"krona/ktimporttaxonomy": {
|
"krona/ktimporttaxonomy": {
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
|
|
194
modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf
generated
194
modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf
generated
|
@ -1,4 +1,5 @@
|
||||||
process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
|
tag "$meta.id"
|
||||||
label 'process_high'
|
label 'process_high'
|
||||||
|
|
||||||
conda (params.enable_conda ? "bioconda::krakenuniq=1.0.0" : null)
|
conda (params.enable_conda ? "bioconda::krakenuniq=1.0.0" : null)
|
||||||
|
@ -29,25 +30,31 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
def args = task.ext.args ?: ''
|
def args = task.ext.args ?: ''
|
||||||
def args2 = task.ext.args ?: ''
|
def args2 = task.ext.args ?: ''
|
||||||
|
|
||||||
def paired = meta.single_end ? "" : "--paired"
|
def classified = meta.single_end ? '"\${PREFIX}.classified.fastq"' : '"\${PREFIX}.classified#.fastq"'
|
||||||
def classified = meta.single_end ? '"\$PREFIX".classified.fastq' : '"\$PREFIX".classified#.fastq'
|
def unclassified = meta.single_end ? '"\${PREFIX}.unclassified.fastq"' : '"\${PREFIX}.unclassified#.fastq"'
|
||||||
def unclassified = meta.single_end ? '"\$PREFIX".unclassified.fastq' : '"\$PREFIX".unclassified#.fastq'
|
def classified_option = save_output_fastqs ? "--classified-out ${classified}" : ''
|
||||||
def classified_option = save_output_fastqs ? "--classified-out ${classified}" : ""
|
def unclassified_option = save_output_fastqs ? "--unclassified-out ${unclassified}" : ''
|
||||||
def unclassified_option = save_output_fastqs ? "--unclassified-out ${unclassified}" : ""
|
def output_option = save_output ? '--output "\${PREFIX}.krakenuniq.classified.txt"' : ''
|
||||||
def output_option = save_output ? '--output "\$PREFIX".krakenuniq.classified.txt' : ""
|
def report = report_file ? '--report-file "\${PREFIX}.krakenuniq.report.txt"' : ''
|
||||||
def report = report_file ? '--report-file "\$PREFIX".krakenuniq.report.txt' : ""
|
def compress_reads_command = save_output_fastqs ? 'gzip --no-name *.fastq' : ''
|
||||||
def compress_reads_command = save_output_fastqs ? "gzip --no-name *.fastq" : ""
|
if (meta.single_end) {
|
||||||
|
|
||||||
"""
|
"""
|
||||||
krakenuniq \\
|
krakenuniq \\
|
||||||
$args \\
|
|
||||||
--db $db \\
|
--db $db \\
|
||||||
--preload $ram_chunk_size \\
|
--preload \\
|
||||||
--threads $task.cpus
|
--preload-size $ram_chunk_size \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$args
|
||||||
|
|
||||||
|
strip_suffix() {
|
||||||
|
local result=\$1
|
||||||
|
# Strip any file extensions.
|
||||||
|
echo "\${result%%.*}"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "%s\\n" ${fastqs} | while read FASTQ; do \\
|
||||||
|
PREFIX="\$(strip_suffix "\${FASTQ}")"
|
||||||
|
|
||||||
# for fastq in "${fastqs.join('\" \"')}"; do \\
|
|
||||||
for fastq in ${fastqs}; do \\
|
|
||||||
PREFIX=\$(echo \$fastq)
|
|
||||||
krakenuniq \\
|
krakenuniq \\
|
||||||
--db $db \\
|
--db $db \\
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
|
@ -56,9 +63,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
$unclassified_option \\
|
$unclassified_option \\
|
||||||
$classified_option \\
|
$classified_option \\
|
||||||
$output_option \\
|
$output_option \\
|
||||||
$paired \\
|
|
||||||
$args2 \\
|
$args2 \\
|
||||||
\$fastq
|
"\${FASTQ}"
|
||||||
done
|
done
|
||||||
|
|
||||||
$compress_reads_command
|
$compress_reads_command
|
||||||
|
@ -68,29 +74,28 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
|
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
|
||||||
END_VERSIONS
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
|
} else {
|
||||||
stub:
|
|
||||||
def args = task.ext.args ?: ''
|
|
||||||
def args2 = task.ext.args ?: ''
|
|
||||||
|
|
||||||
def paired = meta.single_end ? "" : "--paired"
|
|
||||||
def classified = meta.single_end ? '"\$PREFIX".classified.fastq' : '"\$PREFIX".classified#.fastq'
|
|
||||||
def unclassified = meta.single_end ? '"\$PREFIX".unclassified.fastq' : '"\$PREFIX".unclassified#.fastq'
|
|
||||||
def classified_option = save_output_fastqs ? "--classified-out ${classified}" : ""
|
|
||||||
def unclassified_option = save_output_fastqs ? "--unclassified-out ${unclassified}" : ""
|
|
||||||
def output_option = save_output ? '--output "\$PREFIX".krakenuniq.classified.txt' : ""
|
|
||||||
def report = report_file ? '--report-file "\$PREFIX".krakenuniq.report.txt' : ""
|
|
||||||
def compress_reads_command = save_output_fastqs ? "echo 'gzip --no-name *.fastq'" : ""
|
|
||||||
"""
|
"""
|
||||||
echo "krakenuniq \\
|
krakenuniq \\
|
||||||
$args \\
|
|
||||||
--db $db \\
|
--db $db \\
|
||||||
--preload $ram_chunk_size \\
|
--preload \\
|
||||||
--threads $task.cpus"
|
--preload-size $ram_chunk_size \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$args
|
||||||
|
|
||||||
for fastq in "${fastqs.join('\" \"')}"; do \\
|
strip_suffix() {
|
||||||
PREFIX=\$(echo \$fastq)
|
local result
|
||||||
echo "krakenuniq \\
|
read result
|
||||||
|
# Strip any trailing dot or underscore.
|
||||||
|
result="\${result%_}"
|
||||||
|
echo "\${result%.}"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "%s %s\\n" ${fastqs} | while read FASTQ; do \\
|
||||||
|
read -r -a FASTQ <<< "\${FASTQ}"
|
||||||
|
PREFIX="\$(printf "%s\\n" "\${FASTQ[@]}" | sed -e 'N;s/^\\(.*\\).*\\n\\1.*\$/\\1\\n\\1/;D' | strip_suffix)"
|
||||||
|
|
||||||
|
krakenuniq \\
|
||||||
--db $db \\
|
--db $db \\
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
$report \\
|
$report \\
|
||||||
|
@ -98,14 +103,9 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
$unclassified_option \\
|
$unclassified_option \\
|
||||||
$classified_option \\
|
$classified_option \\
|
||||||
$output_option \\
|
$output_option \\
|
||||||
$paired \\
|
--paired \\
|
||||||
$args2 \\
|
$args2 \\
|
||||||
\$fastq"
|
"\${FASTQ[@]}"
|
||||||
|
|
||||||
touch "\$PREFIX".classified.fastq.gz
|
|
||||||
touch "\$PREFIX".krakenuniq.classified.txt
|
|
||||||
touch "\$PREFIX".krakenuniq.report.txt
|
|
||||||
touch "\$PREFIX".unclassified.fastq.gz
|
|
||||||
done
|
done
|
||||||
|
|
||||||
$compress_reads_command
|
$compress_reads_command
|
||||||
|
@ -116,3 +116,109 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
|
||||||
END_VERSIONS
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stub:
|
||||||
|
def args = task.ext.args ?: ''
|
||||||
|
def args2 = task.ext.args ?: ''
|
||||||
|
|
||||||
|
def classified = meta.single_end ? '"\${PREFIX}.classified.fastq"' : '"\${PREFIX}.classified#.fastq"'
|
||||||
|
def unclassified = meta.single_end ? '"\${PREFIX}.unclassified.fastq"' : '"\${PREFIX}.unclassified#.fastq"'
|
||||||
|
def classified_option = save_output_fastqs ? "--classified-out ${classified}" : ''
|
||||||
|
def unclassified_option = save_output_fastqs ? "--unclassified-out ${unclassified}" : ''
|
||||||
|
def output_option = save_output ? '--output "\${PREFIX}.krakenuniq.classified.txt"' : ''
|
||||||
|
def report = report_file ? '--report-file "\${PREFIX}.krakenuniq.report.txt"' : ''
|
||||||
|
def compress_reads_command = save_output_fastqs ? 'gzip --no-name *.fastq' : ''
|
||||||
|
if (meta.single_end) {
|
||||||
|
"""
|
||||||
|
echo krakenuniq \\
|
||||||
|
--db $db \\
|
||||||
|
--preload \\
|
||||||
|
--preload-size $ram_chunk_size \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$args
|
||||||
|
|
||||||
|
strip_suffix() {
|
||||||
|
local result=\$1
|
||||||
|
# Strip any file extensions.
|
||||||
|
echo "\${result%%.*}"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "%s\\n" ${fastqs} | while read FASTQ; do \\
|
||||||
|
echo "\${FASTQ}"
|
||||||
|
PREFIX="\$(strip_suffix "\${FASTQ}")"
|
||||||
|
echo "\${PREFIX}"
|
||||||
|
|
||||||
|
echo krakenuniq \\
|
||||||
|
--db $db \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$report \\
|
||||||
|
$output_option \\
|
||||||
|
$unclassified_option \\
|
||||||
|
$classified_option \\
|
||||||
|
$output_option \\
|
||||||
|
$args2 \\
|
||||||
|
"\${FASTQ}"
|
||||||
|
|
||||||
|
touch "\${PREFIX}.classified.fastq.gz"
|
||||||
|
touch "\${PREFIX}.krakenuniq.classified.txt"
|
||||||
|
touch "\${PREFIX}.krakenuniq.report.txt"
|
||||||
|
touch "\${PREFIX}.unclassified.fastq.gz"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $compress_reads_command
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
|
"""
|
||||||
|
echo krakenuniq \\
|
||||||
|
--db $db \\
|
||||||
|
--preload \\
|
||||||
|
--preload-size $ram_chunk_size \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$args
|
||||||
|
|
||||||
|
strip_suffix() {
|
||||||
|
local result
|
||||||
|
read result
|
||||||
|
# Strip any trailing dot or underscore.
|
||||||
|
result="\${result%_}"
|
||||||
|
echo "\${result%.}"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "%s %s\\n" ${fastqs} | while read FASTQ; do \\
|
||||||
|
read -r -a FASTQ <<< "\${FASTQ}"
|
||||||
|
echo "\${FASTQ[@]}"
|
||||||
|
PREFIX="\$(printf "%s\\n" "\${FASTQ[@]}" | sed -e 'N;s/^\\(.*\\).*\\n\\1.*\$/\\1\\n\\1/;D' | strip_suffix)"
|
||||||
|
echo "\${PREFIX}"
|
||||||
|
|
||||||
|
echo krakenuniq \\
|
||||||
|
--db $db \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
$report \\
|
||||||
|
$output_option \\
|
||||||
|
$unclassified_option \\
|
||||||
|
$classified_option \\
|
||||||
|
$output_option \\
|
||||||
|
--paired \\
|
||||||
|
$args2 \\
|
||||||
|
"\${FASTQ[@]}"
|
||||||
|
|
||||||
|
touch "\${PREFIX}.classified_1.fastq.gz" "\${PREFIX}.classified_2.fastq.gz"
|
||||||
|
touch "\${PREFIX}.krakenuniq.classified.txt"
|
||||||
|
touch "\${PREFIX}.krakenuniq.report.txt"
|
||||||
|
touch "\${PREFIX}.unclassified_1.fastq.gz" "\${PREFIX}.unclassified_2.fastq.gz"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $compress_reads_command
|
||||||
|
|
||||||
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
"${task.process}":
|
||||||
|
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
|
||||||
|
END_VERSIONS
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -51,13 +51,13 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Reads classified as belonging to any of the taxa
|
Reads classified as belonging to any of the taxa
|
||||||
on the KrakenUniq database.
|
on the KrakenUniq database.
|
||||||
pattern: "*{fastq.gz}"
|
pattern: "*.fastq.gz"
|
||||||
- unclassified_reads_fastq:
|
- unclassified_reads_fastq:
|
||||||
type: file
|
type: file
|
||||||
description: |
|
description: |
|
||||||
Reads not classified to any of the taxa
|
Reads not classified to any of the taxa
|
||||||
on the KrakenUniq database.
|
on the KrakenUniq database.
|
||||||
pattern: "*{fastq.gz}"
|
pattern: "*.fastq.gz"
|
||||||
- classified_assignment:
|
- classified_assignment:
|
||||||
type: file
|
type: file
|
||||||
description: |
|
description: |
|
||||||
|
@ -68,10 +68,11 @@ output:
|
||||||
description: |
|
description: |
|
||||||
KrakenUniq report containing stats about classified
|
KrakenUniq report containing stats about classified
|
||||||
and not classifed reads.
|
and not classifed reads.
|
||||||
pattern: "*.{report.txt}"
|
pattern: "*.report.txt"
|
||||||
- versions:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software versions
|
description: File containing software versions
|
||||||
pattern: "versions.yml"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@mjamy"
|
- "@mjamy"
|
||||||
|
- "@Midnighter"
|
||||||
|
|
Loading…
Reference in a new issue