-
Notifications
You must be signed in to change notification settings - Fork 964
Add rgi/bwt #9873
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
Open
vinisalazar
wants to merge
27
commits into
nf-core:master
Choose a base branch
from
vinisalazar:rgi/bwt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add rgi/bwt #9873
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
75f95ec
rgi/bwt: add draft
vinisalazar 42bf5c7
rgi/bwt: editing input channel
vinisalazar 77ec4ba
rgi/bwt: edit meta.yaml
vinisalazar fe0039c
rgi/bwt: update meta.yaml
vinisalazar 6252f12
rgi/bwt: add test snapshot
vinisalazar 738ffc3
rgi/bwt: add '--local' flag
vinisalazar 47300b4
rgi/bwt: update snapshot
vinisalazar c95108c
rgi/bwt: fix tests
vinisalazar e90b13c
rgi/bwt: continue to fix tests
vinisalazar 8db0574
rgi/bwt: remove json from snapshots
vinisalazar fdf2574
Merge branch 'master' into rgi/bwt
vinisalazar cd2faf4
rgi/bwt: remove task.ext value
vinisalazar c167336
rgi/bwt: move version to topics output
vinisalazar 6efbbe3
rgi/bwt: update meta.yml
vinisalazar 668cf72
Merge branch 'master' into rgi/bwt
SPPearce b1f3cae
Apply suggestions from code review
vinisalazar 8903429
rgi/bwt: fix tests and linting
vinisalazar a63bb29
rgi/bwt: formatting
vinisalazar 6647bb8
rgi/bwt: formatting
vinisalazar 60c83c3
rgi/bwt: formatting
vinisalazar 32bba94
rgi/bwt: formatting
vinisalazar 2bd82c1
rgi/bwt: update snapshot
vinisalazar d8637d4
Merge branch 'master' into rgi/bwt
mashehu 052fe23
rgi/bwt: fix module test dataset path
vinisalazar f218a8b
rgi/bwt: update branch
vinisalazar c16ebaf
Merge branch 'master' into rgi/bwt
SPPearce 10334f4
rgi/bwt: apply suggestions from code review (#9873)
vinisalazar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - bioconda::rgi=6.0.5 |
This file contains hidden or 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,81 @@ | ||
| process RGI_BWT { | ||
| tag "${meta.id}" | ||
| 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.5--pyh05cac1d_0' | ||
| : 'biocontainers/rgi:6.0.5--pyh05cac1d_0'}" | ||
|
|
||
| input: | ||
| tuple val(meta), path(reads, arity: '1..2') | ||
| path card | ||
| path wildcard | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.json"), emit: json | ||
| tuple val(meta), path("*.txt"), emit: tsv | ||
| tuple val(meta), path("temp/"), emit: tmp | ||
| tuple val("${task.process}"), val('rgi'), eval("rgi main --version"), emit: versions_rgi, topic: versions | ||
| tuple val("${task.process}"), val('rgi-database'), eval("echo \$DB_VERSION"), emit: versions_db , topic: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| // This customizes the command: rgi load | ||
| def args = task.ext.args ?: '' | ||
| // This customizes the command: rgi main | ||
| def args2 = task.ext.args2 ?: '' | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| def read_one = reads[0] | ||
| def read_two = reads.size() > 1 ? reads[1] : null | ||
| def load_wildcard = "" | ||
|
|
||
| if (wildcard) { | ||
| load_wildcard = """ \\ | ||
| --wildcard_annotation ${wildcard}/wildcard_database_v\$DB_VERSION.fasta \\ | ||
| --wildcard_annotation_all_models ${wildcard}/wildcard_database_v\$DB_VERSION\\_all.fasta \\ | ||
| --wildcard_index ${wildcard}/wildcard/index-for-model-sequences.txt \\ | ||
| --amr_kmers ${wildcard}/wildcard/all_amr_61mers.txt \\ | ||
| --kmer_database ${wildcard}/wildcard/61_kmer_db.json \\ | ||
| --kmer_size 61 | ||
| """ | ||
| } | ||
|
|
||
| """ | ||
| DB_VERSION=\$(ls ${card}/card_database_*_all.fasta | sed "s/${card}\\/card_database_v\\([0-9].*[0-9]\\).*/\\1/") | ||
|
|
||
| rgi \\ | ||
| load \\ | ||
| ${args} \\ | ||
| --local \\ | ||
| --card_json ${card}/card.json \\ | ||
| --debug \\ | ||
| --card_annotation ${card}/card_database_v\$DB_VERSION.fasta \\ | ||
| --card_annotation_all_models ${card}/card_database_v\$DB_VERSION\\_all.fasta \\ | ||
| ${load_wildcard} | ||
|
|
||
| rgi \\ | ||
| bwt \\ | ||
| ${args2} \\ | ||
| --local \\ | ||
| --threads ${task.cpus} \\ | ||
| --output_file ${prefix} \\ | ||
| --read_one ${read_one} \\ | ||
| ${ read_two ? "--read_two ${read_two}" : "" } | ||
|
|
||
| mkdir temp/ | ||
| for FILE in *.xml *.fsa *.{nhr,nin,nsq} *.draft *.potentialGenes *{variant,rrna,protein,predictedGenes,overexpression,homolog}.json; do [[ -e \$FILE ]] && mv \$FILE temp/; done | ||
|
|
||
| """ | ||
|
|
||
| stub: | ||
| """ | ||
| mkdir -p temp | ||
| touch test.json | ||
| touch test.txt | ||
|
|
||
| DB_VERSION=stub_version | ||
| """ | ||
| } |
This file contains hidden or 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,126 @@ | ||
| name: rgi_bwt | ||
| description: Predict antibiotic resistance from protein or nucleotide data | ||
| keywords: | ||
| - bacteria | ||
| - fasta | ||
| - antibiotic resistance | ||
| tools: | ||
| - rgi: | ||
| description: This tool provides a preliminary annotation of your DNA | ||
| sequence(s) based upon the data available in The Comprehensive Antibiotic | ||
| Resistance Database (CARD). Hits to genes tagged with Antibiotic | ||
| Resistance ontology terms will be highlighted. As CARD expands to include | ||
| more pathogens, genomes, plasmids, and ontology terms this tool will grow | ||
| increasingly powerful in providing first-pass detection of antibiotic | ||
| resistance associated genes. See license at CARD website. | ||
| 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"] | ||
| identifier: "" | ||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - reads: | ||
| type: file | ||
| description: Single-end or paired-end nucleotide sequences in FASTQ or FASTA format | ||
| pattern: "*.{fastq,fastq.gz,fq,fq.gz,fasta,fasta.gz,fa,fa.gz,fna,fna.gz,faa,faa.gz}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_1930 # FASTQ | ||
| - card: | ||
| type: directory | ||
| description: Directory containing the CARD database. This is expected to be | ||
| the unarchived but otherwise unaltered download folder (see RGI | ||
| documentation for download instructions). | ||
| pattern: "*/" | ||
| - wildcard: | ||
| type: directory | ||
| description: Directory containing the WildCARD database (optional). This is | ||
| expected to be the unarchived but otherwise unaltered download folder (see | ||
| RGI documentation for download instructions). | ||
| pattern: "*/" | ||
| output: | ||
| json: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - "*.json": | ||
| type: file | ||
| description: JSON formatted file with RGI results | ||
| pattern: "*.{json}" | ||
| ontologies: | ||
| - edam: http://edamontology.org/format_3464 # JSON | ||
| tsv: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - "*.txt": | ||
| type: file | ||
| description: Tab-delimited file with RGI results | ||
| pattern: "*.{txt}" | ||
| ontologies: [] | ||
| tmp: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. [ id:'test', single_end:false ] | ||
| - temp/: | ||
| type: directory | ||
| description: Directory containing various intermediate files | ||
| pattern: "temp/" | ||
| versions_rgi: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - rgi: | ||
| type: string | ||
| description: The tool name | ||
| - rgi main --version: | ||
| type: string | ||
| description: The version string returned by the command | ||
| versions_db: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - rgi-database: | ||
| type: string | ||
| description: The tool name | ||
| - echo \$DB_VERSION: | ||
| type: string | ||
| description: The CARD database version string | ||
|
|
||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - rgi: | ||
| type: string | ||
| description: The tool name | ||
| - rgi main --version: | ||
| type: string | ||
| description: Command used to collect the version | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - rgi-database: | ||
| type: string | ||
| description: The tool name | ||
| - echo \$DB_VERSION: | ||
| type: string | ||
| description: Command used to collect the version | ||
|
|
||
| authors: | ||
| - "@vinisalazar" | ||
| maintainers: | ||
| - "@nickp60" | ||
| - "@vinisalazar" |
This file contains hidden or 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,95 @@ | ||
| nextflow_process { | ||
|
|
||
| name "Test Process RGI_BWT" | ||
| script "../main.nf" | ||
| process "RGI_BWT" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "rgi" | ||
| tag "rgi/bwt" | ||
| 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('card-data.tar.bz2') | ||
|
|
||
| input[0] = [ | ||
| [ ], | ||
| file("card-data.tar.bz2") | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| run("RGI_CARDANNOTATION") { | ||
| script "modules/nf-core/rgi/cardannotation" | ||
| process { | ||
| """ | ||
| input[0] = UNTAR.out.untar.map{ it[1] } | ||
| """ | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test("rgi/bwt - homo_sapiens - test_fastq_gz") { | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test', single_end:false ], // meta map | ||
| [ | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true), | ||
| ] | ||
| ] | ||
| input[1] = RGI_CARDANNOTATION.out.db | ||
| input[2] = [] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot( | ||
| process.out.findAll { key, val -> key.startsWith("versions") }, | ||
| file(process.out.tmp.get(0).get(1)).list().sort(), | ||
| ).match() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| test("rgi/bwt - homo_sapiens - test_fastq_gz - stub") { | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = [ | ||
| [ id:'test', single_end:false ], // meta map | ||
| [ | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true), | ||
| file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true), | ||
| ] | ||
| ] | ||
| input[1] = RGI_CARDANNOTATION.out.db | ||
| input[2] = [] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't like to use externally hosted files, as they can sometimes become missing over time. How big is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SPPearce thanks again for the review. The file is 4.5 Mb. What would be the best practice in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practice will be to make a PR into the test-datasets repository then.
Could you make it any smaller than that?
That is quite annoyingly finnicky (and redoing how we do test-datasets has been on the to-do list for a long time now).
delete_me, find somewhere more appropriate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SPPearce. PR created, see below.