Skip to content

Commit 04dcc4d

Browse files
Ales-ibtjfy133vagkaratzas
authored
Feature/localcdsearch (#9632)
* local-cd-search annotate and download modules * Fixing lint * Update localcdsearch tool metadata in meta.yml * Fix container URL selection logic in main.nf * Fix container URL for local-cd-search * Fix container URL for local-cd-search * Fix container URL for local-cd-search * Fix container URL for local-cd-search * Fix container URL for local-cd-search * Update modules/nf-core/localcdsearch/annotate/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/main.nf Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/nf-core/localcdsearch/download/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Singularity container added * edamontology added * Updating test for one input only * Updating snap * Updating test for db downloding * Update version handling in main.nf * Update version expression in meta.yml * Refactor version handling in main.nf Updated version information to use a variable for better maintainability. * Update version retrieval expression in meta.yml * Add version information to stub Added version information for the tool in the main.nf file. * Add version information to stub Added version information to the main.nf file. * Update modules/nf-core/localcdsearch/download/meta.yml Co-authored-by: Evangelos Karatzas <32259775+vagkaratzas@users.noreply.github.com> * Refactor assertions to include process success check * Refactor assertions for process success in tests * Update container URL for local-cd-search * Remove redundant success assertion in tests --------- Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> Co-authored-by: Evangelos Karatzas <32259775+vagkaratzas@users.noreply.github.com>
1 parent 2356266 commit 04dcc4d

10 files changed

Lines changed: 769 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- "bioconda::local-cd-search=0.3.0"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
process LOCALCDSEARCH_ANNOTATE {
2+
tag "$meta.id"
3+
label 'process_medium'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7+
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e1/e1ed921c933d8eeeb0db6d72ece09ec25edab9ad441c84b070acff1592af2d54/data' :
8+
'biocontainers/local-cd-search:0.3.0--pyhdfd78af_0' }"
9+
10+
input:
11+
tuple val(meta), path(fasta)
12+
path db
13+
val sites
14+
15+
output:
16+
tuple val(meta), path("*_results.tsv"), emit: result
17+
tuple val(meta), path("*_sites.tsv") , emit: annot_sites, optional: true
18+
tuple val("${task.process}"), val('local-cd-search'), eval("echo ${VERSION}"), topic: versions, emit: versions_localcdsearch
19+
20+
when:
21+
task.ext.when == null || task.ext.when
22+
23+
script:
24+
def args = task.ext.args ?: ''
25+
VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
26+
def prefix = task.ext.prefix ?: "${meta.id}"
27+
def val_flag = sites ? "--sites-output ${prefix}_sites.tsv" : ''
28+
def is_compressed = fasta.getExtension() == "gz"
29+
def fasta_name = is_compressed ? fasta.getBaseName() : fasta
30+
def uncompress_input = is_compressed ? "gzip -c -d ${fasta} > ${fasta_name}" : ''
31+
"""
32+
$uncompress_input
33+
34+
local-cd-search \\
35+
annotate \\
36+
$args \\
37+
$val_flag \\
38+
--threads $task.cpus \\
39+
${fasta_name} \\
40+
${prefix}_results.tsv \\
41+
${db}
42+
"""
43+
44+
stub:
45+
def args = task.ext.args ?: ''
46+
VERSION = '0.3.0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
47+
def prefix = task.ext.prefix ?: "${meta.id}"
48+
"""
49+
echo $args
50+
touch ${prefix}_results.tsv
51+
${sites ? "touch ${prefix}_sites.tsv" : ''}
52+
"""
53+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
2+
name: "localcdsearch_annotate"
3+
description: A command-line tool for local protein domain annotation using NCBI's Conserved Domain Database (CDD)
4+
keywords:
5+
- cdd
6+
- rpsblast
7+
- rpsbproc
8+
- protein
9+
- domain
10+
- annotation
11+
tools:
12+
- "localcdsearch":
13+
description: "Protein annotation using local PSSM databases from CDD."
14+
homepage: "https://github.com/apcamargo/local-cd-search"
15+
documentation: "https://github.com/apcamargo/local-cd-search"
16+
tool_dev_url: "https://github.com/apcamargo/local-cd-search"
17+
licence: ["MIT"]
18+
identifier: ""
19+
input:
20+
- - meta:
21+
type: map
22+
description: |
23+
Groovy Map containing sample information
24+
e.g. `[ id:'sample1' ]`
25+
- fasta:
26+
type: file
27+
description: Input fasta file containing protein queries sequences
28+
pattern: "*.{fa,fasta,fa.gz,fasta.gz}"
29+
ontologies:
30+
- edam: "http://edamontology.org/format_1929" # FASTA
31+
- db:
32+
type: directory
33+
description: Directory containing the metadata and databse directories
34+
pattern: "*"
35+
- sites:
36+
type: boolean
37+
description: When true an extra tsv output file is generated
38+
39+
output:
40+
result:
41+
- - meta:
42+
type: map
43+
description: |
44+
Groovy Map containing sample information
45+
e.g. `[ id:'sample1' ]`
46+
- "*_results.tsv":
47+
type: file
48+
description: tab-separated file with hits filtered by CDD's curated bit-score thresholds
49+
pattern: "*_results.tsv"
50+
ontologies:
51+
- edam: http://edamontology.org/format_3475 # TSV
52+
annot_sites:
53+
- - meta:
54+
type: map
55+
description: |
56+
Groovy Map containing sample information
57+
e.g. `[ id:'sample1' ]`
58+
- "*_sites.tsv":
59+
type: file
60+
description: If --sites-output is specified, an additional tab-separated file is created with functional site annotations
61+
pattern: "*_sites.tsv"
62+
ontologies:
63+
- edam: http://edamontology.org/format_3475 # TSV
64+
versions_localcdsearch:
65+
- - "${task.process}":
66+
type: string
67+
description: The name of the process
68+
- "local-cd-search":
69+
type: string
70+
description: The name of the tool
71+
- "echo ${VERSION}":
72+
type: eval
73+
description: The expression to obtain the version of the tool
74+
75+
topics:
76+
versions:
77+
- - ${task.process}:
78+
type: string
79+
description: The name of the process
80+
- local-cd-search:
81+
type: string
82+
description: The name of the tool
83+
- echo ${VERSION}:
84+
type: eval
85+
description: The expression to obtain the version of the tool
86+
authors:
87+
- "@Ales-ibt"
88+
maintainers:
89+
- "@Ales-ibt"
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
nextflow_process {
2+
3+
name "Test Process LOCALCDSEARCH_ANNOTATE"
4+
script "../main.nf"
5+
process "LOCALCDSEARCH_ANNOTATE"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "localcdsearch"
10+
tag "localcdsearch/annotate"
11+
tag "localcdsearch/download"
12+
13+
setup {
14+
run("LOCALCDSEARCH_DOWNLOAD") {
15+
script "../../download/main.nf"
16+
process {
17+
"""
18+
input[0] = ['smart']
19+
"""
20+
}
21+
}
22+
}
23+
24+
test("sarscov2 - smart") {
25+
26+
when {
27+
process {
28+
"""
29+
input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ]
30+
input[1] = LOCALCDSEARCH_DOWNLOAD.out.db
31+
input[2] = false
32+
"""
33+
}
34+
}
35+
36+
then {
37+
assertAll (
38+
{ assert process.success },
39+
{ assert snapshot(
40+
process.out.result,
41+
process.out.findAll { key, val -> key.startsWith("versions")}
42+
).match() }
43+
)
44+
}
45+
46+
}
47+
48+
test("sarscov2 - smart - stub") {
49+
50+
options "-stub"
51+
52+
when {
53+
process {
54+
"""
55+
input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ]
56+
input[1] = LOCALCDSEARCH_DOWNLOAD.out.db
57+
input[2] = false
58+
"""
59+
}
60+
}
61+
62+
then {
63+
assertAll(
64+
{ assert process.success },
65+
{ assert snapshot(
66+
process.out.result,
67+
process.out.findAll { key, val -> key.startsWith("versions")}
68+
).match() }
69+
)
70+
}
71+
72+
}
73+
74+
test("sarscov2 - smart - sites") {
75+
76+
when {
77+
process {
78+
"""
79+
input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ]
80+
input[1] = LOCALCDSEARCH_DOWNLOAD.out.db
81+
input[2] = true
82+
"""
83+
}
84+
}
85+
86+
then {
87+
assertAll(
88+
{ assert process.success },
89+
{ assert snapshot(
90+
process.out.result,
91+
process.out.annot_sites,
92+
process.out.findAll { key, val -> key.startsWith("versions")}
93+
).match() }
94+
)
95+
}
96+
97+
}
98+
99+
test("sarscov2 - smart - sites - stub") {
100+
101+
options "-stub"
102+
103+
when {
104+
process {
105+
"""
106+
input[0] = [ [id:'test'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.fasta', checkIfExists: true) ]
107+
input[1] = LOCALCDSEARCH_DOWNLOAD.out.db
108+
input[2] = true
109+
"""
110+
}
111+
}
112+
113+
then {
114+
assertAll(
115+
{ assert process.success },
116+
{ assert snapshot(
117+
process.out.result,
118+
process.out.annot_sites,
119+
process.out.findAll { key, val -> key.startsWith("versions")}
120+
).match() }
121+
)
122+
}
123+
124+
}
125+
126+
}

0 commit comments

Comments
 (0)