-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First attempt to include download of databases * Update module files + add nf-test (almost working) * Added stub + snapshot file + many fixes * Make rgi/main work with CARD download * Fix linting * Update depency `hamronization/rgi` * Fix command in `main.nf` * Fix `hamronization/rgi` accordingly * Removed DB download functionality * Removed hamronization/rgi non-stub test * Update meta.yml * Add module rgi/cardannotation (not working yet) * Make rgi/main tests work incl. dependency rgi/cardannotation * Fix hamronization/rgi tests * Update rgi/cardannotation snapfile * Apply suggestions from code review
- Loading branch information
Showing
18 changed files
with
640 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: rgi_cardannotation | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
dependencies: | ||
- bioconda::rgi=6.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
process RGI_CARDANNOTATION { | ||
label 'process_medium' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/rgi:6.0.3--pyha8f3691_0': | ||
'biocontainers/rgi:6.0.3--pyha8f3691_0' }" | ||
|
||
input: | ||
path(card) | ||
|
||
output: | ||
path("card_database_processed") , emit: db | ||
env RGI_VERSION , emit: tool_version | ||
env DB_VERSION , emit: db_version | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
|
||
""" | ||
rgi card_annotation \\ | ||
-i ${card}/card.json \\ | ||
$args | ||
DB_VERSION=\$(ls card_database_*_all.fasta | sed "s/card_database_v\\([0-9].*[0-9]\\).*/\\1/") | ||
mkdir card_database_processed | ||
mv card*.fasta card_database_processed | ||
cp ${card}/* card_database_processed | ||
RGI_VERSION=\$(rgi main --version) | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
rgi: \$(echo \$RGI_VERSION) | ||
rgi-database: \$(echo \$DB_VERSION) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
""" | ||
touch card.fasta | ||
touch card_all.fasta | ||
mkdir card_database_processed | ||
mv card*.fasta card_database_processed | ||
RGI_VERSION=\$(rgi main --version) | ||
DB_VERSION=stub_version | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
rgi: \$(echo \$RGI_VERSION) | ||
rgi-database: \$(echo \$DB_VERSION) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: rgi_cardannotation | ||
description: Preprocess the CARD database for RGI to predict antibiotic resistance from protein or nucleotide data | ||
keywords: | ||
- bacteria | ||
- fasta | ||
- antibiotic resistance | ||
tools: | ||
- rgi: | ||
description: This module preprocesses the downloaded Comprehensive Antibiotic Resistance Database (CARD) which can then be used as input for RGI. | ||
homepage: https://card.mcmaster.ca | ||
documentation: https://github.com/arpcard/rgi | ||
tool_dev_url: https://github.com/arpcard/rgi | ||
doi: "10.1093/nar/gkz935" | ||
licence: ["https://card.mcmaster.ca/about"] | ||
input: | ||
- card: | ||
type: directory | ||
description: Directory containing the CARD database | ||
pattern: "*/" | ||
output: | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
- db: | ||
type: directory | ||
description: Directory containing the processed CARD database files | ||
pattern: "*/" | ||
- tool_version: | ||
type: string | ||
description: The version of the tool in string format (useful for downstream tools such as hAMRronization) | ||
- db_version: | ||
type: string | ||
description: The version of the used database in string format (useful for downstream tools such as hAMRronization) | ||
authors: | ||
- "@rpetit3" | ||
- "@jfy133" | ||
- "@jasmezz" | ||
maintainers: | ||
- "@rpetit3" | ||
- "@jfy133" | ||
- "@jasmezz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
nextflow_process { | ||
|
||
name "Test Process RGI_CARDANNOTATION" | ||
script "../main.nf" | ||
process "RGI_CARDANNOTATION" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "rgi" | ||
tag "rgi/cardannotation" | ||
tag "untar" | ||
|
||
setup { | ||
run("UNTAR") { | ||
script "modules/nf-core/untar/main.nf" | ||
process { | ||
""" | ||
file('https://card.mcmaster.ca/latest/data', checkIfExists: true).copyTo('data.tar.gz') | ||
input[0] = [ | ||
[ ], | ||
file("data.tar.gz") | ||
] | ||
""" | ||
} | ||
} | ||
} | ||
|
||
test("rgi/cardannotation") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = UNTAR.out.untar.map{ it[1] } | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
|
||
test("rgi/cardannotation - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = UNTAR.out.untar.map{ it[1] } | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.