diff --git a/modules/nf-core/localcdsearch/annotate/environment.yml b/modules/nf-core/localcdsearch/annotate/environment.yml new file mode 100644 index 000000000000..cdef14c5c0d4 --- /dev/null +++ b/modules/nf-core/localcdsearch/annotate/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::local-cd-search=0.3.0" diff --git a/modules/nf-core/localcdsearch/annotate/main.nf b/modules/nf-core/localcdsearch/annotate/main.nf new file mode 100644 index 000000000000..4baa3bda0692 --- /dev/null +++ b/modules/nf-core/localcdsearch/annotate/main.nf @@ -0,0 +1,53 @@ +process LOCALCDSEARCH_ANNOTATE { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e1/e1ed921c933d8eeeb0db6d72ece09ec25edab9ad441c84b070acff1592af2d54/data' : + 'biocontainers/local-cd-search:0.3.0--pyhdfd78af_0' }" + + input: + tuple val(meta), path(fasta) + path db + val sites + + output: + tuple val(meta), path("*_results.tsv"), emit: result + tuple val(meta), path("*_sites.tsv") , emit: annot_sites, optional: true + tuple val("${task.process}"), val('local-cd-search'), eval("echo ${VERSION}"), topic: versions, emit: versions_localcdsearch + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def prefix = task.ext.prefix ?: "${meta.id}" + def val_flag = sites ? "--sites-output ${prefix}_sites.tsv" : '' + def is_compressed = fasta.getExtension() == "gz" + def fasta_name = is_compressed ? fasta.getBaseName() : fasta + def uncompress_input = is_compressed ? "gzip -c -d ${fasta} > ${fasta_name}" : '' + """ + $uncompress_input + + local-cd-search \\ + annotate \\ + $args \\ + $val_flag \\ + --threads $task.cpus \\ + ${fasta_name} \\ + ${prefix}_results.tsv \\ + ${db} + """ + + stub: + def args = task.ext.args ?: '' + VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo $args + touch ${prefix}_results.tsv + ${sites ? "touch ${prefix}_sites.tsv" : ''} + """ +} diff --git a/modules/nf-core/localcdsearch/annotate/meta.yml b/modules/nf-core/localcdsearch/annotate/meta.yml new file mode 100644 index 000000000000..184853635ab3 --- /dev/null +++ b/modules/nf-core/localcdsearch/annotate/meta.yml @@ -0,0 +1,89 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "localcdsearch_annotate" +description: A command-line tool for local protein domain annotation using NCBI's Conserved Domain Database (CDD) +keywords: + - cdd + - rpsblast + - rpsbproc + - protein + - domain + - annotation +tools: + - "localcdsearch": + description: "Protein annotation using local PSSM databases from CDD." + homepage: "https://github.com/apcamargo/local-cd-search" + documentation: "https://github.com/apcamargo/local-cd-search" + tool_dev_url: "https://github.com/apcamargo/local-cd-search" + licence: ["MIT"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: Input fasta file containing protein queries sequences + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + ontologies: + - edam: "http://edamontology.org/format_1929" # FASTA + - db: + type: directory + description: Directory containing the metadata and databse directories + pattern: "*" + - sites: + type: boolean + description: When true an extra tsv output file is generated + +output: + result: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*_results.tsv": + type: file + description: tab-separated file with hits filtered by CDD's curated bit-score thresholds + pattern: "*_results.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 # TSV + annot_sites: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*_sites.tsv": + type: file + description: If --sites-output is specified, an additional tab-separated file is created with functional site annotations + pattern: "*_sites.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 # TSV + versions_localcdsearch: + - - "${task.process}": + type: string + description: The name of the process + - "local-cd-search": + type: string + description: The name of the tool + - "echo ${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 + - local-cd-search: + type: string + description: The name of the tool + - echo ${VERSION}: + type: eval + description: The expression to obtain the version of the tool +authors: + - "@Ales-ibt" +maintainers: + - "@Ales-ibt" diff --git a/modules/nf-core/localcdsearch/annotate/tests/main.nf.test b/modules/nf-core/localcdsearch/annotate/tests/main.nf.test new file mode 100644 index 000000000000..a6c268608bb7 --- /dev/null +++ b/modules/nf-core/localcdsearch/annotate/tests/main.nf.test @@ -0,0 +1,126 @@ +nextflow_process { + + name "Test Process LOCALCDSEARCH_ANNOTATE" + script "../main.nf" + process "LOCALCDSEARCH_ANNOTATE" + + tag "modules" + tag "modules_nfcore" + tag "localcdsearch" + tag "localcdsearch/annotate" + tag "localcdsearch/download" + + setup { + run("LOCALCDSEARCH_DOWNLOAD") { + script "../../download/main.nf" + process { + """ + input[0] = ['smart'] + """ + } + } + } + + test("sarscov2 - smart") { + + when { + process { + """ + input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = LOCALCDSEARCH_DOWNLOAD.out.db + input[2] = false + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot( + process.out.result, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + + test("sarscov2 - smart - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = LOCALCDSEARCH_DOWNLOAD.out.db + input[2] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.result, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + + test("sarscov2 - smart - sites") { + + when { + process { + """ + input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = LOCALCDSEARCH_DOWNLOAD.out.db + input[2] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.result, + process.out.annot_sites, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + + test("sarscov2 - smart - sites - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ] + input[1] = LOCALCDSEARCH_DOWNLOAD.out.db + input[2] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.result, + process.out.annot_sites, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/localcdsearch/annotate/tests/main.nf.test.snap b/modules/nf-core/localcdsearch/annotate/tests/main.nf.test.snap new file mode 100644 index 000000000000..4643e75fd0dd --- /dev/null +++ b/modules/nf-core/localcdsearch/annotate/tests/main.nf.test.snap @@ -0,0 +1,122 @@ +{ + "sarscov2 - smart - sites": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_results.tsv:md5,9b702972e196a5a0c78caf731ca8aa98" + ] + ], + [ + [ + { + "id": "test" + }, + "test_sites.tsv:md5,1f23b91ab52ed005e35c1fb3b07f36da" + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_ANNOTATE", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:17:49.533079" + }, + "sarscov2 - smart": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_results.tsv:md5,9b702972e196a5a0c78caf731ca8aa98" + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_ANNOTATE", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:17:24.849122" + }, + "sarscov2 - smart - sites - stub": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_results.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test" + }, + "test_sites.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_ANNOTATE", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:17:54.933935" + }, + "sarscov2 - smart - stub": { + "content": [ + [ + [ + { + "id": "test" + }, + "test_results.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_ANNOTATE", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:17:30.019737" + } +} \ No newline at end of file diff --git a/modules/nf-core/localcdsearch/download/environment.yml b/modules/nf-core/localcdsearch/download/environment.yml new file mode 100644 index 000000000000..cdef14c5c0d4 --- /dev/null +++ b/modules/nf-core/localcdsearch/download/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::local-cd-search=0.3.0" diff --git a/modules/nf-core/localcdsearch/download/main.nf b/modules/nf-core/localcdsearch/download/main.nf new file mode 100644 index 000000000000..ca0e1670ceaf --- /dev/null +++ b/modules/nf-core/localcdsearch/download/main.nf @@ -0,0 +1,39 @@ +process LOCALCDSEARCH_DOWNLOAD { + tag "${databases.join(', ')}" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e1/e1ed921c933d8eeeb0db6d72ece09ec25edab9ad441c84b070acff1592af2d54/data' : + 'biocontainers/local-cd-search:0.3.0--pyhdfd78af_0' }" + + input: + val databases + + output: + path('database/'), emit: db + tuple val("${task.process}"), val('local-cd-search'), eval("echo ${VERSION}"), topic: versions, emit: versions_localcdsearch + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + mkdir database/ + local-cd-search \\ + download \\ + ${args} \\ + database/ \\ + ${databases.join(' ')} + """ + + stub: + def args = task.ext.args ?: '' + VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + echo $args + mkdir database/ + """ +} diff --git a/modules/nf-core/localcdsearch/download/meta.yml b/modules/nf-core/localcdsearch/download/meta.yml new file mode 100644 index 000000000000..c474601c454c --- /dev/null +++ b/modules/nf-core/localcdsearch/download/meta.yml @@ -0,0 +1,59 @@ +name: "localcdsearch_download" +description: A command-line tool for downloading databases for local protein domain annotation using + NCBI's Conserved Domain Database (CDD) +keywords: + - cdd + - rpsblast + - rpsbproc + - protein + - domain + - annotation + - download +tools: + - "localcdsearch": + description: "Protein annotation using local PSSM databases from CDD." + homepage: "https://github.com/apcamargo/local-cd-search" + documentation: "https://github.com/apcamargo/local-cd-search" + tool_dev_url: "https://github.com/apcamargo/local-cd-search" + licence: ["MIT"] + identifier: "" + +input: + - databases: + type: list + description: | + List of database names to download. Can be a single database name or multiple names. + Valid options: cdd, cdd_ncbi, cog, kog, pfam, prk, smart, tigr + pattern: "cdd|cdd_ncbi|cog|kog|pfam|prk|smart|tigr" +output: + db: + - "database/": + type: directory + description: Directory containing downloaded CDD databases + ontologies: + - edam: http://edamontology.org/data_1049 # The name of a directory + versions_localcdsearch: + - - ${task.process}: + type: string + description: The name of the process + - local-cd-search: + type: string + description: The name of the tool + - echo ${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 + - local-cd-search: + type: string + description: The name of the tool + - echo ${VERSION}: + type: eval + description: The expression to obtain the version of the tool +authors: + - "@Ales-ibt" +maintainers: + - "@Ales-ibt" diff --git a/modules/nf-core/localcdsearch/download/tests/main.nf.test b/modules/nf-core/localcdsearch/download/tests/main.nf.test new file mode 100644 index 000000000000..195d92959644 --- /dev/null +++ b/modules/nf-core/localcdsearch/download/tests/main.nf.test @@ -0,0 +1,102 @@ +nextflow_process { + + name "Test Process LOCALCDSEARCH_DOWNLOAD" + script "../main.nf" + process "LOCALCDSEARCH_DOWNLOAD" + + tag "modules" + tag "modules_nfcore" + tag "localcdsearch" + tag "localcdsearch/download" + + test("Download one database - Smart") { + + when { + process { + """ + input[0] = ['smart'] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() } + ) + } + + } + + test("Download one database - Smart - stub") { + + options "-stub" + + when { + process { + """ + input[0] = ['smart'] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } + + + test("Download multiple databases - Smart, Tigr") { + + when { + process { + """ + input[0] = ['smart', 'tigr'] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } + + test("Download multiple databases - Smart, Tigr - stub") { + + options "-stub" + + when { + process { + """ + input[0] = ['smart', 'tigr'] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } + +} diff --git a/modules/nf-core/localcdsearch/download/tests/main.nf.test.snap b/modules/nf-core/localcdsearch/download/tests/main.nf.test.snap new file mode 100644 index 000000000000..d92550c6b39c --- /dev/null +++ b/modules/nf-core/localcdsearch/download/tests/main.nf.test.snap @@ -0,0 +1,165 @@ +{ + "Download one database - Smart - stub": { + "content": [ + [ + [ + + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_DOWNLOAD", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:04:01.191164" + }, + "Download one database - Smart": { + "content": [ + [ + [ + [ + "Smart.aux:md5,4676e5073e915b31726844ed20a768d2", + "Smart.freq:md5,2fa7da70eb0697574ab484d625493b46", + "Smart.loo:md5,c17ab45e4e8e7316adc9148d39e40f4b", + "Smart.pal:md5,c1e55902129ad5193a82bebb545c4563", + "Smart.pdb:md5,fb463e0703f2bd9b75068b1f0eb71a5d", + "Smart.phr:md5,acb5655696f6948baf7ba8064f7adb58", + "Smart.pin:md5,af1c29799b5c5168481bceb3c6d8cdd8", + "Smart.pos:md5,4a1c4bc186ba31897ac53ecaa2749cdf", + "Smart.pot:md5,8954644983f3cf5d0d24cbcc1a531a21", + "Smart.psq:md5,ca89b28ce23aa7e7246359293ec0a480", + "Smart.ptf:md5,36ec33f1546d8065dce4d7d646b9d707", + "Smart.pto:md5,9a94d5d06ba316923905c46eb30c76bc", + "Smart.rps:md5,fc24261c5717fc4b4696516a330eba5e" + ], + [ + "bitscore_specific.txt:md5,417ab1c1223f42a38cb4c0caee8165f5", + "cddannot.dat:md5,60073848cd4fac905fe5c3a2cacb0dde", + "cddannot_generic.dat:md5,7b1f2e6149469f394b7688cb8685d111", + "cddid.tbl:md5,51831ce178d98aeb2b9b3cdebe9069fe", + "cdtrack.txt:md5,dc94bb9a8e8027d40a344d78828c2661", + "family_superfamily_links:md5,3af9f63b6aa9ab822666c77059fe9c08" + ] + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_DOWNLOAD", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:03:57.328825" + }, + "Download multiple databases - Smart, Tigr - stub": { + "content": [ + [ + [ + + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_DOWNLOAD", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:04:44.588308" + }, + "Download multiple databases - Smart, Tigr": { + "content": [ + [ + [ + [ + "Smart.aux:md5,4676e5073e915b31726844ed20a768d2", + "Smart.freq:md5,2fa7da70eb0697574ab484d625493b46", + "Smart.loo:md5,c17ab45e4e8e7316adc9148d39e40f4b", + "Smart.pal:md5,c1e55902129ad5193a82bebb545c4563", + "Smart.pdb:md5,fb463e0703f2bd9b75068b1f0eb71a5d", + "Smart.phr:md5,acb5655696f6948baf7ba8064f7adb58", + "Smart.pin:md5,af1c29799b5c5168481bceb3c6d8cdd8", + "Smart.pos:md5,4a1c4bc186ba31897ac53ecaa2749cdf", + "Smart.pot:md5,8954644983f3cf5d0d24cbcc1a531a21", + "Smart.psq:md5,ca89b28ce23aa7e7246359293ec0a480", + "Smart.ptf:md5,36ec33f1546d8065dce4d7d646b9d707", + "Smart.pto:md5,9a94d5d06ba316923905c46eb30c76bc", + "Smart.rps:md5,fc24261c5717fc4b4696516a330eba5e" + ], + [ + "Tigr.00.aux:md5,77c6dde6261801c4931ca6887ef5f3bd", + "Tigr.00.freq:md5,d754f8d0b8f8d6fa03ab8c975f12a626", + "Tigr.00.loo:md5,95ccf669e5110f39408a84f5cbc36c9f", + "Tigr.00.pdb:md5,d24ae88caeeade489b207925e89e23cb", + "Tigr.00.phr:md5,28c3c0e455b23366a20fec10d9dad8b3", + "Tigr.00.pin:md5,ede33d2dfdf358256def9c7c33ce9d3a", + "Tigr.00.pos:md5,f9eecf080eea2f4d92d1a901c4240090", + "Tigr.00.pot:md5,6a66041ed547e097f4fd3c7844cd7f30", + "Tigr.00.psq:md5,1d6a57b8138949f6e8b5da300d25a6eb", + "Tigr.00.ptf:md5,d62636ed1d2e68c73187781249850687", + "Tigr.00.pto:md5,80cf92e1c5ab21ba75f2d785b9447e22", + "Tigr.00.rps:md5,23e2b0fa0623ed2cc93a14ea2120d37c", + "Tigr.01.aux:md5,e28ca085ae533d35c80ebf61e49b8539", + "Tigr.01.freq:md5,69e42176dfed09fea8ea86a76b759920", + "Tigr.01.loo:md5,30cf041e222a3fd03eb51dde4861da8a", + "Tigr.01.pdb:md5,394e696f67d5b6157e057dcfcff601c8", + "Tigr.01.phr:md5,449af45813ae62dd542716af8ecdca4a", + "Tigr.01.pin:md5,f791ed2bec725729d48675969def0c02", + "Tigr.01.pos:md5,4209b291fb02a88cc1b4d2f137c20150", + "Tigr.01.pot:md5,6c7581b0b75d936a7ae3c2155412c200", + "Tigr.01.psq:md5,333fbb79a8929af7ecd74cacd5790ab5", + "Tigr.01.ptf:md5,8ef602b360a790032a66502e887b1aa7", + "Tigr.01.pto:md5,b25c40003d61daeaff15a49cb2fe7f59", + "Tigr.01.rps:md5,c38a0e4c93a08fd9a98aafb718768ab7", + "Tigr.pal:md5,f9dc15c5f5808ff34ff38a4a30613ee0" + ], + [ + "bitscore_specific.txt:md5,417ab1c1223f42a38cb4c0caee8165f5", + "cddannot.dat:md5,60073848cd4fac905fe5c3a2cacb0dde", + "cddannot_generic.dat:md5,7b1f2e6149469f394b7688cb8685d111", + "cddid.tbl:md5,51831ce178d98aeb2b9b3cdebe9069fe", + "cdtrack.txt:md5,dc94bb9a8e8027d40a344d78828c2661", + "family_superfamily_links:md5,3af9f63b6aa9ab822666c77059fe9c08" + ] + ] + ], + { + "versions_localcdsearch": [ + [ + "LOCALCDSEARCH_DOWNLOAD", + "local-cd-search", + "0.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2026-01-09T14:04:38.90845" + } +} \ No newline at end of file