add module for ariba (#1731)

This commit is contained in:
Robert A. Petit III 2022-06-15 10:18:31 -06:00 committed by GitHub
parent 30f72e2482
commit 1fe4cb942f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 228 additions and 0 deletions

View file

@ -0,0 +1,41 @@
process ARIBA_GETREF {
tag "$db_name"
label 'process_low'
conda (params.enable_conda ? "bioconda::ariba=2.14.6" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ariba:2.14.6--py39h67e14b5_3':
'quay.io/biocontainers/ariba:2.14.6--py39h67e14b5_3' }"
input:
val(db_name)
output:
tuple path("${db_name}.tar.gz"), emit: db
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
"""
# Download, format database, and tarball it
ariba \\
getref \\
${db_name} \\
${db_name}
ariba \\
prepareref \\
-f ${db_name}.fa \\
-m ${db_name}.tsv \\
${db_name}
tar -zcvf ${db_name}.tar.gz ${db_name}/
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ariba: \$(echo \$(ariba version 2>&1) | sed 's/^.*ARIBA version: //;s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,33 @@
name: "ariba_getref"
description: Download and prepare database for Ariba analysis
keywords:
- fastq
- assembly
- resistance
- virulence
tools:
- "ariba":
description: "ARIBA: Antibiotic Resistance Identification By Assembly"
homepage: "https://sanger-pathogens.github.io/ariba/"
documentation: "https://sanger-pathogens.github.io/ariba/"
tool_dev_url: "https://github.com/sanger-pathogens/ariba"
doi: "110.1099/mgen.0.000131"
licence: "['GPL v3']"
input:
- db_name:
type: string
description: A database to setup up for Ariba
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- db:
type: file
description: An Ariba prepared database
pattern: "*.tar.gz"
authors:
- "@rpetit3"

40
modules/ariba/run/main.nf Normal file
View file

@ -0,0 +1,40 @@
process ARIBA_RUN {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::ariba=2.14.6" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ariba:2.14.6--py39h67e14b5_3':
'quay.io/biocontainers/ariba:2.14.6--py39h67e14b5_3' }"
input:
tuple val(meta), path(reads)
each path(db)
output:
tuple val(meta), path("${prefix}/*"), emit: results
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def db_name = db.getName().replace('.tar.gz', '')
"""
tar -xzvf ${db}
ariba \\
run \\
${db_name}/ \\
${reads} \\
${prefix} \\
$args \\
--threads $task.cpus
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ariba: \$(echo \$(ariba version 2>&1) | sed 's/^.*ARIBA version: //;s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,48 @@
name: "ariba_run"
description: Query input FASTQs against Ariba formatted databases
keywords:
- fastq
- assembly
- resistance
- virulence
tools:
- "ariba":
description: "ARIBA: Antibiotic Resistance Identification By Assembly"
homepage: "https://sanger-pathogens.github.io/ariba/"
documentation: "https://sanger-pathogens.github.io/ariba/"
tool_dev_url: "https://github.com/sanger-pathogens/ariba"
doi: "110.1099/mgen.0.000131"
licence: "['GPL v3']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: Paired-end reads in FASTQ format
pattern: "*_R[1|2].{fastq.gz,fq.gz}"
- db:
type: file
description: An Ariba prepared database
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"
- results:
type: file
description: A directory of Ariba analysis outputs
pattern: "*"
authors:
- "@rpetit3"

View file

@ -54,6 +54,14 @@ antismash/antismashlitedownloaddatabases:
- modules/antismash/antismashlitedownloaddatabases/**
- tests/modules/antismash/antismashlitedownloaddatabases/**
ariba/getref:
- modules/ariba/getref/**
- tests/modules/ariba/getref/**
ariba/run:
- modules/ariba/run/**
- tests/modules/ariba/run/**
arriba:
- modules/arriba/**
- tests/modules/arriba/**

View file

@ -0,0 +1,9 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ARIBA_GETREF } from '../../../../modules/ariba/getref/main.nf'
workflow test_ariba_getref {
ARIBA_GETREF ( "card" )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,7 @@
- name: ariba getref test_ariba_getref
command: nextflow run ./tests/modules/ariba/getref -entry test_ariba_getref -c ./tests/config/nextflow.config -c ./tests/modules/ariba/getref/nextflow.config
tags:
- ariba
- ariba/getref
files:
- path: output/ariba/card.tar.gz

View file

@ -0,0 +1,17 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ARIBA_GETREF } from '../../../../modules/ariba/getref/main.nf'
include { ARIBA_RUN } from '../../../../modules/ariba/run/main.nf'
workflow test_ariba_run {
input = [ [ id:'test', single_end:false ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
ARIBA_GETREF ( "card" )
ARIBA_RUN ( input, ARIBA_GETREF.out.db)
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,15 @@
- name: ariba run test_ariba_run
command: nextflow run ./tests/modules/ariba/run -entry test_ariba_run -c ./tests/config/nextflow.config -c ./tests/modules/ariba/run/nextflow.config
tags:
- ariba
- ariba/run
files:
- path: output/ariba/test/assembled_genes.fa.gz
- path: output/ariba/test/assembled_seqs.fa.gz
- path: output/ariba/test/assemblies.fa.gz
- path: output/ariba/test/debug.report.tsv
contains: ["ariba_ref_name", "reads", "free_text", "known_var_change"]
- path: output/ariba/test/report.tsv
contains: ["ariba_ref_name", "reads", "free_text", "known_var_change"]
- path: output/ariba/test/version_info.txt
contains: ["ARIBA", "Python", "OK", "True"]