1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 00:46:04 +00:00

Install krakenuniq module

This commit is contained in:
Mahwash Jamy 2022-10-25 09:26:33 +00:00
parent 4f27998852
commit 36e101a78b
2 changed files with 195 additions and 0 deletions

View file

@ -0,0 +1,118 @@
process KRAKENUNIQ_PRELOADEDKRAKENUNIQ {
tag "$meta.id"
label 'process_high'
conda (params.enable_conda ? "bioconda::krakenuniq=1.0.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/krakenuniq:1.0.0--pl5321h19e8d03_0':
'quay.io/biocontainers/krakenuniq:1.0.0--pl5321h19e8d03_0' }"
input:
tuple val(meta), path(fastqs)
path db
val ram_chunk_size
val save_output_fastqs
val report_file
val save_output
output:
tuple val(meta), path('*.classified{.,_}*') , optional:true, emit: classified_reads_fastq
tuple val(meta), path('*.unclassified{.,_}*') , optional:true, emit: unclassified_reads_fastq
tuple val(meta), path('*classified.txt') , optional:true, emit: classified_assignment
tuple val(meta), path('*report.txt') , emit: report
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
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 ? "gzip --no-name *.fastq" : ""
"""
krakenuniq \\
$args \\
--db $db \\
--preload $ram_chunk_size \\
--threads $task.cpus
for fastq in ${fastqs.join(' ')}; do \\
PREFIX=\$(echo \$fastq)
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:
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 \\
$args \\
--db $db \\
--preload $ram_chunk_size \\
--threads $task.cpus"
for fastq in ${fastqs.join(' ')}; do \\
PREFIX=\$(echo \$fastq)
echo "krakenuniq \\
--db $db \\
--threads $task.cpus \\
$report \\
$output_option \\
$unclassified_option \\
$classified_option \\
$output_option \\
$paired \\
$args2 \\
\$fastq"
touch "\$PREFIX".classified.fastq.gz
touch "\$PREFIX".krakenuniq.classified.txt
touch "\$PREFIX".krakenuniq.report.txt
touch "\$PREFIX".unclassified.fastq.gz
done
$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

@ -0,0 +1,77 @@
name: "krakenuniq_preloadedkrakenuniq"
description: Classifies metagenomic sequence data using unique k-mer counts
keywords:
- classify
- metagenomics
- kmers
- fastq
- db
tools:
- "krakenuniq":
description: "Metagenomics classifier with unique k-mer counting for more specific results"
homepage: https://github.com/fbreitwieser/krakenuniq
documentation: https://github.com/fbreitwieser/krakenuniq
doi: 10.1186/s13059-018-1568-0
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fastqs:
type: file
description: List of input FastQ files
- db:
type: directory
description: KrakenUniq database
- ram_chunk_size:
type: val
description: Amount of maximum amount of RAM each chunk of database that should be loaded at any one time
pattern: "*GB"
- save_output_fastqs:
type: boolean
description: |
If true, optional commands are added to save classified and unclassified reads
as fastq files
- save_reads_assignment:
type: boolean
description: |
If true, an optional command is added to save a file reporting the taxonomic
classification of each input read
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- classified_reads_fastq:
type: file
description: |
Reads classified as belonging to any of the taxa
on the KrakenUniq database.
pattern: "*{fastq.gz}"
- unclassified_reads_fastq:
type: file
description: |
Reads not classified to any of the taxa
on the KrakenUniq database.
pattern: "*{fastq.gz}"
- classified_assignment:
type: file
description: |
KrakenUniq output file indicating the taxonomic assignment of
each input read ## DOUBLE CHECK!!
- report:
type: file
description: |
KrakenUniq report containing stats about classified
and not classifed reads.
pattern: "*.{report.txt}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@mjamy"