diff --git a/.gitignore b/.gitignore index 34d6bb2..1e2a074 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ null/ .nf-test.log .nf-test/tests .nf-test-*.nf -.nf-test/* +.nf-test/* \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index a33b527..6810c4e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,6 @@ { - "markdown.styles": ["public/vscode_markdown.css"] + "markdown.styles": [ + "public/vscode_markdown.css" + ], + "nextflow.telemetry.enabled": true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a65002..8017e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Added` +- [[PR #52](https://github.com/nf-core/proteinannotator/pull/52)] Add option to turn off InterProScan for testing +- [[PR #51](https://github.com/nf-core/proteinannotator/pull/51)] Update to nf-core/tools v3.3.1 +- [[PR #50](https://github.com/nf-core/proteinannotator/pull/50)] Add DIAMOND subworkflow to run [Diamond](https://github.com/bbuchfink/diamond) +- [[PR #47](https://github.com/nf-core/proteinannotator/pull/47)] Update metromap with more tools added from [May 2025 Hackathon](https://nf-co.re/events/2025/hackathon-boston) +- [[PR #43](https://github.com/nf-core/proteinannotator/pull/44)] Add [mTM-Align](https://nf-co.re/modules/mtmalign_align/) and [MMseqs2 Search](https://nf-co.re/modules/mmseqs_search/) modules +- [[PR #42](https://github.com/nf-core/proteinannotator/pull/42)] Updated to `nf-test` on GitHub Actions and in the `PULL_REQUEST_TEMPLATE.md` +- [[PR #13](https://github.com/nf-core/proteinannotator/pull/13)] Add nf-core seqkit/stats module +- [[PR #9](https://github.com/nf-core/proteinannotator/pull/9)] Add [InterProScan](https://interproscan-docs.readthedocs.io/) module +- [#90](https://github.com/nf-core/proteinannotator/pull/90) - Added the option to download and use the latest `metagRoot` HMM library (or use path to an existing one) for domain annotation. (by @angelphanth) - [#90](https://github.com/nf-core/proteinannotator/pull/90) - Added the option to download and use the latest `metagRoot` HMM library (or use path to an existing one) for domain annotation. (by @angelphanth) - [#87](https://github.com/nf-core/proteinannotator/pull/87) - Added the option to download and use the latest `NMPFams` HMM library (or use path to an existing one) for domain annotation. (by @npechl) - [#85](https://github.com/nf-core/proteinannotator/pull/85) - Added zenodo doi in `nextflow.config`. (by @vagkaratzas) diff --git a/CITATIONS.md b/CITATIONS.md index dcd4854..dea1273 100644 --- a/CITATIONS.md +++ b/CITATIONS.md @@ -10,6 +10,11 @@ ## Pipeline tools + +- [DIAMOND](https://github.com/bbuchfink/diamond) + +> Buchfink B, Xie C, Huson DH, "Fast and sensitive protein alignment using DIAMOND", Nature Methods 12, 59-60 (2015). doi:10.1038/nmeth.3176 + - [SeqFu](https://pubmed.ncbi.nlm.nih.gov/34066939/) > Telatin A, Fariselli P, Birolo G. SeqFu: a suite of utilities for the robust and reproducible manipulation of sequence files. Bioengineering. 2021 May 7;8(5):59. doi: 10.3390/bioengineering8050059. PubMed PMID: 34066939; PubMed Central PMCID: PMC8148589. diff --git a/README.md b/README.md index 63080c6..1a0ac27 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,13 @@ **nf-core/proteinannotator** is a bioinformatics pipeline that computes statistics for protein FASTA inputs and produces protein annotations based on predicted sequence features, including conserved domains, functions, and secondary structure. +1. Run ([`seqkit stats`](https://bioinf.shenwei.me/seqkit/usage/#stats)) to summarize input protein fasta files +2. Functional Annotation: + 1. ([`InterProScan`](https://interproscan-docs.readthedocs.io/en/v5/)) a software tool used to analyze protein sequences by scanning them against the signatures of protein families, domains, and sites in the [InterPro](https://www.ebi.ac.uk/interpro/) database, helping to identify their functional characteristics. + 2. ([`DIAMOND`](https://github.com/bbuchfink/diamond)) tool used for sensitive protein sequence alignment, comparing to a reference database created from combined protein fastas and taxonic information (taxon names, nodes, and map). +3. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)) + +

@@ -40,6 +47,7 @@ Generate input amino acid sequence statistics with ([`SeqFu`](https://github.com such as [Pfam](https://ftp.ebi.ac.uk/pub/databases/Pfam/), [FunFam](https://download.cathdb.info/cath/releases/all-releases/), and [NMPFams and metagRoot](https://pavlopoulos-lab.org/envofams/databases/hmmer/) 2. Functional annotation: - ([`InterProScan`](https://interproscan-docs.readthedocs.io/en/v5/)) a software tool used to analyze protein sequences by scanning them against the signatures of protein families, domains, and sites in the [InterPro](https://www.ebi.ac.uk/interpro/) database, helping to identify their functional characteristics. + - ([`DIAMOND`](https://github.com/bbuchfink/diamond)) a rapid and sensitive protein sequence aligner used to search input sequences against a reference database built from NCBI RefSeq protein sequences with taxonomic information, providing potential homologous protein matches across species. - ([`KOfamScan`](https://github.com/takaram/kofam_scan)) assigns KEGG Orthologs to protein sequences using profile HMMs and KO-specific score thresholds. 3. Predict secondary structure compositional features such as α-helices, β-strands and coils with ([`s4pred`](https://github.com/psipred/s4pred)) 4. Present QC stats for input sequences before and after initial pre-processing with ([`MultiQC`](http://multiqc.info/)) diff --git a/conf/modules.config b/conf/modules.config index cd716c8..4f1e90d 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -146,6 +146,22 @@ process { ] } + withName: 'NFCORE_PROTEINANNOTATOR:PROTEINANNOTATOR:FUNCTIONAL_ANNOTATION:DIAMOND:DIAMOND_MAKEDB' { + publishDir = [ + path: { "${params.outdir}/downloaded_dbs/diamond/" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: 'NFCORE_PROTEINANNOTATOR:PROTEINANNOTATOR:FUNCTIONAL_ANNOTATION:DIAMOND:DIAMOND_BLASTP' { + publishDir = [ + path: { "${params.outdir}/functional_annotation/diamond/${meta.id}/" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: 'NFCORE_PROTEINANNOTATOR:PROTEINANNOTATOR:FUNCTIONAL_ANNOTATION:ARIA2_INTERPROSCAN' { publishDir = [ path: { "${params.outdir}/downloaded_dbs/" }, diff --git a/docs/output.md b/docs/output.md index 6b1be55..040027a 100644 --- a/docs/output.md +++ b/docs/output.md @@ -18,6 +18,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d - [Domain annotation](#domain-annotation) Annotate proteins with domains from established repositories. - [hmmer](#hmmer) - To optionally match the input sequence to known Pfam, FunFam, NMPFams and/or metagRoot domains through `hmmer/hmmsearch` - [Functional annotation](#functional-annotation) Annotate proteins with functional domains + - [Diamond](#Diamond) - Provide potential homologous protein matches between species - [InterProScan](#Interproscan) - Search the InterProScan database for functional domains - [KOfamScan](#kofamscan) - Assign KEGG Orthologs with the KOfam profile database - [s4pred](#s4pred) - Predict secondary structures of sequences, producing amino acid level probabilities of forming an α-helix, a β-strand or a coil. @@ -170,7 +171,7 @@ AKRLERIETINREIIDMAGGAGSSNGTGGMLTKIKAATIATESGVPVYICS -#### JavaScript Object Notation (JSON) Output +##### JavaScript Object Notation (JSON) Output JSON representation of the matches - an alternative to XML format. As new releases are made public, the changes to the expected JSON format are documented in [Change log for InterProScan JSON output format](https://interproscan-docs.readthedocs.io/en/v5/JSONOutputFormatHistory.html#change-log-for-interproscan-json-output-format). @@ -363,11 +364,222 @@ The XML Schema Definition (XSD) is available [here](http://ftp.ebi.ac.uk/pub/sof -#### KOfamScan +#### Diamond

Output files +- `functional_annotation/` + - `diamond/` + - `/` + - `*.blast (0)`: (Basic Local Alignment Search Tool) BLAST pairwise format + - `*.xml (5)`: BLAST Extensible Markup Language (XML) format + - `*.txt (6)`: BLAST tabular format (default). This format can be customized, the 6 may be followed by a space-separated list of the blast_columns keywords, each specifying a field of the output. + - `*.daa (100)`: DIAMOND alignment archive (DAA). The DAA format is a proprietary binary format that can subsequently be used to generate other output formats using the view command. It is also supported by MEGAN and allows a quick import of results. + - `*.sam (101)`: SAM format. + - `*.tsv (102)`: Taxonomic classification. This format will not print alignments but only a taxonomic classification for each query using the LCA algorithm. + - `*.paf (103)`: PAF format. The custom fields in the format are AS (bit score), ZR (raw score) and ZE (e-value) + +
+ +[Diamond](https://github.com/bbuchfink/diamond) provides sensitive protein sequence alignment. The process provides potential homologous protein matches between species, indicating a evolutionary relationship, derived by protein sequence similarity. + +##### Pairwise Alignment Format (.blast) Output + +The pairwise BLAST format is a human readable format that is useful for visual inspection, if one desires to get full alignment details for individual alignments. + +
+Example Pairwise Alignment Format output + +``` +BLASTP 2.3.0+ + + +Query= WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] + +Length=401 + +>WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] +Length=401 + + Score = 771 bits (1991), Expect = 1.53e-288 + Identities = 401/401 (100%), Positives = 401/401 (100%), Gaps = 0/401 (0%) + +Query 1 MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPW 60 + MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPW +Sbjct 1 MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPW 60 + +Query 61 LGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIAD 120 + LGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIAD +Sbjct 61 LGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIAD 120 + +Query 121 TTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFR 180 + TTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFR +Sbjct 121 TTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFR 180 + +Query 181 ETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFG 240 + ETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFG +Sbjct 181 ETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFG 240 + +Query 241 WNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWL 300 + WNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWL +Sbjct 241 WNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWL 300 + +Query 301 DFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHS 360 + DFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHS +Sbjct 301 DFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHS 360 + +Query 361 LPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA 401 + LPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA +Sbjct 361 LPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA 401 +``` + +
+ +##### BLAST Extensible Markup Language (XML) Output + +XML (Extensible Markup Language) file has the same information as the pairwise file but is suited for bioinformatics software and scripts (machine readable), due to it’s structure and parsing of data. + +
+Example Extensible Markup Language (XML) output + +``` + + + + blastp + diamond 2.1.12 + Benjamin Buchfink, Xie Chao, and Daniel Huson (2015), "Fast and sensitive protein alignment using DIAMOND", Nature Methods 12:59-60. + refseq.dmnd + Query_1 + WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] + 401 + + + blosum62 + 0.001 + 11 + 1 + F + + + + + 1 + Query_1 + WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] + 401 + + + 1 + WP_031942563.1 + tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] + WP_031942563 + 401 + + + 1 + 771 + 1991 + 1.53e-288 + 1 + 401 + 1 + 401 + 0 + 0 + 401 + 401 + 0 + 401 + MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFGWNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA + MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFGWNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA + MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFGWNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA + + +``` + +
+ +##### Text File (TXT) Output --default + +The BLAST tabular format is the default output and the output columns can be modified depending on analysis needs. This format is much smaller than the other BLAST formats and compatible with most all forward processing and is easily filtered and analyzed. + +
+Example Text File (TXT) output + +``` +WP_031942563.1 WP_031942563.1 100 401 0 0 1 401 1 401 1.53e-288 771 +WP_430799656.1 WP_430799656.1 100 267 0 0 1 267 1 267 4.90e-197 528 +WP_148044478.1 WP_148044478.1 100 547 0 0 1 547 1 547 0.0 1087 +WP_168247882.1 WP_168247882.1 100 395 0 0 1 395 1 395 4.62e-296 790 +WP_168247882.1 WP_168247881.1 95.2 395 19 0 1 395 1 395 8.43e-283 756 +WP_168247881.1 WP_168247881.1 100 395 0 0 1 395 1 395 7.99e-297 791 +WP_168247881.1 WP_168247882.1 95.2 395 19 0 1 395 1 395 1.20e-282 756 +``` + +
+ +##### DIAMOND Alignment Archive (DAA) Output + +DIAMOND alignment archive (DAA) is a compressed proprietary binary format that is can be converted to any of the other output formats (.blast, .xml, .txt, .sam, .tsv, .paf) with the DIAMOND view command without rerunning the pipeline. It can also be used in some meta-genomic analysis software. + +##### Sequence Alignment/Map (SAM) Output + +The SAM (Sequence Alignment/Map) file adapts the DIAMOND protein alignment output in a similar fashion to the genomic alignment. This allows for easy integration into SAM/BAM pipelines and protein alignment visualization with IGV browser. + +
+Example Sequence Alignment/Map (SAM) output + +``` +@HD VN:1.5 SO:query +@PG PN:DIAMOND VN:2.1.12 CL:diamond blastp --threads 1 --db refseq.dmnd --query test_refseq.fasta --outfmt 101 --out test.sam +@mm BlastP +@CO BlastP-like alignments +@CO Reporting AS: bitScore, ZR: rawScore, ZE: expected, ZI: percent identity, ZL: reference length, ZF: frame, ZS: query start DNA coordinate +WP_031942563.1 0 WP_031942563.1 1 255 401M * 0 0 MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIGASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSPFFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFGWNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQGVMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETSA * AS:i:771 NM:i:0 ZL:i:401 ZR:i:1991 ZE:f:1.53e-288 ZI:i:100 ZF:i:1 ZS:i:1 MD:Z:401 +WP_430799656.1 0 WP_430799656.1 1 255 267M * 0 0 MNKYLALLILLVYSQVSMAESIRENKSWNEVFAQESVEGVFVLCKSSKNDCITNNKERALLAFIPASTFKIANALIALETGVVKSEHQIFKWGGEPRDMKQWEQDFTLRGAMQASAVPVFQQFAREIGEKRMQSYLGEFAYGNSNIDGGIDLFWLEGGLRISAINQIGFLESLYENKLPISERNQLIVKDALISEATPAYLIRSKTGYTGIKGKIQPGIAWWVGWVEKGTEVYFFAFNMNIDNESKLPARKSIPTKIMQSEGVLNGS * AS:i:528 NM:i:0 ZL:i:267 ZR:i:1361 ZE:f:4.90e-197 ZI:i:100 ZF:i:1 ZS:i:1 MD:Z:267 +WP_148044478.1 0 WP_148044478.1 1 255 547M * 0 0 MRLSAFITFLKMRPQVRTEFLTLFISLVFTLLCNGVFWNALLAGRDSLTSGTWLMLLCTGLLITGLQWLLLLLVATRWSVKPLLILLAVMTPAAVYFMRNYGVYFDKAMLRNLMETDVREASELLQWRMLPYLLVAAVSVWWIARVRVLRTGWKQAVMMRSACLAGALAMISMGLWPVMDVLIPTLRENKPLRYLITPANYVISGIRVLTEQASSSADEAREVVAADAHRGPQEQGRRPRALVLVVGETVRAANWGLSGYERQTTPELAARDVINFSDVTSCGTDTATSLPCMFSLNGRRDYDERQIRRRESVLHVLNRSDVNILWRDNQSGCKGVCDGLPFENLSSAGHPTLCHGERCLDEILLEGLAEKITTSRSDMLIVLHMLGNHGPAYFQRYPASYRRWSPTCDTTDLASCSHEALVNTYDNAVLYTDHVLARTIDLLSGIRSHDTALLYVSDHGESLGEKGLYLHGIPYVIAPDEQIKVPMIWWQSSQVYADQACMQTHASRAPVSHDHLFHTLLGMFDVKTAAYTPELDLLATCRKGQPQ * AS:i:1087 NM:i:0 ZL:i:547 ZR:i:2812 ZE:f:0.0 ZI:i:100 ZF:i:1 ZS:i:1 MD:Z:547 +WP_168247882.1 0 WP_168247882.1 1 255 395M * 0 0 MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDTSRVRTTVDAAILPLMSQHDIPGMVVGLILDGQPYVVTYGVASKEANVPVAEATLFEIGSVSKVFTATLAAYAQTTGKLSLDDHPGKYLPQLKGTPIDQATLLHLGTYTAGGLPLQFPDEVTGEVAVMDYFRNWTPLAPPGTRREYSNASPGLLGLVAASALDDDFATLMQSTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRPVRVNEGPLDEQAYGVKTTVSDLLRFVQANIDPSSLEPSMRRAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEMLFDPQPAYRLTDQTAGERYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWIILEQLASGTDSN * AS:i:790 NM:i:0 ZL:i:395 ZR:i:2039 ZE:f:4.62e-296 ZI:i:100 ZF:i:1 ZS:i:1 MD:Z:395 +WP_168247882.1 0 WP_168247881.1 1 255 395M * 0 0 MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDTSRVRTTVDAAILPLMSQHDIPGMVVGLILDGQPYVVTYGVASKEANVPVAEATLFEIGSVSKVFTATLAAYAQTTGKLSLDDHPGKYLPQLKGTPIDQATLLHLGTYTAGGLPLQFPDEVTGEVAVMDYFRNWTPLAPPGTRREYSNASPGLLGLVAASALDDDFATLMQSTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRPVRVNEGPLDEQAYGVKTTVSDLLRFVQANIDPSSLEPSMRRAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEMLFDPQPAYRLTDQTAGERYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWIILEQLASGTDSN * AS:i:756 NM:i:19 ZL:i:395 ZR:i:1952 ZE:f:8.43e-283 ZI:i:95 ZF:i:1 ZS:i:1 MD:Z:34S4AA17A20T24T3A15H3A29A3N26V15T31R32N7H57GQ44M12 +WP_168247881.1 0 WP_168247881.1 1 255 395M * 0 0 MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDSSRVRAAVDAAILPLMSQHDIPGMAVGLILDGQPYVVTYGVASKETNVPVAEATLFEIGSVSKVFTATLATYAQATGKLSLDDHPGKYLPHLKGAPIDQATLLHLGTYTAGGLPLQFPDEVTGEAAVMNYFRNWTPLAPPGTRREYSNASPGLLGVVAASALDDDFATLMQTTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRRVRVNEGPLDEQAYGVKTTVSDLLRFVQANIDPNSLEPSMRHAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEMLFDPQPAYRLTDQTAGGQYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWMILEQLASGTDSN * AS:i:791 NM:i:0 ZL:i:395 ZR:i:2044 ZE:f:7.99e-297 ZI:i:100 ZF:i:1 ZS:i:1 MD:Z:395 +WP_168247881.1 0 WP_168247882.1 1 255 395M * 0 0 MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDSSRVRAAVDAAILPLMSQHDIPGMAVGLILDGQPYVVTYGVASKETNVPVAEATLFEIGSVSKVFTATLATYAQATGKLSLDDHPGKYLPHLKGAPIDQATLLHLGTYTAGGLPLQFPDEVTGEAAVMNYFRNWTPLAPPGTRREYSNASPGLLGVVAASALDDDFATLMQTTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRRVRVNEGPLDEQAYGVKTTVSDLLRFVQANIDPNSLEPSMRHAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEMLFDPQPAYRLTDQTAGGQYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWMILEQLASGTDSN * AS:i:756 NM:i:19 ZL:i:395 ZR:i:1951 ZE:f:1.20e-282 ZI:i:95 ZF:i:1 ZS:i:1 MD:Z:34T4TT17V20A24A3T15Q3T29V3D26L15S31P32S7R57ER44I12 +``` + +
+ +##### Tab-Separated Values (TSV) Output + +The taxonomic classification (.tsv) output provides taxonomic composition and is useful for biological interpretation rather than alignment comparison. + +
+Example Tab-Separated Values (TSV) output + +``` +WP_031942563.1 2389 1.53e-288 +WP_430799656.1 2931384 4.90e-197 +WP_148044478.1 1755691 0.0 +WP_168247882.1 0 0 +WP_168247881.1 0 0 +``` + +
+ +##### Pairwise Mapping Format (PAF) + +The PAF (Pairwise mApping Format) file that is originally used for long read sequencing. DIAMOND adds three additional variables, AS (bit score), ZR (raw alignment score), and ZE (E-value), to provide statistical evidence for protein alignment. This format is useful if one is looking for positional information and statistical significance. + +
+Example Pairwise Mapping Format (PAF) output +``` +WP_031942563.1 401 0 401 + WP_031942563.1 401 0 401 401 401 255 AS:i:771 ZR:i:1991 ZE:f:1.53e-288 +WP_430799656.1 267 0 267 + WP_430799656.1 267 0 267 267 267 255 AS:i:528 ZR:i:1361 ZE:f:4.90e-197 +WP_148044478.1 547 0 547 + WP_148044478.1 547 0 547 547 547 255 AS:i:1087 ZR:i:2812 ZE:f:0.0 +``` + +#### KOfamScan + +
- `functional_annotation/` - `kofamscan/` - `/` diff --git a/docs/usage.md b/docs/usage.md index c8fd402..7c689fb 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -82,6 +82,7 @@ You can also generate such `YAML`/`JSON` files via [nf-core/launch](https://nf-c ### InterProScan +Running [InterProScan](https://interproscan-docs.readthedocs.io/) requires a pre-prepared input database. You can provided this as one of two options: [InterProScan](https://github.com/ebi-pf-team/interproscan) is used to provide more information about the proteins annotated on the contigs. By default, turning on this subworkflow without `--skip_interproscan` will download and unzip the InterPro database. The database will then be saved in the output directory `/downloaded_dbs/interproscan_db/`. We recommend keeping a copy of this directory for future reuse in case the results folder is deleted. > [!NOTE] @@ -89,6 +90,26 @@ You can also generate such `YAML`/`JSON` files via [nf-core/launch](https://nf-c A local version of the database can be supplied to the pipeline by passing the InterProScan database directory to `--interproscan_db `. The directory can be created by running (e.g. for database version 5.72-103.0): +### DIAMOND + +Running [Diamond](https://github.com/bbuchfink/diamond) requires six inputs parameters. + +- `--skip_diamond`: Skip the DIAMOND BLASTP taxonomic classification step entirely. +- `--refseq_release`: NCBI refseq release category of protein fastas for creation of a protein reference database using [`diamond/makedb`](https://nf-co.re/modules/diamond_makedb) +- `--taxondmp_zip`: Compressed taxon dmp file path to provide taxon names and nodes files for creation of a protein reference database using [`diamond/makedb`] +- `--taxonmap`: Compressed taxon map file path to provide taxon mapping file for creation of a protein reference database using [`diamond/makedb`] +- `--diamond_outfmt`: One of seven optional output formats for [`diamond/blastp`](https://nf-co.re/modules/diamond_blastp/), indicated by a digit code. Options include: + - `*.blast (0)`: (Basic Local Alignment Search Tool) BLAST pairwise format + - `*.xml (5)`: BLAST Extensible Markup Language (XML) format + - `*.txt (6)`: BLAST tabular format (default). This format can be customized, the 6 may be followed by a space-separated list of the blast_columns keywords, each specifying a field of the output. + - `*.daa (100)`: DIAMOND alignment archive (DAA). The DAA format is a proprietary binary format that can subsequently be used to generate other output formats using the view command. It is also supported by MEGAN and allows a quick import of results. + - `*.sam (101)`: SAM format. + - `*.tsv (102)`: Taxonomic classification. This format will not print alignments but only a taxonomic classification for each query using the LCA algorithm. + - `*.paf (103)`: PAF format. The custom fields in the format are AS (bit score), ZR (raw score) and ZE (e-value) +- `--diamond_blast_columns`: Accompanied optional input parameter to `diamond_outfmt`: `*.txt (6)` output format. Space separated list of columns to be included. Options: qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore. + +### Updating the pipeline + ``` curl -L https://ftp.ebi.ac.uk/pub/software/unix/iprscan/5/5.72-103.0/interproscan-5.72-103.0-64-bit.tar.gz -o interproscan_db/interproscan-5.72-103.0-64-bit.tar.gz tar -xzf interproscan_db/interproscan-5.72-103.0-64-bit.tar.gz -C interproscan_db/ diff --git a/main.nf b/main.nf index 1f24f81..48ead23 100644 --- a/main.nf +++ b/main.nf @@ -64,6 +64,7 @@ workflow NFCORE_PROTEINANNOTATOR { params.kofamscan_profiles, params.kofamscan_ko_list_url, params.kofamscan_ko_list, + params.skip_diamond, params.skip_s4pred ) emit: diff --git a/modules.json b/modules.json index 1d4df10..699dc93 100644 --- a/modules.json +++ b/modules.json @@ -10,6 +10,16 @@ "git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120", "installed_by": ["modules"] }, + "diamond/blastp": { + "branch": "master", + "git_sha": "422966026b45f2852cbe1a919dadc52082bf62f1", + "installed_by": ["modules"] + }, + "diamond/makedb": { + "branch": "master", + "git_sha": "96595d56273108853c872fb90bbefc675af7911a", + "installed_by": ["modules"] + }, "gunzip": { "branch": "master", "git_sha": "0902eac3012baaf4f9ab6513c8c55acc9353c96c", diff --git a/modules/local/diamondpreparetaxa/environment.yml b/modules/local/diamondpreparetaxa/environment.yml new file mode 100644 index 0000000..43094e3 --- /dev/null +++ b/modules/local/diamondpreparetaxa/environment.yml @@ -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: + - "conda-forge::curl=8.14.1" diff --git a/modules/local/diamondpreparetaxa/main.nf b/modules/local/diamondpreparetaxa/main.nf new file mode 100644 index 0000000..4f4087d --- /dev/null +++ b/modules/local/diamondpreparetaxa/main.nf @@ -0,0 +1,37 @@ +process DIAMONDPREPARETAXA { + + tag "taxdump" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/diamond:2.1.12--hdb4b4cc_1' : + 'biocontainers/diamond:2.1.12--hdb4b4cc_1'}" + // Note: diamond container is used here for convenience (includes wget/tar); + // a minimal linux container would be more correct for this download-only process. + + input: + val taxondmp_zip // NCBI taxonomy dump URL; default: ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz + + output: + path "taxa/nodes.dmp", emit: taxonnodes + path "taxa/names.dmp", emit: taxonnames + tuple val("${task.process}"), val('curl'), eval('curl --version | head -n1 | sed "s/^curl //; s/ .*//"'), topic: versions, emit: versions_curl + + when: + task.ext.when == null || task.ext.when + + script: + """ + mkdir -p taxa/ + curl -sL -o taxdump.tar.gz "${taxondmp_zip}" + tar -xzf taxdump.tar.gz -C taxa/ + """ + + stub: + """ + mkdir -p taxa/ + touch taxa/nodes.dmp + touch taxa/names.dmp + """ +} \ No newline at end of file diff --git a/modules/local/diamondpreparetaxa/meta.yml b/modules/local/diamondpreparetaxa/meta.yml new file mode 100644 index 0000000..079c311 --- /dev/null +++ b/modules/local/diamondpreparetaxa/meta.yml @@ -0,0 +1,54 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "diamondpreparetaxa" +description: Downloads and extracts NCBI taxonomy database files (nodes.dmp and names.dmp) required for DIAMOND taxonomic classification +keywords: + - taxonomy + - ncbi + - diamond + - database + - classification +tools: + - "curl": + description: Command-line tool and library for transferring data with URLs + homepage: "https://curl.se/" + documentation: "https://curl.se/docs/" + tool_dev_url: "https://github.com/curl/curl" + licence: ["curl"] + - "diamond": + description: Accelerated BLAST-compatible local sequence aligner + homepage: "https://github.com/bbuchfink/diamond" + documentation: "https://github.com/bbuchfink/diamond/wiki" + tool_dev_url: "https://github.com/bbuchfink/diamond" + doi: "10.1038/s41592-021-01101-x" + licence: ["GPL-3.0-or-later"] + +input: + - taxondmp_zip: + type: string + description: URL to NCBI taxonomy dump archive (taxdump.tar.gz) + pattern: ".*taxdump.tar.gz" + +output: + - taxonnodes: + - "taxa/nodes.dmp": + type: file + description: NCBI taxonomy nodes file containing taxonomic hierarchy + pattern: "nodes.dmp" + + - taxonnames: + - "taxa/names.dmp": + type: file + description: NCBI taxonomy names file containing taxon names + pattern: "names.dmp" + + - versions_curl: + - "versions.yml": + type: file + description: File containing software version (topic channel) + pattern: "versions.yml" + +authors: + - "@tracelail" +maintainers: + - "@tracelail" \ No newline at end of file diff --git a/modules/local/diamondpreparetaxa/tests/main.nf.test b/modules/local/diamondpreparetaxa/tests/main.nf.test new file mode 100644 index 0000000..bd86069 --- /dev/null +++ b/modules/local/diamondpreparetaxa/tests/main.nf.test @@ -0,0 +1,56 @@ +// nf-core modules test diamondpreparetaxa +nextflow_process { + + name "Test Process DIAMONDPREPARETAXA" + script "../main.nf" + process "DIAMONDPREPARETAXA" + + tag "modules" + tag "modules_" + tag "diamondpreparetaxa" + tag "diamond" + tag "diamond_local" + + test("Test DIAMONDPREPARETAXA creates taxon nodes and names dmp files") { + + when { + process { + """ + input[0] = "file://${moduleTestDir}/mini_taxdump.tar.gz" + """ + } + } + + then { + assert process.success + assert process.out.taxonnodes.size() == 1 + assert process.out.taxonnames.size() == 1 + assert snapshot(process.out).match() + } + + } + + test("Test DIAMONDPREPARETAXA creates taxon nodes and names dmp files -- stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + process { + """ + input[0] = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + """ + } + } + + then { + assert process.success + assert process.out.taxonnodes.size() == 1 + assert process.out.taxonnames.size() == 1 + assert snapshot(process.out).match() + } + + } + +} \ No newline at end of file diff --git a/modules/local/diamondpreparetaxa/tests/main.nf.test.snap b/modules/local/diamondpreparetaxa/tests/main.nf.test.snap new file mode 100644 index 0000000..6f23e53 --- /dev/null +++ b/modules/local/diamondpreparetaxa/tests/main.nf.test.snap @@ -0,0 +1,76 @@ +{ + "Test DIAMONDPREPARETAXA creates taxon nodes and names dmp files -- stub": { + "content": [ + { + "0": [ + "nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "2": [ + [ + "DIAMONDPREPARETAXA", + "curl", + "8.14.1" + ] + ], + "taxonnames": [ + "names.dmp:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "taxonnodes": [ + "nodes.dmp:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions_curl": [ + [ + "DIAMONDPREPARETAXA", + "curl", + "8.14.1" + ] + ] + } + ], + "timestamp": "2026-08-18T21:28:40.378814708", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.4" + } + }, + "Test DIAMONDPREPARETAXA creates taxon nodes and names dmp files": { + "content": [ + { + "0": [ + "nodes.dmp:md5,5526506044a931be50f09e32fe9ac5ce" + ], + "1": [ + "names.dmp:md5,d0b9ab68938991757886bd7515f2de3f" + ], + "2": [ + [ + "DIAMONDPREPARETAXA", + "curl", + "8.14.1" + ] + ], + "taxonnames": [ + "names.dmp:md5,d0b9ab68938991757886bd7515f2de3f" + ], + "taxonnodes": [ + "nodes.dmp:md5,5526506044a931be50f09e32fe9ac5ce" + ], + "versions_curl": [ + [ + "DIAMONDPREPARETAXA", + "curl", + "8.14.1" + ] + ] + } + ], + "timestamp": "2026-08-18T21:28:32.161295189", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.4" + } + } +} \ No newline at end of file diff --git a/modules/local/diamondpreparetaxa/tests/mini_taxdump.tar.gz b/modules/local/diamondpreparetaxa/tests/mini_taxdump.tar.gz new file mode 100644 index 0000000..b5e3fc2 Binary files /dev/null and b/modules/local/diamondpreparetaxa/tests/mini_taxdump.tar.gz differ diff --git a/modules/local/ncbirefseqdownload/environment.yml b/modules/local/ncbirefseqdownload/environment.yml new file mode 100644 index 0000000..c2d2579 --- /dev/null +++ b/modules/local/ncbirefseqdownload/environment.yml @@ -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: + - "conda-forge::rclone=1.75.0" diff --git a/modules/local/ncbirefseqdownload/main.nf b/modules/local/ncbirefseqdownload/main.nf new file mode 100644 index 0000000..64f384f --- /dev/null +++ b/modules/local/ncbirefseqdownload/main.nf @@ -0,0 +1,41 @@ +process NCBIREFSEQDOWNLOAD { + label 'process_low' + tag "download_refseq" + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/rclone:1.75.0--740c5f5c731d4cea' : + 'community.wave.seqera.io/library/rclone:1.75.0--0b2d3444376fb3b2' }" + + input: + val(refseq_release) // ncbi refseq release category -- default of 'complete' + + output: + path "ncbi_refseq/refseq_fasta.fa.gz", emit: refseq_fasta // reference fasta for diamond/makedb nf-core module + tuple val("${task.process}"), val('rclone'), eval('rclone --version | head -n1 | sed "s/rclone //"'), topic: versions, emit: versions_rclone + + when: + task.ext.when == null || task.ext.when + + script: + """ + mkdir -p ncbi_refseq/${refseq_release}/ + + rclone copy \\ + :http:refseq/release/${refseq_release}/ \\ + ncbi_refseq/${refseq_release}/ \\ + --http-url https://ftp.ncbi.nlm.nih.gov \\ + --include '*protein.faa.gz' \\ + --user-agent "Mozilla/5.0" + + zcat ncbi_refseq/*/*.faa.gz | gzip -c > ncbi_refseq/refseq_fasta.fa.gz + + echo "All RefSeq protein FASTAs aggregated into ncbi_refseq/" + """ + + stub: + """ + mkdir -p ncbi_refseq + echo "" | gzip > ncbi_refseq/refseq_fasta.fa.gz + """ +} \ No newline at end of file diff --git a/modules/local/ncbirefseqdownload/meta.yml b/modules/local/ncbirefseqdownload/meta.yml new file mode 100644 index 0000000..044c2c6 --- /dev/null +++ b/modules/local/ncbirefseqdownload/meta.yml @@ -0,0 +1,41 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "ncbirefseqdownload" +description: Downloads NCBI RefSeq protein sequences for a specified release category and aggregates them into a single compressed FASTA file +keywords: + - download + - refseq + - ncbi + - protein + - database +tools: + - "rclone": + description: Command line program to sync files and directories to and from different cloud storage providers + homepage: "https://rclone.org/" + documentation: "https://rclone.org/docs/" + tool_dev_url: "https://github.com/rclone/rclone" + licence: ["MIT"] + +input: + - refseq_release: + type: string + description: NCBI RefSeq release category (e.g., 'complete', 'other', 'viral', 'bacteria') + pattern: ".*" + +output: + - refseq_fasta: + - "ncbi_refseq/refseq_fasta.fa.gz": + type: file + description: Aggregated and compressed protein FASTA file from RefSeq release + pattern: "*.fa.gz" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@tracelail" +maintainers: + - "@tracelail" \ No newline at end of file diff --git a/modules/local/ncbirefseqdownload/tests/main.nf.test b/modules/local/ncbirefseqdownload/tests/main.nf.test new file mode 100644 index 0000000..5bec704 --- /dev/null +++ b/modules/local/ncbirefseqdownload/tests/main.nf.test @@ -0,0 +1,55 @@ +nextflow_process { + + name "Test Process NCBIREFSEQDOWNLOAD" + script "../main.nf" + process "NCBIREFSEQDOWNLOAD" + + tag "modules" + tag "modules_" + tag "ncbirefseqdownload" + tag "diamond" + tag "diamond_local" + + test("Should download ncbi refseq 'other' zipped protein fasta") { + + when { + process { + """ + input[0] = 'other' + """ + } + } + + then { + assert process.success + assert process.trace.tasks().size() == 1 + assert process.out.refseq_fasta.size() == 1 + assert snapshot(process.out).match() + } + + } + + test("Should download ncbi refseq 'other' zipped protein fasta -- stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + process { + """ + input[0] = 'other' + """ + } + } + + then { + assert process.success + assert process.trace.tasks().size() == 1 + assert process.out.refseq_fasta.size() == 1 + assert snapshot(process.out).match() + } + + } + +} \ No newline at end of file diff --git a/modules/local/ncbirefseqdownload/tests/main.nf.test.snap b/modules/local/ncbirefseqdownload/tests/main.nf.test.snap new file mode 100644 index 0000000..45e7f62 --- /dev/null +++ b/modules/local/ncbirefseqdownload/tests/main.nf.test.snap @@ -0,0 +1,64 @@ +{ + "Should download ncbi refseq 'other' zipped protein fasta -- stub": { + "content": [ + { + "0": [ + "refseq_fasta.fa.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ], + "1": [ + [ + "NCBIREFSEQDOWNLOAD", + "rclone", + "v1.75.0" + ] + ], + "refseq_fasta": [ + "refseq_fasta.fa.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ], + "versions_rclone": [ + [ + "NCBIREFSEQDOWNLOAD", + "rclone", + "v1.75.0" + ] + ] + } + ], + "timestamp": "2026-08-20T18:54:43.579551367", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, + "Should download ncbi refseq 'other' zipped protein fasta": { + "content": [ + { + "0": [ + "refseq_fasta.fa.gz:md5,af9fbb4c725173a9286979c7f1c6a67e" + ], + "1": [ + [ + "NCBIREFSEQDOWNLOAD", + "rclone", + "v1.75.0" + ] + ], + "refseq_fasta": [ + "refseq_fasta.fa.gz:md5,af9fbb4c725173a9286979c7f1c6a67e" + ], + "versions_rclone": [ + [ + "NCBIREFSEQDOWNLOAD", + "rclone", + "v1.75.0" + ] + ] + } + ], + "timestamp": "2026-08-26T14:52:02.541271594", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/diamond/blastp/environment.yml b/modules/nf-core/diamond/blastp/environment.yml new file mode 100644 index 0000000..677c14d --- /dev/null +++ b/modules/nf-core/diamond/blastp/environment.yml @@ -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::diamond=2.1.23 diff --git a/modules/nf-core/diamond/blastp/main.nf b/modules/nf-core/diamond/blastp/main.nf new file mode 100644 index 0000000..2e1b365 --- /dev/null +++ b/modules/nf-core/diamond/blastp/main.nf @@ -0,0 +1,122 @@ +process DIAMOND_BLASTP { + tag "${meta.id}.${meta2.id}" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/diamond:2.1.23--hf93d47f_0' + : 'biocontainers/diamond:2.1.23--hf93d47f_0'}" + + input: + tuple val(meta), path(fasta) + tuple val(meta2), path(db) + val outfmt + val blast_columns + + output: + tuple val(meta), path('*.{blast,blast.gz}'), optional: true, emit: blast + tuple val(meta), path('*.{xml,xml.gz}'), optional: true, emit: xml + tuple val(meta), path('*.{txt,txt.gz}'), optional: true, emit: txt + tuple val(meta), path('*.{daa,daa.gz}'), optional: true, emit: daa + tuple val(meta), path('*.{sam,sam.gz}'), optional: true, emit: sam + tuple val(meta), path('*.{tsv,tsv.gz}'), optional: true, emit: tsv + tuple val(meta), path('*.{paf,paf.gz}'), optional: true, emit: paf + tuple val("${task.process}"), val('diamond'), eval('diamond --version 2>&1 | tail -n 1 | sed "s/^diamond version //"'), emit: versions_diamond, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + meta = meta + [ db: meta2.id ] + + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}.${meta2.id}" + + def columns = blast_columns ? "${blast_columns}" : '' + def out_ext = "" + + if (outfmt == 0) { + out_ext = "blast" + } + else if (outfmt == 5) { + out_ext = "xml" + } + else if (outfmt == 6) { + out_ext = "txt" + } + else if (outfmt == 100) { + out_ext = "daa" + } + else if (outfmt == 101) { + out_ext = "sam" + } + else if (outfmt == 102) { + out_ext = "tsv" + } + else if (outfmt == 103) { + out_ext = "paf" + } + else { + log.warn("Unknown output file format provided (${outfmt}): selecting DIAMOND default of tabular BLAST output (txt)") + outfmt = 6 + out_ext = 'txt' + } + + if (args =~ /--compress\s+1/) { + out_ext += '.gz' + } + + """ + diamond \\ + blastp \\ + --threads ${task.cpus} \\ + --db ${db} \\ + --query ${fasta} \\ + --outfmt ${outfmt} ${columns} \\ + ${args} \\ + --out ${prefix}.${out_ext} + """ + + stub: + meta = meta + [ db: meta2.id ] + + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + def out_ext = "" + + if (outfmt == 0) { + out_ext = "blast" + } + else if (outfmt == 5) { + out_ext = "xml" + } + else if (outfmt == 6) { + out_ext = "txt" + } + else if (outfmt == 100) { + out_ext = "daa" + } + else if (outfmt == 101) { + out_ext = "sam" + } + else if (outfmt == 102) { + out_ext = "tsv" + } + else if (outfmt == 103) { + out_ext = "paf" + } + else { + log.warn("Unknown output file format provided (${outfmt}): selecting DIAMOND default of tabular BLAST output (txt)") + outfmt = 6 + out_ext = 'txt' + } + + if (args =~ /--compress\s+1/) { + out_ext += '.gz' + } + + """ + touch ${prefix}.${out_ext} + """ +} diff --git a/modules/nf-core/diamond/blastp/meta.yml b/modules/nf-core/diamond/blastp/meta.yml new file mode 100644 index 0000000..edda8ab --- /dev/null +++ b/modules/nf-core/diamond/blastp/meta.yml @@ -0,0 +1,171 @@ +name: diamond_blastp +description: Queries a DIAMOND database using blastp mode +keywords: + - fasta + - diamond + - blastp + - DNA sequence +tools: + - diamond: + description: Accelerated BLAST compatible local sequence aligner + homepage: https://github.com/bbuchfink/diamond + documentation: https://github.com/bbuchfink/diamond/wiki + tool_dev_url: https://github.com/bbuchfink/diamond + doi: "10.1038/s41592-021-01101-x" + licence: + - "GPL v3.0" + identifier: biotools:diamond +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - fasta: + type: file + description: Input fasta file containing query sequences + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + ontologies: + - edam: http://edamontology.org/format_1929 # FASTA + - - meta2: + type: map + description: | + Groovy Map containing db information + e.g. [ id:'test2' ] + - db: + type: file + description: File of the indexed DIAMOND database + pattern: "*.dmnd" + ontologies: [] + - outfmt: + type: integer + description: | + Specify the type of output file to be generated. + 0, .blast, BLAST pairwise format. + 5, .xml, BLAST XML format. + 6, .txt, BLAST tabular format (default). This format can be customized, the 6 may be followed by a space-separated list of the blast_columns keywords, each specifying a field of the output. + 100, .daa, DIAMOND alignment archive (DAA). The DAA format is a proprietary binary format that can subsequently be used to generate other output formats using the view command. It is also supported by MEGAN and allows a quick import of results. + 101, .sam, SAM format. + 102, .tsv, Taxonomic classification. This format will not print alignments but only a taxonomic classification for each query using the LCA algorithm. + 103, .paf, PAF format. The custom fields in the format are AS (bit score), ZR (raw score) and ZE (e-value). + pattern: "0|5|6|100|101|102|103" + - blast_columns: + type: string + description: | + Optional space separated list of DIAMOND tabular BLAST output keywords + used in conjunction with the --outfmt 6 option (txt). + Options: + qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore +output: + blast: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{blast,blast.gz}": + type: file + description: File containing blastp hits + pattern: "*.{blast,blast.gz}" + ontologies: + - edam: http://edamontology.org/format_3836 # BLAST XML v2 results format + xml: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{xml,xml.gz}": + type: file + description: File containing blastp hits + pattern: "*.{xml,xml.gz}" + ontologies: + - edam: http://edamontology.org/format_2332 # XML + txt: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{txt,txt.gz}": + type: file + description: File containing hits in tabular BLAST format. + pattern: "*.{txt,txt.gz}" + ontologies: + - edam: http://edamontology.org/format_1333 # BLAST results + daa: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{daa,daa.gz}": + type: file + description: File containing hits DAA format + pattern: "*.{daa,daa.gz}" + ontologies: [] + sam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{sam,sam.gz}": + type: file + description: File containing aligned reads in SAM format + pattern: "*.{sam,sam.gz}" + ontologies: + - edam: http://edamontology.org/format_2573 + tsv: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{tsv,tsv.gz}": + type: file + description: Tab separated file containing taxonomic classification of + hits + pattern: "*.{tsv,tsv.gz}" + ontologies: + - edam: http://edamontology.org/format_3475 # TSV + paf: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', db:'ncbi-refseq' ] + - "*.{paf,paf.gz}": + type: file + description: File containing aligned reads in pairwise mapping format + format + pattern: "*.{paf,paf.gz}" + ontologies: [] + versions_diamond: + - - ${task.process}: + type: string + description: The name of the process + - diamond: + type: string + description: The name of the tool + - diamond --version 2>&1 | tail -n 1 | sed "s/^diamond version //": + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - diamond: + type: string + description: The name of the tool + - diamond --version 2>&1 | tail -n 1 | sed "s/^diamond version //": + type: eval + description: The expression to obtain the version of the tool +authors: + - "@spficklin" + - "@jfy133" +maintainers: + - "@spficklin" + - "@jfy133" + - "@vagkaratzas" diff --git a/modules/nf-core/diamond/blastp/tests/main.nf.test b/modules/nf-core/diamond/blastp/tests/main.nf.test new file mode 100644 index 0000000..a2f886a --- /dev/null +++ b/modules/nf-core/diamond/blastp/tests/main.nf.test @@ -0,0 +1,180 @@ +nextflow_process { + + name "Test Process DIAMOND_BLASTP" + script "../main.nf" + process "DIAMOND_BLASTP" + tag "modules" + tag "modules_nfcore" + tag "diamond" + tag "diamond/makedb" + tag "diamond/blastp" + + setup { + run("DIAMOND_MAKEDB", alias: "FIRST_DB") { + script "../../makedb/main.nf" + process { + """ + input[0] = [ [id:'db1'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ] ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + } + + test("sarscov2 - proteome - txt") { + + when { + process { + """ + input[0] = [ [id:'txt'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ] + input[1] = FIRST_DB.out.db + input[2] = 6 + input[3] = 'qseqid qlen' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - proteome - gz - txt") { + + when { + process { + """ + input[0] = [ [id:'txt.gz'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ] + input[1] = FIRST_DB.out.db + input[2] = 6 + input[3] = 'qseqid qlen' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("gz_txt")} + ) + } + + } + + test("sarscov2 - proteome - daa") { + + when { + process { + """ + input[0] = [ [id:'daa'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = FIRST_DB.out.db + input[2] = 100 + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.daa }, + { assert snapshot(process.out.versions).match("daa") } + ) + } + + } + + test("sarscov2 - proteome - txt - gz") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [id:'txt.gz'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = FIRST_DB.out.db + input[2] = 6 + input[3] = 'qseqid qlen' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("txt_gz") } + ) + } + + } + + test("sarscov2 - proteome - double fasta/double db input") { + + when { + run("DIAMOND_MAKEDB", alias: "SECOND_DB") { + script "../../makedb/main.nf" + process { + """ + input[0] = [ [id:'db2'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome_test.faa', checkIfExists: true) ] ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + + process { + """ + input[0] = channel.of( + [ [id:'fasta1'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ], + [ [id:'fasta1'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ], + [ [id:'fasta2'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome_test.faa', checkIfExists: true) ], + [ [id:'fasta2'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome_test.faa', checkIfExists: true) ] + ) + input[1] = FIRST_DB.out.db.concat(SECOND_DB.out.db).concat(FIRST_DB.out.db).concat(SECOND_DB.out.db) + input[2] = 6 + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.toSorted()).match() } + ) + } + + } + + test("sarscov2 - proteome - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id:'stub'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = FIRST_DB.out.db + input[2] = 6 + input[3] = 'qseqid qlen' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("stub") } + ) + } + + } + +} diff --git a/modules/nf-core/diamond/blastp/tests/main.nf.test.snap b/modules/nf-core/diamond/blastp/tests/main.nf.test.snap new file mode 100644 index 0000000..c559401 --- /dev/null +++ b/modules/nf-core/diamond/blastp/tests/main.nf.test.snap @@ -0,0 +1,477 @@ +{ + "sarscov2 - proteome - txt": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "txt", + "db": "db1" + }, + "txt.db1.txt:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "txt", + "db": "db1" + }, + "txt.db1.txt:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-10T18:29:43.631582451", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "txt_gz": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "txt.gz", + "db": "db1" + }, + "txt.gz.db1.txt.gz:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "txt.gz", + "db": "db1" + }, + "txt.gz.db1.txt.gz:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-10T18:30:12.968864721", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "gz_txt": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "txt.gz", + "db": "db1" + }, + "txt.gz.db1.txt:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "txt.gz", + "db": "db1" + }, + "txt.gz.db1.txt:md5,8131b1afd717f3d5f2f2417c5b562e6e" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-10T18:29:53.37630928", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "sarscov2 - proteome - double fasta/double db input": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "fasta1", + "db": "db1" + }, + "fasta1.db1.txt:md5,2515cf88590afa32356497e79a51fce9" + ], + [ + { + "id": "fasta1", + "db": "db2" + }, + "fasta1.db2.txt:md5,8b41a8752379f7bd8722258962c598a4" + ], + [ + { + "id": "fasta2", + "db": "db1" + }, + "fasta2.db1.txt:md5,3be947b0e6c69c59491f817b03b1256f" + ], + [ + { + "id": "fasta2", + "db": "db2" + }, + "fasta2.db2.txt:md5,f2461bcecbf4f87cefe952179505aa8f" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "fasta1", + "db": "db1" + }, + "fasta1.db1.txt:md5,2515cf88590afa32356497e79a51fce9" + ], + [ + { + "id": "fasta1", + "db": "db2" + }, + "fasta1.db2.txt:md5,8b41a8752379f7bd8722258962c598a4" + ], + [ + { + "id": "fasta2", + "db": "db1" + }, + "fasta2.db1.txt:md5,3be947b0e6c69c59491f817b03b1256f" + ], + [ + { + "id": "fasta2", + "db": "db2" + }, + "fasta2.db2.txt:md5,f2461bcecbf4f87cefe952179505aa8f" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ], + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-10T18:30:23.940020081", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "daa": { + "content": null, + "timestamp": "2026-03-10T18:30:03.067997422", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "stub", + "db": "db1" + }, + "stub.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "stub", + "db": "db1" + }, + "stub.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_BLASTP", + "diamond", + "2.1.23" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-10T18:30:33.408520524", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + } +} \ No newline at end of file diff --git a/modules/nf-core/diamond/blastp/tests/nextflow.config b/modules/nf-core/diamond/blastp/tests/nextflow.config new file mode 100644 index 0000000..bd28cb1 --- /dev/null +++ b/modules/nf-core/diamond/blastp/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: DIAMOND_BLASTP { + ext.args = '--compress 1' + } + +} diff --git a/modules/nf-core/diamond/makedb/environment.yml b/modules/nf-core/diamond/makedb/environment.yml new file mode 100644 index 0000000..0a8bf62 --- /dev/null +++ b/modules/nf-core/diamond/makedb/environment.yml @@ -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::diamond=2.1.16 diff --git a/modules/nf-core/diamond/makedb/main.nf b/modules/nf-core/diamond/makedb/main.nf new file mode 100644 index 0000000..1def3d3 --- /dev/null +++ b/modules/nf-core/diamond/makedb/main.nf @@ -0,0 +1,56 @@ +process DIAMOND_MAKEDB { + 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/diamond:2.1.16--h13889ed_0' + : 'biocontainers/diamond:2.1.16--h13889ed_0'}" + + input: + tuple val(meta), path(fasta) + path taxonmap + path taxonnodes + path taxonnames + + output: + tuple val(meta), path("*.dmnd"), emit: db + tuple val("${task.process}"), val('diamond'), eval("diamond --version | sed 's/diamond version //g'"), emit: versions_diamond, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def is_compressed = fasta.getExtension() == "gz" ? true : false + def fasta_name = is_compressed ? fasta.getBaseName() : fasta + def insert_taxonmap = taxonmap ? "--taxonmap ${taxonmap}" : "" + def insert_taxonnodes = taxonnodes ? "--taxonnodes ${taxonnodes}" : "" + def insert_taxonnames = taxonnames ? "--taxonnames ${taxonnames}" : "" + + """ + if [ "${is_compressed}" == "true" ]; then + gzip -c -d ${fasta} > ${fasta_name} + fi + + diamond \\ + makedb \\ + --threads ${task.cpus} \\ + --in ${fasta_name} \\ + -d ${prefix} \\ + ${args} \\ + ${insert_taxonmap} \\ + ${insert_taxonnodes} \\ + ${insert_taxonnames} + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + echo "${args}" + touch ${prefix}.dmnd + """ +} diff --git a/modules/nf-core/diamond/makedb/meta.yml b/modules/nf-core/diamond/makedb/meta.yml new file mode 100644 index 0000000..6753ece --- /dev/null +++ b/modules/nf-core/diamond/makedb/meta.yml @@ -0,0 +1,87 @@ +name: diamond_makedb +description: Builds a DIAMOND database +keywords: + - fasta + - diamond + - index + - database +tools: + - diamond: + description: Accelerated BLAST compatible local sequence aligner + homepage: https://github.com/bbuchfink/diamond + documentation: https://github.com/bbuchfink/diamond/wiki + tool_dev_url: https://github.com/bbuchfink/diamond + doi: "10.1038/s41592-021-01101-x" + licence: + - "GPL v3.0" + identifier: biotools:diamond +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input fasta file + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + ontologies: + - edam: http://edamontology.org/format_1929 # FASTA + - taxonmap: + type: file + description: Optional mapping file of NCBI protein accession numbers to + taxon ids (gzip compressed), required for taxonomy functionality. + pattern: "*.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP + - taxonnodes: + type: file + description: Optional NCBI taxonomy nodes.dmp file, required for taxonomy + functionality. + pattern: "*.dmp" + ontologies: [] + - taxonnames: + type: file + description: Optional NCBI taxonomy names.dmp file, required for taxonomy + functionality. + pattern: "*.dmp" + ontologies: [] +output: + db: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.dmnd": + type: file + description: File of the indexed DIAMOND database + pattern: "*.dmnd" + ontologies: [] + versions_diamond: + - - ${task.process}: + type: string + description: The name of the process + - diamond: + type: string + description: The name of the tool + - diamond --version | sed 's/diamond version //g': + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - diamond: + type: string + description: The name of the tool + - diamond --version | sed 's/diamond version //g': + type: eval + description: The expression to obtain the version of the tool +authors: + - "@spficklin" +maintainers: + - "@spficklin" + - "@vagkaratzas" + - "@jfy133" diff --git a/modules/nf-core/diamond/makedb/tests/main.nf.test b/modules/nf-core/diamond/makedb/tests/main.nf.test new file mode 100644 index 0000000..f27e142 --- /dev/null +++ b/modules/nf-core/diamond/makedb/tests/main.nf.test @@ -0,0 +1,86 @@ +nextflow_process { + + name "Test Process DIAMOND_MAKEDB" + script "../main.nf" + process "DIAMOND_MAKEDB" + tag "modules" + tag "modules_nfcore" + tag "diamond" + tag "diamond/makedb" + + test("Should build a DIAMOND db file from a fasta file without taxonomic information") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("Should build a DIAMOND db file from a zipped fasta file without taxonomic information") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta.gz', checkIfExists: true) ] ] + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("Should build a DIAMOND db file from a fasta file with taxonomic information") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ [id:'test'], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] ] + input[1] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot.accession2taxid.gz', checkIfExists: true) ] + input[2] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_nodes.dmp', checkIfExists: true) ] + input[3] = [ file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_names.dmp', checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/diamond/makedb/tests/main.nf.test.snap b/modules/nf-core/diamond/makedb/tests/main.nf.test.snap new file mode 100644 index 0000000..d5461f5 --- /dev/null +++ b/modules/nf-core/diamond/makedb/tests/main.nf.test.snap @@ -0,0 +1,125 @@ +{ + "Should build a DIAMOND db file from a fasta file with taxonomic information": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,4b710afefbc5b328e9228f55da2bfbc7" + ] + ], + "1": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ], + "db": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,4b710afefbc5b328e9228f55da2bfbc7" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ] + } + ], + "timestamp": "2026-03-13T14:37:22.248698371", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Should build a DIAMOND db file from a fasta file without taxonomic information": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,6eba1a0869e630cb9b253523613bc885" + ] + ], + "1": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ], + "db": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,6eba1a0869e630cb9b253523613bc885" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ] + } + ], + "timestamp": "2026-03-13T14:37:07.027557575", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Should build a DIAMOND db file from a zipped fasta file without taxonomic information": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,6eba1a0869e630cb9b253523613bc885" + ] + ], + "1": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ], + "db": [ + [ + { + "id": "test" + }, + "test.dmnd:md5,6eba1a0869e630cb9b253523613bc885" + ] + ], + "versions_diamond": [ + [ + "DIAMOND_MAKEDB", + "diamond", + "2.1.16" + ] + ] + } + ], + "timestamp": "2026-03-13T14:37:14.201927064", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + } +} \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index 18022e5..deac00e 100644 --- a/nextflow.config +++ b/nextflow.config @@ -45,10 +45,24 @@ params { kofamscan_ko_list_url = "https://www.genome.jp/ftp/db/kofam/ko_list.gz" kofamscan_ko_list = null + // DIAMOND options + skip_diamond = false + refseq_release = 'complete' + taxondmp_zip = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + taxonmap = 'ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy/accession2taxid/prot.accession2taxid.gz' + diamond_outfmt = 6 + diamond_blast_columns = null + // Secondary structure prediction (s4pred) skip_s4pred = false s4pred_outfmt = 'ss2' // ["ss2", "fas", "horiz"] + // References + genome = null + igenomes_base = 's3://ngi-igenomes/igenomes/' + igenomes_ignore = false + + // MultiQC options multiqc_config = null multiqc_title = null diff --git a/nextflow_schema.json b/nextflow_schema.json index ac9637c..e67c915 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -43,6 +43,50 @@ } } }, + "diamond_options": { + "title": "DIAMOND Options", + "type": "object", + "description": "Options for DIAMOND blastp subworkflow for protein homology searches", + "default": "", + "properties": { + "skip_diamond": { + "type": "boolean", + "fa_icon": "fas fa-ban", + "description": "Skip the DIAMOND BLASTP taxonomic classification.", + "help": "Skips the DIAMOND BLASTP homology search and taxonomic classification of input sequences against the RefSeq database.", + "default": false + }, + "refseq_release": { + "type": "string", + "description": "NCBI refseq release category of protein fastas from ftp.ncbi.nlm.nih.gov/refseq/release/", + "default": "complete" + }, + "taxondmp_zip": { + "type": "string", + "mimetype": "text/plain", + "pattern": "^.*\\.(tar\\.gz|gz)$", + "description": "Path to a compressed taxon dmp file", + "default": "ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz" + }, + "taxonmap": { + "type": "string", + "mimetype": "text/plain", + "pattern": "^.*\\.(tar\\.gz|gz)$", + "description": "Path to a compressed taxon map file", + "default": "ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy/accession2taxid/prot.accession2taxid.gz" + }, + "diamond_outfmt": { + "type": "integer", + "description": "One of seven optional output formats for [`diamond/blastp`](https://nf-co.re/modules/diamond_blastp/), indicated by a digit code.", + "enum": [0, 5, 6, 100, 101, 102, 103], + "default": 6 + }, + "diamond_blast_columns": { + "type": "string", + "description": "Accompanied optional input parameter to `diamond_outfmt`: `*.txt (6)` output format. Space separated list of columns to be included. Options: qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore." + } + } + }, "institutional_config_options": { "title": "Institutional config options", "type": "object", @@ -414,6 +458,9 @@ { "$ref": "#/$defs/input_output_options" }, + { + "$ref": "#/$defs/diamond_options" + }, { "$ref": "#/$defs/institutional_config_options" }, @@ -433,4 +480,4 @@ "$ref": "#/$defs/prediction_params" } ] -} +} \ No newline at end of file diff --git a/subworkflows/local/diamond/diamond.excalidraw.png b/subworkflows/local/diamond/diamond.excalidraw.png new file mode 100644 index 0000000..5da0835 Binary files /dev/null and b/subworkflows/local/diamond/diamond.excalidraw.png differ diff --git a/subworkflows/local/diamond/main.nf b/subworkflows/local/diamond/main.nf new file mode 100644 index 0000000..675da90 --- /dev/null +++ b/subworkflows/local/diamond/main.nf @@ -0,0 +1,48 @@ +include { NCBIREFSEQDOWNLOAD } from '../../../modules/local/ncbirefseqdownload/main' +include { DIAMONDPREPARETAXA } from '../../../modules/local/diamondpreparetaxa/main' +include { DIAMOND_MAKEDB } from '../../../modules/nf-core/diamond/makedb/main' +include { DIAMOND_BLASTP } from '../../../modules/nf-core/diamond/blastp/main' + +workflow DIAMOND { + take: + ch_fasta // channel: [ val(meta), [ fasta ] ] + + main: + + // Local modules of Diamond subworkflow + NCBIREFSEQDOWNLOAD( + params.refseq_release + ) + ch_diamond_reference_fasta = NCBIREFSEQDOWNLOAD.out.refseq_fasta.map { file -> [ [id: 'refseq'], file ] } + + DIAMONDPREPARETAXA ( + params.taxondmp_zip + ) + ch_taxonnodes = DIAMONDPREPARETAXA.out.taxonnodes + ch_taxonnames = DIAMONDPREPARETAXA.out.taxonnames + + // nf-core modules of Diamond subworkflow + DIAMOND_MAKEDB ( + ch_diamond_reference_fasta, + params.taxonmap, + ch_taxonnodes, + ch_taxonnames + ) + ch_diamond_db = DIAMOND_MAKEDB.out.db.first() + + DIAMOND_BLASTP ( + ch_fasta, + ch_diamond_db, + params.diamond_outfmt, + params.diamond_blast_columns ?: '', + ) + + emit: + blast = DIAMOND_BLASTP.out.blast + xml = DIAMOND_BLASTP.out.xml + txt = DIAMOND_BLASTP.out.txt + daa = DIAMOND_BLASTP.out.daa + sam = DIAMOND_BLASTP.out.sam + tsv = DIAMOND_BLASTP.out.tsv + paf = DIAMOND_BLASTP.out.paf +} diff --git a/subworkflows/local/diamond/meta.yml b/subworkflows/local/diamond/meta.yml new file mode 100644 index 0000000..c3a8faa --- /dev/null +++ b/subworkflows/local/diamond/meta.yml @@ -0,0 +1,74 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "diamond" +description: Downloads NCBI RefSeq and taxonomy databases, builds a DIAMOND database, and performs protein sequence alignment using DIAMOND BLASTP +keywords: + - alignment + - diamond + - blastp + - protein + - refseq + - taxonomy + +components: + - ncbirefseqdownload + - diamondpreparetaxa + - diamond/makedb + - diamond/blastp + +input: + - ch_fasta: + type: file + description: | + The input channel containing the protein FASTA files + Structure: [ val(meta), path(fasta) ] + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + +output: + - blast: + type: file + description: | + Channel containing BLAST output files + Structure: [ val(meta), path(blast) ] + pattern: "*" + - xml: + type: file + description: | + Channel containing XML output files + Structure: [ val(meta), path(xml) ] + pattern: "*.xml" + - txt: + type: file + description: | + Channel containing TXT output files + Structure: [ val(meta), path(txt) ] + pattern: "*.txt" + - daa: + type: file + description: | + Channel containing DIAMOND archive output files + Structure: [ val(meta), path(daa) ] + pattern: "*.daa" + - sam: + type: file + description: | + Channel containing SAM alignment files + Structure: [ val(meta), path(sam) ] + pattern: "*.sam" + - tsv: + type: file + description: | + Channel containing TSV output files + Structure: [ val(meta), path(tsv) ] + pattern: "*.tsv" + - paf: + type: file + description: | + Channel containing PAF alignment files + Structure: [ val(meta), path(paf) ] + pattern: "*.paf" + +authors: + - "@tracelail" +maintainers: + - "@tracelail" \ No newline at end of file diff --git a/subworkflows/local/diamond/tests/main.nf.test b/subworkflows/local/diamond/tests/main.nf.test new file mode 100644 index 0000000..4dda7c0 --- /dev/null +++ b/subworkflows/local/diamond/tests/main.nf.test @@ -0,0 +1,160 @@ +nextflow_workflow { + + name "Test Subworkflow DIAMOND" + script "../main.nf" + workflow "DIAMOND" + + tag "subworkflows" + tag "subworkflows_" + tag "subworkflows/diamond" + tag "ncbirefseqdownload" + tag "diamondpreparetaxa" + tag "diamond/makedb" + tag "diamond/blastp" + + test("Test Diamond subworkflow success -- 6 - TXT output - no columns specified") { + + when { + params { + refseq_release = 'other' + taxondmp_zip = "file://${moduleDir}/../../../../modules/local/diamondpreparetaxa/tests/mini_taxdump.tar.gz" + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = '' + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: true)] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.out.txt.size() > 0 }, + { assert snapshot(workflow.out).match() } + ) + } + } + + test("Test Diamond subworkflow success -- 6 - TXT output - no columns specified -- stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + params { + refseq_release = 'other' + taxondmp_zip = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = '' + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false)] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } + + test("Test Diamond subworkflow -- 6 - TXT output - with columns -- stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + params { + refseq_release = 'other' + taxondmp_zip = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = 'qseqid sseqid pident length evalue bitscore' + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false)] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } + + test("Test Diamond subworkflow -- 0 - BLAST output -- stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + params { + refseq_release = 'other' + taxondmp_zip = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 0 + diamond_blast_columns = '' + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false)] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } + + test("Test DIAMOND subworkflow success -- 6 - TXT output -- stub - two samples") { + tag "stub" + tag "CI" + + options "-stub" + + when { + params { + refseq_release = 'other' + taxondmp_zip = "file://${moduleTestDir}/mini_taxdump.tar.gz" + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = '' + } + workflow { + """ + input[0] = channel.of( + [ [id:'sample1'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false) ], + [ [id:'sample2'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false) ] + ) + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.out.txt.size() == 2 }, + { assert snapshot(workflow.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/subworkflows/local/diamond/tests/main.nf.test.snap b/subworkflows/local/diamond/tests/main.nf.test.snap new file mode 100644 index 0000000..321a5a1 --- /dev/null +++ b/subworkflows/local/diamond/tests/main.nf.test.snap @@ -0,0 +1,638 @@ +{ + "Test Diamond subworkflow -- 0 - BLAST output -- stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.blast:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "blast": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.blast:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-08-19T19:47:49.699309341", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, + "versions_stub_outfmt0": { + "content": [ + [ + "versions.yml:md5,88882983f101071ff12ab9ad8862946c", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,af268b7575a939dcbb762d66f0d34775", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ] + ], + "timestamp": "2026-04-06T13:40:55.505482355", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "versions_stub": { + "content": [ + [ + "versions.yml:md5,88882983f101071ff12ab9ad8862946c", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,af268b7575a939dcbb762d66f0d34775", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ] + ], + "timestamp": "2026-04-06T13:40:32.043632868", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "versions_stub_columns": { + "content": [ + [ + "versions.yml:md5,88882983f101071ff12ab9ad8862946c", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,af268b7575a939dcbb762d66f0d34775", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ] + ], + "timestamp": "2026-04-06T13:40:43.827166513", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "versions": { + "content": [ + [ + "versions.yml:md5,4b60d5e52704e15aa6a464a001e875a1", + "versions.yml:md5,88882983f101071ff12ab9ad8862946c", + "versions.yml:md5,af268b7575a939dcbb762d66f0d34775", + "versions.yml:md5,be8e9e782750442e8150f83181c2b96d" + ] + ], + "timestamp": "2026-04-06T13:40:20.319529478", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Test DIAMOND subworkflow success -- 6 - TXT output -- stub - two samples": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "sample1", + "db": "refseq" + }, + "sample1.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "sample2", + "db": "refseq" + }, + "sample2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "sample1", + "db": "refseq" + }, + "sample1.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "sample2", + "db": "refseq" + }, + "sample2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-08-19T19:44:48.388726426", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, + "Test Diamond subworkflow success -- 6 - TXT output - no columns specified -- stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-08-19T19:47:32.344749385", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, + "Test Diamond subworkflow -- outfmt 6 with columns -- stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + "versions.yml:md5,1391f8cce96fafd55bdede8ec85c39c7", + "versions.yml:md5,80e189917535cac95750651a49f69858", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "test" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,1391f8cce96fafd55bdede8ec85c39c7", + "versions.yml:md5,80e189917535cac95750651a49f69858", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-31T11:15:15.991809553", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Test DIAMOND subworkflow success - stub - two samples": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "sample1", + "db": "refseq" + }, + "sample1.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "sample2", + "db": "refseq" + }, + "sample2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "sample1", + "db": "refseq" + }, + "sample1.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "sample2", + "db": "refseq" + }, + "sample2.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-08-19T19:40:11.969696247", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, + "Test Diamond subworkflow -- outfmt 0 txt output -- stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.blast:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + "versions.yml:md5,840f3993fa9f5a9a676d5308554e4cc0", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,d820aab4674fbcc2483c9fcc7f03e48c", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ], + "blast": [ + [ + { + "id": "test" + }, + "test.blast:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + + ], + "versions": [ + "versions.yml:md5,840f3993fa9f5a9a676d5308554e4cc0", + "versions.yml:md5,aacdcbf79da04117d0786d0423161380", + "versions.yml:md5,d820aab4674fbcc2483c9fcc7f03e48c", + "versions.yml:md5,fd77953bb9df9417c91759e312630970" + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-03-31T11:15:25.063735348", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Test Diamond subworkflow success -- 6 - TXT output - no columns specified": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.refseq.txt:md5,f58fdf4044f9e4bf42da7e2c05f581f5" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + "versions.yml:md5,4b60d5e52704e15aa6a464a001e875a1", + "versions.yml:md5,be8e9e782750442e8150f83181c2b96d" + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.refseq.txt:md5,f58fdf4044f9e4bf42da7e2c05f581f5" + ] + ], + "versions": [ + "versions.yml:md5,4b60d5e52704e15aa6a464a001e875a1", + "versions.yml:md5,be8e9e782750442e8150f83181c2b96d" + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-04-09T10:10:56.207273523", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "Test Diamond subworkflow -- 6 - TXT output - with columns -- stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "blast": [ + + ], + "daa": [ + + ], + "paf": [ + + ], + "sam": [ + + ], + "tsv": [ + + ], + "txt": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "xml": [ + + ] + } + ], + "timestamp": "2026-08-19T19:47:41.118581828", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + } +} \ No newline at end of file diff --git a/subworkflows/local/diamond/tests/mini_prot.accession2taxid.gz b/subworkflows/local/diamond/tests/mini_prot.accession2taxid.gz new file mode 100644 index 0000000..2a4ed3c Binary files /dev/null and b/subworkflows/local/diamond/tests/mini_prot.accession2taxid.gz differ diff --git a/subworkflows/local/diamond/tests/test_refseq.fasta b/subworkflows/local/diamond/tests/test_refseq.fasta new file mode 100644 index 0000000..6110c09 --- /dev/null +++ b/subworkflows/local/diamond/tests/test_refseq.fasta @@ -0,0 +1,32 @@ +>WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] +MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIG +ASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSP +FFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFG +WNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQG +VMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETS +A +>WP_430799656.1 class D beta-lactamase OXA-1379 [medical waste metagenome] +MNKYLALLILLVYSQVSMAESIRENKSWNEVFAQESVEGVFVLCKSSKNDCITNNKERALLAFIPASTFKIANALIALET +GVVKSEHQIFKWGGEPRDMKQWEQDFTLRGAMQASAVPVFQQFAREIGEKRMQSYLGEFAYGNSNIDGGIDLFWLEGGLR +ISAINQIGFLESLYENKLPISERNQLIVKDALISEATPAYLIRSKTGYTGIKGKIQPGIAWWVGWVEKGTEVYFFAFNMN +IDNESKLPARKSIPTKIMQSEGVLNGS +>WP_148044478.1 phosphoethanolamine--lipid A transferase MCR-5.4 [hospital metagenome] +MRLSAFITFLKMRPQVRTEFLTLFISLVFTLLCNGVFWNALLAGRDSLTSGTWLMLLCTGLLITGLQWLLLLLVATRWSV +KPLLILLAVMTPAAVYFMRNYGVYFDKAMLRNLMETDVREASELLQWRMLPYLLVAAVSVWWIARVRVLRTGWKQAVMMR +SACLAGALAMISMGLWPVMDVLIPTLRENKPLRYLITPANYVISGIRVLTEQASSSADEAREVVAADAHRGPQEQGRRPR +ALVLVVGETVRAANWGLSGYERQTTPELAARDVINFSDVTSCGTDTATSLPCMFSLNGRRDYDERQIRRRESVLHVLNRS +DVNILWRDNQSGCKGVCDGLPFENLSSAGHPTLCHGERCLDEILLEGLAEKITTSRSDMLIVLHMLGNHGPAYFQRYPAS +YRRWSPTCDTTDLASCSHEALVNTYDNAVLYTDHVLARTIDLLSGIRSHDTALLYVSDHGESLGEKGLYLHGIPYVIAPD +EQIKVPMIWWQSSQVYADQACMQTHASRAPVSHDHLFHTLLGMFDVKTAAYTPELDLLATCRKGQPQ +>WP_168247882.1 extended-spectrum class C beta-lactamase IDC-2 [sediment metagenome] +MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDTSRVRTTVDAAILPLMSQHDIPGMVVGLILDGQPYVVTYGVASKEA +NVPVAEATLFEIGSVSKVFTATLAAYAQTTGKLSLDDHPGKYLPQLKGTPIDQATLLHLGTYTAGGLPLQFPDEVTGEVA +VMDYFRNWTPLAPPGTRREYSNASPGLLGLVAASALDDDFATLMQSTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRPVR +VNEGPLDEQAYGVKTTVSDLLRFVQANIDPSSLEPSMRRAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEM +LFDPQPAYRLTDQTAGERYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWIILEQLASGTDSN +>WP_168247881.1 extended-spectrum class C beta-lactamase IDC-1 [sediment metagenome] +MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDSSRVRAAVDAAILPLMSQHDIPGMAVGLILDGQPYVVTYGVASKET +NVPVAEATLFEIGSVSKVFTATLATYAQATGKLSLDDHPGKYLPHLKGAPIDQATLLHLGTYTAGGLPLQFPDEVTGEAA +VMNYFRNWTPLAPPGTRREYSNASPGLLGVVAASALDDDFATLMQTTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRRVR +VNEGPLDEQAYGVKTTVSDLLRFVQANIDPNSLEPSMRHAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEM +LFDPQPAYRLTDQTAGGQYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWMILEQLASGTDSN diff --git a/subworkflows/local/functional_annotation/main.nf b/subworkflows/local/functional_annotation/main.nf index f14f948..170b0c1 100644 --- a/subworkflows/local/functional_annotation/main.nf +++ b/subworkflows/local/functional_annotation/main.nf @@ -1,3 +1,4 @@ +include { DIAMOND } from '../diamond/main' include { ARIA2 as ARIA2_INTERPROSCAN } from '../../../modules/nf-core/aria2/main' include { ARIA2 as ARIA2_KOFAM_PROFILES } from '../../../modules/nf-core/aria2/main' include { ARIA2 as ARIA2_KOFAM_KO_LIST } from '../../../modules/nf-core/aria2/main' @@ -18,11 +19,38 @@ workflow FUNCTIONAL_ANNOTATION { kofamscan_profiles // string, existing KOfam profiles directory kofamscan_ko_list_url // string, URL to download KOfam KO list kofamscan_ko_list // string, existing KOfam KO list + skip_diamond // boolean main: + def ch_diamond_blast = channel.empty() + def ch_diamond_xml = channel.empty() + def ch_diamond_txt = channel.empty() + def ch_diamond_daa = channel.empty() + def ch_diamond_sam = channel.empty() + def ch_diamond_tsv = channel.empty() + def ch_diamond_paf = channel.empty() def ch_interproscan_tsv = channel.empty() def ch_kofamscan_tsv = channel.empty() + // + // SUBWORKFLOW: Run Diamond + // + if (!skip_diamond) { + DIAMOND( + ch_fasta + ) + ch_diamond_blast = DIAMOND.out.blast + ch_diamond_xml = DIAMOND.out.xml + ch_diamond_txt = DIAMOND.out.txt + ch_diamond_daa = DIAMOND.out.daa + ch_diamond_sam = DIAMOND.out.sam + ch_diamond_tsv = DIAMOND.out.tsv + ch_diamond_paf = DIAMOND.out.paf + } + + // + // SUBWORKFLOW: Run Interproscan + // if (!skip_interproscan) { def ch_interproscan_db if (interproscan_db) { @@ -70,6 +98,13 @@ workflow FUNCTIONAL_ANNOTATION { } emit: + diamond_blast = ch_diamond_blast + diamond_xml = ch_diamond_xml + diamond_txt = ch_diamond_txt + diamond_daa = ch_diamond_daa + diamond_sam = ch_diamond_sam + diamond_tsv = ch_diamond_tsv + diamond_paf = ch_diamond_paf interproscan_tsv = ch_interproscan_tsv kofamscan_tsv = ch_kofamscan_tsv } diff --git a/subworkflows/local/functional_annotation/meta.yml b/subworkflows/local/functional_annotation/meta.yml index 63e59c3..a6fb1a0 100644 --- a/subworkflows/local/functional_annotation/meta.yml +++ b/subworkflows/local/functional_annotation/meta.yml @@ -1,23 +1,27 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json name: functional_annotation description: | - Performs functional annotation of protein sequences using InterProScan and KOfamScan. - Both databases can be downloaded automatically or supplied locally. + Performs functional annotation of protein sequences using DIAMOND BLASTP + against RefSeq, InterProScan and KOfamScan. Databases can be downloaded + automatically or supplied locally. keywords: - annotation - functional + - protein + - diamond + - interproscan + - blastp + +components: + - diamond - interproscan - kofamscan - kegg - proteins - fasta - -components: - aria2 - untar - gunzip - - interproscan - - kofamscan input: - ch_fasta: @@ -63,8 +67,53 @@ input: type: string description: | Optional path to a pre-existing decompressed KOfam KO list. + - skip_diamond: + type: boolean + description: Skip DIAMOND BLASTP taxonomic classification output: + - diamond_blast: + type: file + description: | + Channel containing BLAST-formatted output files from DIAMOND (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(blast) ] + pattern: "*" + - diamond_xml: + type: file + description: | + Channel containing XML-formatted output files from DIAMOND (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(xml) ] + pattern: "*.xml" + - diamond_txt: + type: file + description: | + Channel containing tabular text output files from DIAMOND (only populated when --diamond_outfmt selects this format; this is the default format) + Structure: [ val(meta), path(txt) ] + pattern: "*.txt" + - diamond_daa: + type: file + description: | + Channel containing DIAMOND archive format output files (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(daa) ] + pattern: "*.daa" + - diamond_sam: + type: file + description: | + Channel containing SAM alignment files from DIAMOND (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(sam) ] + pattern: "*.sam" + - diamond_tsv: + type: file + description: | + Channel containing tab-separated output files from DIAMOND (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(tsv) ] + pattern: "*.tsv" + - diamond_paf: + type: file + description: | + Channel containing PAF alignment files from DIAMOND (only populated when --diamond_outfmt selects this format) + Structure: [ val(meta), path(paf) ] + pattern: "*.paf" - interproscan_tsv: type: file description: | @@ -81,8 +130,11 @@ output: pattern: "*.tsv" authors: - - "@vagkaratzas" - - "@Muskan-2464" - - "@Yixuan39" + - "@eweizy" + - "@tracelail" maintainers: + - "@eweizy" + - "@tracelail" - "@vagkaratzas" + - "@Muskan-2464" + - "@Yixuan39" \ No newline at end of file diff --git a/subworkflows/local/functional_annotation/tests/main.nf.test b/subworkflows/local/functional_annotation/tests/main.nf.test index 3514876..70363e9 100644 --- a/subworkflows/local/functional_annotation/tests/main.nf.test +++ b/subworkflows/local/functional_annotation/tests/main.nf.test @@ -1,16 +1,93 @@ +// nf-core subworkflows test functional_annotation nextflow_workflow { - name "Test Subworkflow FUNCTIONAL_ANNOTATION" script "../main.nf" workflow "FUNCTIONAL_ANNOTATION" tag "subworkflows" + tag "subworkflows_" tag "subworkflows_local" + tag "subworkflows/functional_annotation" tag "functional_annotation" + tag "diamond" + tag "ncbirefseqdownload" + tag "diamondpreparetaxa" + tag "diamond/makedb" + tag "diamond/blastp" + + test("Test FUNCTIONAL_ANNOTATION Diamond execution subworkflow success") { + when { + params { + refseq_release = 'other' + taxondmp_zip = "file://${moduleDir}/../../../../modules/local/diamondpreparetaxa/tests/mini_taxdump.tar.gz" + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = '' + skip_interproscan = true + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: true)] + input[1] = true + input[2] = [] + input[3] = [] + input[4] = true + input[5] = [] + input[6] = [] + input[7] = [] + input[8] = [] + input[9] = false + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } + + test("Test FUNCTIONAL_ANNOTATION Diamond execution subworkflow success - stub") { + tag "stub" + tag "CI" + + options "-stub" + + when { + params { + refseq_release = 'other' + taxondmp_zip = 'ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz' + taxonmap = "${moduleTestDir}/mini_prot.accession2taxid.gz" + diamond_outfmt = 6 + diamond_blast_columns = '' + skip_interproscan = true + } + workflow { + """ + input[0] = [ [id:'test'], file("${moduleTestDir}/test_refseq.fasta", checkIfExists: false)] + input[1] = true + input[2] = [] + input[3] = [] + input[4] = true + input[5] = [] + input[6] = [] + input[7] = [] + input[8] = [] + input[9] = false + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } test("l_asparaginase - faa - functional annotation") { config "./nextflow.config" - when { workflow { """ @@ -26,6 +103,7 @@ nextflow_workflow { input[6] = [] input[7] = [] input[8] = [] + input[9] = true """ } } @@ -34,16 +112,15 @@ nextflow_workflow { { assert workflow.success }, { assert snapshot( path(workflow.out.interproscan_tsv[0][1]).readLines()[0] - .contains("GI|225038609|EFDID|719595|FULL 079fff43a0270e432d339ea71b6f0acf 350 SFLD SFLDS00057 Glutaminase/Asparaginase 17 347 0.0 T") + .contains("GI|225038609|EFDID|719595|FULL 079fff43a0270e432d339ea71b6f0acf 350 SFLD SFLDS00057 Glutaminase/Asparaginase 17 347 0.0 T"), + workflow.out.versions.collect{ path(it).yaml }.unique() ).match()} ) } } test("faa - functional annotation - stub") { - options "-stub" - when { workflow { """ @@ -59,10 +136,10 @@ nextflow_workflow { input[6] = [] input[7] = [] input[8] = [] + input[9] = true """ } } - then { assert workflow.success assertAll( @@ -90,6 +167,7 @@ nextflow_workflow { input[6] = [] input[7] = params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kofamscan/ko_list.gz' input[8] = [] + input[9] = true """ } } diff --git a/subworkflows/local/functional_annotation/tests/main.nf.test.snap b/subworkflows/local/functional_annotation/tests/main.nf.test.snap index 139424b..2a1156f 100644 --- a/subworkflows/local/functional_annotation/tests/main.nf.test.snap +++ b/subworkflows/local/functional_annotation/tests/main.nf.test.snap @@ -21,6 +21,35 @@ "nextflow": "26.04.3" } }, + "Test FUNCTIONAL_ANNOTATION Diamond execution subworkflow success": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,360c40011f1cc989e92af5ec14d367c8" + ], + "diamond_tsv": [ + + ], + "interproscan_tsv": [ + + ], + "versions": [ + "versions.yml:md5,360c40011f1cc989e92af5ec14d367c8" + ] + } + ], + "timestamp": "2026-04-09T10:13:40.576061038", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, "l_asparaginase - faa - functional annotation": { "content": [ true @@ -31,20 +60,103 @@ "nextflow": "26.04.0" } }, + "Test FUNCTIONAL_ANNOTATION Diamond execution subworkflow success - stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + + ], + "8": [ + + ], + "diamond_blast": [ + + ], + "diamond_daa": [ + + ], + "diamond_paf": [ + + ], + "diamond_sam": [ + + ], + "diamond_tsv": [ + + ], + "diamond_txt": [ + [ + { + "id": "test", + "db": "refseq" + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "diamond_xml": [ + + ], + "interproscan_tsv": [ + + ], + "kofamscan_tsv": [ + + ] + } + ], + "timestamp": "2026-08-21T19:35:41.555326075", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } + }, "faa - functional annotation - stub": { "content": [ { "0": [ - + ], "1": [ - + + ], + "2": [ + "versions.yml:md5,360c40011f1cc989e92af5ec14d367c8" + ], + "diamond_tsv": [ + ], "interproscan_tsv": [ - + ], "kofamscan_tsv": [ - + ] } ], @@ -54,4 +166,4 @@ "nextflow": "25.10.4" } } -} +} \ No newline at end of file diff --git a/subworkflows/local/functional_annotation/tests/mini_prot.accession2taxid.gz b/subworkflows/local/functional_annotation/tests/mini_prot.accession2taxid.gz new file mode 100644 index 0000000..2a4ed3c Binary files /dev/null and b/subworkflows/local/functional_annotation/tests/mini_prot.accession2taxid.gz differ diff --git a/subworkflows/local/functional_annotation/tests/test_refseq.fasta b/subworkflows/local/functional_annotation/tests/test_refseq.fasta new file mode 100644 index 0000000..6110c09 --- /dev/null +++ b/subworkflows/local/functional_annotation/tests/test_refseq.fasta @@ -0,0 +1,32 @@ +>WP_031942563.1 tetracycline efflux MFS transporter Tet(B) [Transposon Tn10] +MNSSTKIALVITLLDAMGIGLIMPVLPTLLREFIASEDIANHFGVLLALYALMQVIFAPWLGKMSDRFGRRPVLLLSLIG +ASLDYLLLAFSSALWMLYLGRLLSGITGATGAVAASVIADTTSASQRVKWFGWLGASFGLGLIAGPIIGGFAGEISPHSP +FFIAALLNIVTFLVVMFWFRETKNTRDNTDTEVGVETQSNSVYITLFKTMPILLIIYFSAQLIGQIPATVWVLFTENRFG +WNSMMVGFSLAGLGLLHSVFQAFVAGRIATKWGEKTAVLLEFIADSSAFAFLAFISEGWLDFPVLILLAGGGIALPALQG +VMSIQTKSHEQGALQGLLVSLTNATGVIGPLLFTVIYNHSLPIWDGWIWIIGLAFYCIIILLSMTFMLTPQAQGSKQETS +A +>WP_430799656.1 class D beta-lactamase OXA-1379 [medical waste metagenome] +MNKYLALLILLVYSQVSMAESIRENKSWNEVFAQESVEGVFVLCKSSKNDCITNNKERALLAFIPASTFKIANALIALET +GVVKSEHQIFKWGGEPRDMKQWEQDFTLRGAMQASAVPVFQQFAREIGEKRMQSYLGEFAYGNSNIDGGIDLFWLEGGLR +ISAINQIGFLESLYENKLPISERNQLIVKDALISEATPAYLIRSKTGYTGIKGKIQPGIAWWVGWVEKGTEVYFFAFNMN +IDNESKLPARKSIPTKIMQSEGVLNGS +>WP_148044478.1 phosphoethanolamine--lipid A transferase MCR-5.4 [hospital metagenome] +MRLSAFITFLKMRPQVRTEFLTLFISLVFTLLCNGVFWNALLAGRDSLTSGTWLMLLCTGLLITGLQWLLLLLVATRWSV +KPLLILLAVMTPAAVYFMRNYGVYFDKAMLRNLMETDVREASELLQWRMLPYLLVAAVSVWWIARVRVLRTGWKQAVMMR +SACLAGALAMISMGLWPVMDVLIPTLRENKPLRYLITPANYVISGIRVLTEQASSSADEAREVVAADAHRGPQEQGRRPR +ALVLVVGETVRAANWGLSGYERQTTPELAARDVINFSDVTSCGTDTATSLPCMFSLNGRRDYDERQIRRRESVLHVLNRS +DVNILWRDNQSGCKGVCDGLPFENLSSAGHPTLCHGERCLDEILLEGLAEKITTSRSDMLIVLHMLGNHGPAYFQRYPAS +YRRWSPTCDTTDLASCSHEALVNTYDNAVLYTDHVLARTIDLLSGIRSHDTALLYVSDHGESLGEKGLYLHGIPYVIAPD +EQIKVPMIWWQSSQVYADQACMQTHASRAPVSHDHLFHTLLGMFDVKTAAYTPELDLLATCRKGQPQ +>WP_168247882.1 extended-spectrum class C beta-lactamase IDC-2 [sediment metagenome] +MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDTSRVRTTVDAAILPLMSQHDIPGMVVGLILDGQPYVVTYGVASKEA +NVPVAEATLFEIGSVSKVFTATLAAYAQTTGKLSLDDHPGKYLPQLKGTPIDQATLLHLGTYTAGGLPLQFPDEVTGEVA +VMDYFRNWTPLAPPGTRREYSNASPGLLGLVAASALDDDFATLMQSTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRPVR +VNEGPLDEQAYGVKTTVSDLLRFVQANIDPSSLEPSMRRAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEM +LFDPQPAYRLTDQTAGERYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWIILEQLASGTDSN +>WP_168247881.1 extended-spectrum class C beta-lactamase IDC-1 [sediment metagenome] +MPRTESVPSKSLVVRTLLLVFACLFPMAVPAVEDSSRVRAAVDAAILPLMSQHDIPGMAVGLILDGQPYVVTYGVASKET +NVPVAEATLFEIGSVSKVFTATLATYAQATGKLSLDDHPGKYLPHLKGAPIDQATLLHLGTYTAGGLPLQFPDEVTGEAA +VMNYFRNWTPLAPPGTRREYSNASPGLLGVVAASALDDDFATLMQTTVFPAFGMTDSFIHVPDRKMPDYAWGYRKDRRVR +VNEGPLDEQAYGVKTTVSDLLRFVQANIDPNSLEPSMRHAVEATQVGYFRAGTLVQGLGWEKYPYPVSREWLLGGNAKEM +LFDPQPAYRLTDQTAGGQYLFNKTGSTGGFATYVAFVPARKIGIVMLANRSYPIPDRVEAAWMILEQLASGTDSN diff --git a/tests/nextflow.config b/tests/nextflow.config index 519bc8e..60fceaf 100644 --- a/tests/nextflow.config +++ b/tests/nextflow.config @@ -10,4 +10,34 @@ params { pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/proteinannotator/' } +aws.client.anonymous = true // fixes S3 access issues on self-hosted runners +params.outdir = './results' + +process { + withName: NCBIREFSEQDOWNLOAD { + cpus= 1 + memory= 4.GB + } +} + +process { + withName: DIAMONDPREPARETAXA { + cpus= 1 + memory= 4.GB + } +} + +process { + withName: DIAMOND_MAKEDB { + cpus= 1 + memory= 4.GB + } +} + +process { + withName: DIAMOND_BLASTP { + cpus= 1 + memory= 4.GB + } +} aws.client.anonymous = true diff --git a/workflows/proteinannotator.nf b/workflows/proteinannotator.nf index b8389d7..6d7a2f2 100644 --- a/workflows/proteinannotator.nf +++ b/workflows/proteinannotator.nf @@ -47,6 +47,7 @@ workflow PROTEINANNOTATOR { kofamscan_profiles // string, existing KOfam profiles directory kofamscan_ko_list_url // string, URL to download the compressed KOfam KO list kofamscan_ko_list // string, existing KOfam KO list + skip_diamond // boolean skip_s4pred // boolean main: @@ -81,7 +82,8 @@ workflow PROTEINANNOTATOR { kofamscan_profiles_url, kofamscan_profiles, kofamscan_ko_list_url, - kofamscan_ko_list + kofamscan_ko_list, + skip_diamond ) if (!skip_s4pred) {