mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
add amrfinderplus module (#1284)
* add amrfinderplus module * Update test.yml * Update main.nf * Update main.nf * Update test.yml * Update test.yml * Update test.yml * Update main.nf * Update meta.yml * Update meta.yml * Update main.nf * Update test.yml * Update test.yml
This commit is contained in:
parent
a0d91e4a93
commit
15d39f841a
11 changed files with 238 additions and 0 deletions
55
modules/amrfinderplus/run/main.nf
Normal file
55
modules/amrfinderplus/run/main.nf
Normal file
|
@ -0,0 +1,55 @@
|
|||
process AMRFINDERPLUS_RUN {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::ncbi-amrfinderplus=3.10.23" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/ncbi-amrfinderplus%3A3.10.23--h17dc2d4_0':
|
||||
'quay.io/biocontainers/ncbi-amrfinderplus:3.10.23--h17dc2d4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fasta)
|
||||
path db
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${prefix}.tsv") , emit: report
|
||||
tuple val(meta), path("${prefix}-mutations.tsv"), emit: mutation_report, optional: true
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
when:
|
||||
task.ext.when == null || task.ext.when
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def is_compressed = fasta.getName().endsWith(".gz") ? true : false
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
organism_param = meta.containsKey("organism") ? "--organism ${meta.organism} --mutation_all ${prefix}-mutations.tsv" : ""
|
||||
fasta_name = fasta.getName().replace(".gz", "")
|
||||
fasta_param = "-n"
|
||||
if (meta.containsKey("is_proteins")) {
|
||||
if (meta.is_proteins) {
|
||||
fasta_param = "-p"
|
||||
}
|
||||
}
|
||||
"""
|
||||
if [ "$is_compressed" == "true" ]; then
|
||||
gzip -c -d $fasta > $fasta_name
|
||||
fi
|
||||
|
||||
mkdir amrfinderdb
|
||||
tar xzvf $db -C amrfinderdb
|
||||
|
||||
amrfinder \\
|
||||
$fasta_param $fasta_name \\
|
||||
$organism_param \\
|
||||
$args \\
|
||||
--database amrfinderdb \\
|
||||
--threads $task.cpus > ${prefix}.tsv
|
||||
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
amrfinderplus: \$(amrfinder --version)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
51
modules/amrfinderplus/run/meta.yml
Normal file
51
modules/amrfinderplus/run/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
name: amrfinderplus_run
|
||||
description: Identify antimicrobial resistance in gene or protein sequences
|
||||
keywords:
|
||||
- bacteria
|
||||
- fasta
|
||||
- antibiotic resistance
|
||||
tools:
|
||||
- amrfinderplus:
|
||||
description: AMRFinderPlus finds antimicrobial resistance and other genes in protein or nucleotide sequences.
|
||||
homepage: https://github.com/ncbi/amr/wiki
|
||||
documentation: https://github.com/ncbi/amr/wiki
|
||||
tool_dev_url: https://github.com/ncbi/amr
|
||||
doi: "10.1038/s41598-021-91456-0"
|
||||
licence: ['Public Domain']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- fasta:
|
||||
type: file
|
||||
description: Nucleotide or protein sequences in FASTA format
|
||||
pattern: "*.{fasta,fasta.gz,fa,fa.gz,fna,fna.gz,faa,faa.gz}"
|
||||
- db:
|
||||
type: file
|
||||
description: A compressed tarball of the AMRFinderPlus database to query
|
||||
pattern: "*.tar.gz"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- report:
|
||||
type: file
|
||||
description: AMRFinder+ final report
|
||||
pattern: "*.tsv"
|
||||
- mutation_report:
|
||||
type: file
|
||||
description: Report of organism-specific point-mutations
|
||||
pattern: "*-mutations.tsv"
|
||||
|
||||
authors:
|
||||
- "@rpetit3"
|
29
modules/amrfinderplus/update/main.nf
Normal file
29
modules/amrfinderplus/update/main.nf
Normal file
|
@ -0,0 +1,29 @@
|
|||
process AMRFINDERPLUS_UPDATE {
|
||||
tag "update"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::ncbi-amrfinderplus=3.10.23" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/ncbi-amrfinderplus%3A3.10.23--h17dc2d4_0':
|
||||
'quay.io/biocontainers/ncbi-amrfinderplus:3.10.23--h17dc2d4_0' }"
|
||||
|
||||
output:
|
||||
path "amrfinderdb.tar.gz", emit: db
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
when:
|
||||
task.ext.when == null || task.ext.when
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
"""
|
||||
mkdir amrfinderdb
|
||||
amrfinder_update -d amrfinderdb
|
||||
tar czvf amrfinderdb.tar.gz -C \$(readlink amrfinderdb/latest) ./
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
amrfinderplus: \$(amrfinder --version)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
37
modules/amrfinderplus/update/meta.yml
Normal file
37
modules/amrfinderplus/update/meta.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
name: amrfinderplus_update
|
||||
description: Identify antimicrobial resistance in gene or protein sequences
|
||||
keywords:
|
||||
- bacteria
|
||||
- fasta
|
||||
- antibiotic resistance
|
||||
tools:
|
||||
- amrfinderplus:
|
||||
description: AMRFinderPlus finds antimicrobial resistance and other genes in protein or nucleotide sequences.
|
||||
homepage: https://github.com/ncbi/amr/wiki
|
||||
documentation: https://github.com/ncbi/amr/wiki
|
||||
tool_dev_url: https://github.com/ncbi/amr
|
||||
doi: "10.1038/s41598-021-91456-0"
|
||||
licence: ['Public Domain']
|
||||
|
||||
input:
|
||||
- input_not_required:
|
||||
type: null
|
||||
description: module does not have an input
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- db:
|
||||
type: file
|
||||
description: The latest AMRFinder+ database in a compressed tarball
|
||||
pattern: "*.tar.gz"
|
||||
|
||||
authors:
|
||||
- "@rpetit3"
|
|
@ -26,6 +26,14 @@ amps:
|
|||
- modules/amps/**
|
||||
- tests/modules/amps/**
|
||||
|
||||
amrfinderplus/run:
|
||||
- modules/amrfinderplus/run/**
|
||||
- tests/modules/amrfinderplus/run/**
|
||||
|
||||
amrfinderplus/update:
|
||||
- modules/amrfinderplus/update/**
|
||||
- tests/modules/amrfinderplus/update/**
|
||||
|
||||
arriba:
|
||||
- modules/arriba/**
|
||||
- tests/modules/arriba/**
|
||||
|
|
17
tests/modules/amrfinderplus/run/main.nf
Normal file
17
tests/modules/amrfinderplus/run/main.nf
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { AMRFINDERPLUS_UPDATE } from '../../../../modules/amrfinderplus/update/main.nf'
|
||||
include { AMRFINDERPLUS_RUN } from '../../../../modules/amrfinderplus/run/main.nf'
|
||||
|
||||
workflow test_amrfinderplus_run {
|
||||
|
||||
input = [
|
||||
[ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['haemophilus_influenzae']['genome']['genome_fna_gz'], checkIfExists: true)
|
||||
]
|
||||
|
||||
AMRFINDERPLUS_UPDATE ( )
|
||||
AMRFINDERPLUS_RUN ( input, AMRFINDERPLUS_UPDATE.out.db )
|
||||
}
|
5
tests/modules/amrfinderplus/run/nextflow.config
Normal file
5
tests/modules/amrfinderplus/run/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
process {
|
||||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
11
tests/modules/amrfinderplus/run/test.yml
Normal file
11
tests/modules/amrfinderplus/run/test.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: amrfinderplus run test_amrfinderplus_run
|
||||
command: nextflow run tests/modules/amrfinderplus/run -entry test_amrfinderplus_run -c tests/config/nextflow.config
|
||||
tags:
|
||||
- amrfinderplus/run
|
||||
- amrfinderplus
|
||||
files:
|
||||
- path: output/amrfinderplus/amrfinderdb.tar.gz
|
||||
- path: output/amrfinderplus/test.tsv
|
||||
md5sum: b4d261ace9be7d013c19d1f5c0005bfe
|
||||
- path: output/amrfinderplus/versions.yml
|
||||
md5sum: 642ca04a07d79fe4c4d02348562e3961
|
11
tests/modules/amrfinderplus/update/main.nf
Normal file
11
tests/modules/amrfinderplus/update/main.nf
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { AMRFINDERPLUS_UPDATE } from '../../../../modules/amrfinderplus/update/main.nf'
|
||||
|
||||
workflow test_amrfinderplus_update {
|
||||
|
||||
AMRFINDERPLUS_UPDATE ( )
|
||||
|
||||
}
|
5
tests/modules/amrfinderplus/update/nextflow.config
Normal file
5
tests/modules/amrfinderplus/update/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
process {
|
||||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
9
tests/modules/amrfinderplus/update/test.yml
Normal file
9
tests/modules/amrfinderplus/update/test.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
- name: amrfinderplus update test_amrfinderplus_update
|
||||
command: nextflow run tests/modules/amrfinderplus/update -entry test_amrfinderplus_update -c tests/config/nextflow.config
|
||||
tags:
|
||||
- amrfinderplus
|
||||
- amrfinderplus/update
|
||||
files:
|
||||
- path: output/amrfinderplus/amrfinderdb.tar.gz
|
||||
- path: output/amrfinderplus/versions.yml
|
||||
md5sum: 4db18fa509309db4da0920a7eeaba86c
|
Loading…
Reference in a new issue