1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-09-21 11:02:03 +00:00

chore: update krakenuniq

This commit is contained in:
Moritz E. Beber 2022-11-29 10:27:35 +01:00
parent ddcf38de22
commit af8ce2cbfd
3 changed files with 182 additions and 75 deletions

View file

@ -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",

View file

@ -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,90 +30,195 @@ 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 \\
$args \\
--db $db \\
--preload $ram_chunk_size \\
--threads $task.cpus
# for fastq in "${fastqs.join('\" \"')}"; do \\
for fastq in ${fastqs}; do \\
PREFIX=\$(echo \$fastq)
krakenuniq \\ krakenuniq \\
--db $db \\ --db $db \\
--preload \\
--preload-size $ram_chunk_size \\
--threads $task.cpus \\ --threads $task.cpus \\
$report \\ $args
$output_option \\
$unclassified_option \\
$classified_option \\
$output_option \\
$paired \\
$args2 \\
\$fastq
done
$compress_reads_command strip_suffix() {
local result=\$1
# Strip any file extensions.
echo "\${result%%.*}"
}
cat <<-END_VERSIONS > versions.yml printf "%s\\n" ${fastqs} | while read FASTQ; do \\
"${task.process}": PREFIX="\$(strip_suffix "\${FASTQ}")"
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
END_VERSIONS krakenuniq \\
""" --db $db \\
--threads $task.cpus \\
$report \\
$output_option \\
$unclassified_option \\
$classified_option \\
$output_option \\
$args2 \\
"\${FASTQ}"
done
$compress_reads_command
cat <<-END_VERSIONS > versions.yml
"${task.process}":
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
END_VERSIONS
"""
} else {
"""
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}"
PREFIX="\$(printf "%s\\n" "\${FASTQ[@]}" | sed -e 'N;s/^\\(.*\\).*\\n\\1.*\$/\\1\\n\\1/;D' | strip_suffix)"
krakenuniq \\
--db $db \\
--threads $task.cpus \\
$report \\
$output_option \\
$unclassified_option \\
$classified_option \\
$output_option \\
--paired \\
$args2 \\
"\${FASTQ[@]}"
done
$compress_reads_command
cat <<-END_VERSIONS > versions.yml
"${task.process}":
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//')
END_VERSIONS
"""
}
stub: stub:
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 ? "echo 'gzip --no-name *.fastq'" : "" if (meta.single_end) {
""" """
echo "krakenuniq \\ echo krakenuniq \\
$args \\
--db $db \\
--preload $ram_chunk_size \\
--threads $task.cpus"
for fastq in "${fastqs.join('\" \"')}"; do \\
PREFIX=\$(echo \$fastq)
echo "krakenuniq \\
--db $db \\ --db $db \\
--preload \\
--preload-size $ram_chunk_size \\
--threads $task.cpus \\ --threads $task.cpus \\
$report \\ $args
$output_option \\
$unclassified_option \\
$classified_option \\
$output_option \\
$paired \\
$args2 \\
\$fastq"
touch "\$PREFIX".classified.fastq.gz strip_suffix() {
touch "\$PREFIX".krakenuniq.classified.txt local result=\$1
touch "\$PREFIX".krakenuniq.report.txt # Strip any file extensions.
touch "\$PREFIX".unclassified.fastq.gz echo "\${result%%.*}"
done }
$compress_reads_command printf "%s\\n" ${fastqs} | while read FASTQ; do \\
echo "\${FASTQ}"
PREFIX="\$(strip_suffix "\${FASTQ}")"
echo "\${PREFIX}"
cat <<-END_VERSIONS > versions.yml echo krakenuniq \\
"${task.process}": --db $db \\
krakenuniq: \$(echo \$(krakenuniq --version 2>&1) | sed 's/^.*KrakenUniq version //; s/ .*\$//') --threads $task.cpus \\
END_VERSIONS $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
"""
}
} }

View file

@ -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"