Skip to content

Commit c75d052

Browse files
new module: pharmcat/reporter (nf-core#10136)
* add new module pharmcat/reporter * updated output emit channel names
1 parent a189b32 commit c75d052

6 files changed

Lines changed: 504 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
channels:
3+
- conda-forge
4+
- bioconda
5+
dependencies:
6+
- bioconda::pharmcat3=3.1.1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
process PHARMCAT_REPORTER {
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+
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/2b/2b27c134f2226e65c3be9687fdcd6dfb5eebb7998bf1ad89ff396c914fe6d81a/data'
8+
: 'community.wave.seqera.io/library/pharmcat3:3.1.1--876b7152770ba008'}"
9+
10+
input:
11+
tuple val(meta), path(phenotypes)
12+
13+
output:
14+
tuple val(meta), path("*.report.json") , optional: true , emit: report_json
15+
tuple val(meta), path("*.report.html") , optional: true , emit: report_html
16+
tuple val(meta), path("*.report.tsv") , optional: true , emit: report_tsv
17+
tuple val("${task.process}"), val('pharmcat'), eval("pharmcat --version | cut -f2 -d ' '"), topic: versions , emit: versions_pharmcat
18+
19+
when:
20+
task.ext.when == null || task.ext.when
21+
22+
script:
23+
def args = task.ext.args ?: ''
24+
def prefix = task.ext.prefix ?: "${meta.id}.pharmcat"
25+
26+
"""
27+
pharmcat \\
28+
-reporter \\
29+
--reporter-input ${phenotypes} \\
30+
--base-filename ${prefix} \\
31+
--output-dir . \\
32+
${args}
33+
"""
34+
35+
stub:
36+
def args = task.ext.args ?: ''
37+
def prefix = task.ext.prefix ?: "${meta.id}.pharmcat"
38+
"""
39+
echo ${args} >/dev/null
40+
41+
touch ${prefix}.report.json
42+
touch ${prefix}.report.html
43+
touch ${prefix}.report.tsv
44+
"""
45+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: "pharmcat_reporter"
2+
description: |
3+
The Reporter module is responsible for generating a report with genotype-specific
4+
expert-reviewed drug prescribing recommendations for clinical decision support.
5+
keywords:
6+
- pharmcat
7+
- report
8+
- PGx
9+
tools:
10+
- "pharmcat":
11+
description: |
12+
"PharmCAT (Pharmacogenomics Clinical Annotation Tool) is a bioinformatics
13+
tool that analyzes genetic variants to predict drug response and tailor medical
14+
treatment to an individual patient’s genetic profile."
15+
homepage: "https://pharmcat.clinpgx.org/"
16+
documentation: "https://pharmcat.clinpgx.org/"
17+
tool_dev_url: "https://github.com/PharmGKB/PharmCAT"
18+
doi: "10.1002/cpt.928"
19+
licence:
20+
- "MPL-2.0"
21+
identifier: ""
22+
input:
23+
- - meta:
24+
type: map
25+
description: |
26+
Groovy Map containing sample information
27+
e.g. `[ id:'test', name:'test_sample' ]`
28+
- phenotypes:
29+
type: file
30+
description: The vcf file to be inspected
31+
pattern: "*.json"
32+
ontologies:
33+
- edam: http://edamontology.org/format_3464
34+
output:
35+
report_json:
36+
- - meta:
37+
type: map
38+
description: |
39+
Groovy Map containing sample information
40+
e.g. `[ id:'test', name:'test_sample' ]`
41+
- "*.report.json":
42+
type: file
43+
description: Json output from the reporter module of PharmCAT
44+
pattern: "*.report.json"
45+
ontologies:
46+
- edam: http://edamontology.org/format_3464
47+
report_html:
48+
- - meta:
49+
type: map
50+
description: |
51+
Groovy Map containing sample information
52+
e.g. `[ id:'test', name:'test_sample' ]`
53+
- "*.report.html":
54+
type: file
55+
description: HTML output from the reporter module of PharmCAT
56+
pattern: "*.report.html"
57+
ontologies: []
58+
report_tsv:
59+
- - meta:
60+
type: map
61+
description: |
62+
Groovy Map containing sample information
63+
e.g. `[ id:'test', name:'test_sample' ]`
64+
- "*.report.tsv":
65+
type: file
66+
description: Tab separated output from the reporter module of PharmCAT
67+
pattern: "*.report.tsv"
68+
ontologies: []
69+
versions_pharmcat:
70+
- - ${task.process}:
71+
type: string
72+
description: The name of the process
73+
- pharmcat:
74+
type: string
75+
description: The name of the tool
76+
- pharmcat --version | cut -f2 -d ' ':
77+
type: eval
78+
description: The expression to obtain the version of the tool
79+
topics:
80+
versions:
81+
- - ${task.process}:
82+
type: string
83+
description: The name of the process
84+
- pharmcat:
85+
type: string
86+
description: The name of the tool
87+
- pharmcat --version | cut -f2 -d ' ':
88+
type: eval
89+
description: The expression to obtain the version of the tool
90+
authors:
91+
- "@ramsainanduri"
92+
maintainers:
93+
- "@ramsainanduri"
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
nextflow_process {
2+
3+
name "Test Process PHARMCAT_REPORTER"
4+
script "../main.nf"
5+
process "PHARMCAT_REPORTER"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "pharmcat"
10+
tag "pharmcat/reporter"
11+
tag "pharmcat/phenotyper"
12+
tag "pharmcat/matcher"
13+
14+
config "./nextflow.config"
15+
16+
17+
setup {
18+
run("PHARMCAT_MATCHER") {
19+
script "../../matcher/main.nf"
20+
process {
21+
"""
22+
input[0] = Channel.fromList([
23+
tuple([id: 'PharmCAT'], // meta map
24+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/pharmcat/test.chr22.single.sample.vcf.gz', checkIfExists: true),
25+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/pharmcat/test.chr22.single.sample.vcf.gz.tbi', checkIfExists: true)),
26+
])
27+
input[1] = Channel.of([])
28+
"""
29+
}
30+
}
31+
32+
run("PHARMCAT_PHENOTYPER") {
33+
script "../../phenotyper/main.nf"
34+
process {
35+
"""
36+
input[0] = PHARMCAT_MATCHER.out.matcher_json.collect {
37+
meta, match_json -> match_json
38+
}.map {
39+
match_json -> [
40+
[ id: 'test'],
41+
match_json,
42+
[]
43+
]
44+
}
45+
"""
46+
}
47+
}
48+
}
49+
50+
test("report - JSON + HTML + TSV") {
51+
52+
when {
53+
params {
54+
module_args = ' --reporter-save-html --reporter-save-json --reporter-save-calls-only-tsv '
55+
}
56+
57+
process {
58+
"""
59+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
60+
"""
61+
}
62+
}
63+
64+
then {
65+
assertAll(
66+
{ assert process.success },
67+
{ assert snapshot(
68+
file(process.out.report_json[0][1]).name,
69+
file(process.out.report_html[0][1]).name,
70+
file(process.out.report_tsv[0][1]).name,
71+
process.out.findAll { key, val -> key.startsWith("versions") }
72+
).match() }
73+
)
74+
}
75+
}
76+
77+
78+
test("report - JSON + HTML ONLY") {
79+
80+
when {
81+
params {
82+
module_args = ' --reporter-save-html --reporter-save-json '
83+
}
84+
85+
process {
86+
"""
87+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
88+
"""
89+
}
90+
}
91+
92+
then {
93+
assertAll(
94+
{ assert process.success },
95+
{ assert process.out.report_tsv[1] == null },
96+
{ assert snapshot(
97+
file(process.out.report_json[0][1]).name,
98+
file(process.out.report_html[0][1]).name,
99+
process.out.findAll { key, val -> key.startsWith("versions") }
100+
).match() }
101+
)
102+
}
103+
}
104+
105+
test("report - JSON ONLY") {
106+
107+
when {
108+
params {
109+
module_args = ' --reporter-save-json '
110+
}
111+
112+
process {
113+
"""
114+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
115+
"""
116+
}
117+
}
118+
119+
then {
120+
assertAll(
121+
{ assert process.success },
122+
{ assert process.out.report_tsv[1] == null },
123+
{ assert process.out.report_html[1] == null },
124+
{ assert snapshot(
125+
file(process.out.report_json[0][1]).name,
126+
process.out.findAll { key, val -> key.startsWith("versions") }
127+
).match() }
128+
)
129+
}
130+
}
131+
132+
test("report - TSV ONLY") {
133+
134+
when {
135+
params {
136+
module_args = ' --reporter-save-calls-only-tsv '
137+
}
138+
139+
process {
140+
"""
141+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
142+
"""
143+
}
144+
}
145+
146+
then {
147+
assertAll(
148+
{ assert process.success },
149+
{ assert process.out.report_json[1] == null },
150+
{ assert process.out.report_html[1] == null },
151+
{ assert snapshot(
152+
file(process.out.report_tsv[0][1]).name,
153+
process.out.findAll { key, val -> key.startsWith("versions") }
154+
).match() }
155+
)
156+
}
157+
}
158+
159+
test("report - general") {
160+
161+
when {
162+
params {
163+
module_args = " --reporter-sources CPIC,FDA "
164+
}
165+
166+
process {
167+
"""
168+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
169+
"""
170+
}
171+
}
172+
173+
then {
174+
assertAll(
175+
{ assert process.success },
176+
{ assert process.out.report_json[1] == null },
177+
{ assert process.out.report_tsv[1] == null },
178+
{ assert snapshot(
179+
file(process.out.report_html[0][1]).name,
180+
process.out.findAll { key, val -> key.startsWith("versions") }
181+
).match() }
182+
)
183+
}
184+
}
185+
186+
187+
test("report - stub") {
188+
189+
options "-stub"
190+
191+
when {
192+
params {
193+
module_args = ' --reporter-extended '
194+
}
195+
196+
process {
197+
"""
198+
input[0] = PHARMCAT_PHENOTYPER.out.phenotyper_json
199+
"""
200+
}
201+
}
202+
203+
then {
204+
assertAll(
205+
{ assert process.success },
206+
{ assert snapshot(
207+
sanitizeOutput(process.out)
208+
).match() }
209+
)
210+
}
211+
}
212+
}

0 commit comments

Comments
 (0)