Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unzipping deeparg db option #320

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Added`

- [#xxx]() Add support for supplying gzipped DeepARG database files as input (by @jfy133)

### `Fixed`

### `Dependencies`
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The downloaded database folder contains the AMR related files:

DeepARG requires a database of potential antimicrobial resistance gene sequences based on a consensus from UNIPROT, CARD, and ARDB.

nf-core/funcscan can download this database for you, however it is very slow and pipeline runtime will be improved if you download this separately and supply it to the pipeline.
nf-core/funcscan can download this database for you, however it is very slow and pipeline runtime will be improved if you download this separately and supply it to the pipeline. Furthermore, if you have problems downloading this from within the pipeline, we highly recommend using the Zenodo archive of the database (see direct download below).

You can either:

Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@
"branch": "master",
"git_sha": "d0b4fc03af52a1cc8c6fb4493b921b57352b1dd8",
"installed_by": ["modules"]
},
"unzip": {
"branch": "master",
"git_sha": "8fc1d24c710ebe1d5de0f2447ec9439fd3d9d66a",
"installed_by": ["modules"]
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions modules/nf-core/unzip/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions modules/nf-core/unzip/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions modules/nf-core/unzip/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@
"arg_deeparg_data": {
"type": "string",
"fa_icon": "fab fa-deezer",
"description": "Specify the path to the DeepARG database.",
"help_text": "Specify the path to a local version of the DeepARG database (see the pipelines' usage [documentation](https://nf-co.re/funcscan/usage)). If no input is given, the module will download the database for you, however this is not recommended, as the database is large and this will take time."
"description": "Specify the path to the a directory or Zip archive of the DeepARG database.",
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
"help_text": "Specify the path to a local version of the DeepARG database (see the pipelines' usage [documentation](https://nf-co.re/funcscan/usage)). If no input is given, the module will download the database for you, however this is not recommended, as the database is large and this will take time. The input can be either a uncompressed directory, or a Zip file."
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
},
"arg_deeparg_data_version": {
"type": "integer",
Expand Down
14 changes: 11 additions & 3 deletions subworkflows/local/arg.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include { ABRICATE_RUN } from '../../modules/nf-core/abricate/ru
include { AMRFINDERPLUS_UPDATE } from '../../modules/nf-core/amrfinderplus/update/main'
include { AMRFINDERPLUS_RUN } from '../../modules/nf-core/amrfinderplus/run/main'
include { FARGENE } from '../../modules/nf-core/fargene/main'
include { UNZIP } from '../../modules/nf-core/unzip/main'
include { DEEPARG_DOWNLOADDATA } from '../../modules/nf-core/deeparg/downloaddata/main'
include { DEEPARG_PREDICT } from '../../modules/nf-core/deeparg/predict/main'
include { RGI_MAIN } from '../../modules/nf-core/rgi/main/main'
Expand Down Expand Up @@ -91,9 +92,16 @@ workflow ARG {

// DeepARG prepare download
if ( !params.arg_skip_deeparg && params.arg_deeparg_data ) {
ch_deeparg_db = Channel
.fromPath( params.arg_deeparg_data )
.first()

if ( file(params.arg_deeparg_data).getExtension() == "zip") {
jasmezz marked this conversation as resolved.
Show resolved Hide resolved
UNZIP( [ [id: "deepargdb"], params.arg_deeparg_data ] )
ch_deeparg_db = UNZIP.out.unzipped_archive.map{meta, db -> [db]}
Copy link
Collaborator

@jasmezz jasmezz Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ch_deeparg_db = UNZIP.out.unzipped_archive.map{meta, db -> [db]}
ch_deeparg_db = UNZIP.out.unzipped_archive.map{meta, db -> db}
.flatMap { it -> [ it + "/deeparg"] }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Zip file on Zenodo is a bit annoying because it contains a subfolder /deeparg which is the actual input we want. Hence the .flatMap line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I don't like that solution in case someone has made their own zip in the correct manner... So appending that may not always work... I guess we need to make update the module to find a file within it like is done in other modules like bwa/bowtie2

} else {
ch_deeparg_db = Channel
.fromPath( params.arg_deeparg_data )
.first()
}

} else if ( !params.arg_skip_deeparg && !params.arg_deeparg_data ) {
DEEPARG_DOWNLOADDATA( )
ch_versions = ch_versions.mix(DEEPARG_DOWNLOADDATA.out.versions)
Expand Down
Loading