Skip to content

Commit ef3d2d1

Browse files
committed
feat: civicpy/annotate module
1 parent 3e6b9ee commit ef3d2d1

6 files changed

Lines changed: 272 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
- nodefaults
7+
dependencies:
8+
- "bioconda::civicpy=5.2.0"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
process CIVICPY_ANNOTATE {
2+
tag "${meta.id}"
3+
label 'process_single'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
7+
? 'oras://community.wave.seqera.io/library/civicpy:5.2.0--8e87770abedd45a6'
8+
: 'community.wave.seqera.io/library/pip_backports-datetime-fromisoformat_civicpy:fe223053d0547acf' }"
9+
10+
input:
11+
tuple val(meta), path(vcf), path(tbi)
12+
val annotation_genome_version
13+
14+
output:
15+
tuple val(meta), path("*.vcf"), emit: vcf
16+
tuple val("${task.process}"), val('civicpy'), eval("civicpy --version | sed 's/.*version //'"), topic: versions, emit: versions_civicpy
17+
18+
when:
19+
task.ext.when == null || task.ext.when
20+
21+
script:
22+
def args = task.ext.args ?: ''
23+
def prefix = task.ext.prefix ?: "${meta.id}.civic"
24+
25+
"""
26+
export CIVICPY_CACHE_FILE=\$PWD/.civicpy
27+
28+
civicpy annotate-vcf \\
29+
--input-vcf ${vcf} \\
30+
--output-vcf ${prefix}.vcf \\
31+
--reference ${annotation_genome_version} \\
32+
${args}
33+
"""
34+
35+
stub:
36+
def args = task.ext.args ?: ''
37+
def prefix = task.ext.prefix ?: "${meta.id}.civic"
38+
39+
"""
40+
touch ${prefix}.vcf
41+
"""
42+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
3+
name: "civicpy_annotate"
4+
5+
description: A python client and analysis toolkit for the Clinical Interpretations of Variants in Cancer (CIViC) knowledgebase
6+
keywords:
7+
- clinical interpretation
8+
- variant annotation
9+
- genetic variation analysis
10+
- genomics
11+
tools:
12+
- "civicpy":
13+
description: "CIViC variant knowledgebase analysis toolkit."
14+
homepage: "https://docs.civicpy.org/en/latest/"
15+
documentation: "https://docs.civicpy.org/en/latest/"
16+
tool_dev_url: "https://github.com/griffithlab/civicpy"
17+
doi: "10.1200/CCI.19.00127"
18+
licence: ["MIT"]
19+
identifier: biotools:CIViCpy
20+
21+
input:
22+
- - meta:
23+
type: map
24+
description: |
25+
Groovy Map containing sample information
26+
e.g. `[ id:'sample1', single_end:false ]`
27+
28+
- vcf:
29+
type: file
30+
description: Sorted and indexed VCF file
31+
pattern: "*.{vcf}"
32+
ontologies:
33+
- edam: "http://edamontology.org/format_3016"
34+
35+
- tbi:
36+
type: file
37+
description: Tabix index for the input VCF
38+
pattern: "*.tbi"
39+
40+
- annotation_genome_version:
41+
type: string
42+
description: Reference genome version passed to civicpy (e.g. GRCh38)
43+
44+
output:
45+
vcf:
46+
- - meta:
47+
type: map
48+
description: |
49+
Groovy Map containing sample information
50+
e.g. `[ id:'sample1', single_end:false ]`
51+
- "*.vcf":
52+
type: file
53+
description: Annotated VCF file
54+
pattern: "*.vcf"
55+
ontologies:
56+
- edam: "http://edamontology.org/format_3016"
57+
58+
versions:
59+
- versions.yml:
60+
type: file
61+
description: File containing software versions
62+
pattern: "versions.yml"
63+
ontologies:
64+
- edam: http://edamontology.org/format_3750 # YAML
65+
66+
authors:
67+
- "@emmcauley"
68+
maintainers:
69+
- "@emmcauley"
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
nextflow_process {
2+
3+
name "Test Process CIVICPY_ANNOTATE"
4+
script "../main.nf"
5+
process "CIVICPY_ANNOTATE"
6+
config "./nextflow.config"
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "civicpy"
10+
tag "civicpy/annotate"
11+
12+
test("homo_sapiens - vcf - GRCh38") {
13+
14+
when {
15+
process {
16+
"""
17+
input[0] = [
18+
[ id:'test_sample' ],
19+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
20+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true)
21+
]
22+
input[1] = 'GRCh38'
23+
"""
24+
}
25+
}
26+
27+
then {
28+
assertAll(
29+
{ assert process.success },
30+
{ assert snapshot(
31+
path(process.out.vcf[0][1]).vcf.variantsMD5,
32+
process.out.versions_civicpy
33+
).match() }
34+
)
35+
}
36+
37+
}
38+
39+
test("homo_sapiens - vcf - GRCh37") {
40+
41+
when {
42+
process {
43+
"""
44+
input[0] = [
45+
[ id:'test_sample' ],
46+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
47+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true)
48+
]
49+
input[1] = 'GRCh37'
50+
"""
51+
}
52+
}
53+
54+
then {
55+
assertAll(
56+
{ assert process.success },
57+
{ assert snapshot(
58+
path(process.out.vcf[0][1]).vcf.variantsMD5,
59+
process.out.versions_civicpy
60+
).match() }
61+
)
62+
}
63+
64+
}
65+
66+
test("homo_sapiens - vcf - GRCh38 - stub") {
67+
68+
options "-stub"
69+
70+
when {
71+
process {
72+
"""
73+
input[0] = [
74+
[ id:'test_sample' ],
75+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true),
76+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true)
77+
]
78+
input[1] = 'GRCh38'
79+
"""
80+
}
81+
}
82+
83+
then {
84+
assertAll(
85+
{ assert process.success },
86+
{ assert snapshot(
87+
file(process.out.vcf[0][1]).name,
88+
process.out.versions_civicpy
89+
).match() }
90+
)
91+
}
92+
93+
}
94+
95+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"homo_sapiens - vcf - GRCh38 - stub": {
3+
"content": [
4+
"test_sample.civic.vcf",
5+
[
6+
[
7+
"CIVICPY_ANNOTATE",
8+
"civicpy",
9+
"5.2.0"
10+
]
11+
]
12+
],
13+
"meta": {
14+
"nf-test": "0.9.3",
15+
"nextflow": "25.10.2"
16+
},
17+
"timestamp": "2026-03-26T17:38:23.86228"
18+
},
19+
"homo_sapiens - vcf - GRCh37": {
20+
"content": [
21+
"bf3fe04101ac5b192de625ebf9a4324f",
22+
[
23+
[
24+
"CIVICPY_ANNOTATE",
25+
"civicpy",
26+
"5.2.0"
27+
]
28+
]
29+
],
30+
"meta": {
31+
"nf-test": "0.9.3",
32+
"nextflow": "25.10.2"
33+
},
34+
"timestamp": "2026-03-27T11:16:21.699688"
35+
},
36+
"homo_sapiens - vcf - GRCh38": {
37+
"content": [
38+
"bf3fe04101ac5b192de625ebf9a4324f",
39+
[
40+
[
41+
"CIVICPY_ANNOTATE",
42+
"civicpy",
43+
"5.2.0"
44+
]
45+
]
46+
],
47+
"meta": {
48+
"nf-test": "0.9.3",
49+
"nextflow": "25.10.2"
50+
},
51+
"timestamp": "2026-03-27T11:15:57.673023"
52+
}
53+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
process {
2+
withName: CIVICPY_ANNOTATE {
3+
ext.args = '--include-status accepted'
4+
}
5+
}

0 commit comments

Comments
 (0)