Skip to content

Commit 6752967

Browse files
Merge branch 'master' into new-module-baysor
2 parents 075e16a + 02771dc commit 6752967

14 files changed

Lines changed: 478 additions & 129 deletions

File tree

modules/nf-core/crispresso2/environment.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@ channels:
44
- conda-forge
55
- bioconda
66
dependencies:
7-
- bioconda::bowtie2=2.5.4
8-
- bioconda::crispresso2=2.3.3
9-
- bioconda::fastp=1.0.1
10-
- bioconda::samtools=1.22
7+
- bioconda::crispresso2=2.3.4

modules/nf-core/crispresso2/main.nf

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ process CRISPRESSO2 {
44

55
conda "${moduleDir}/environment.yml"
66
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
7-
'https://depot.galaxyproject.org/singularity/crispresso2:2.3.3--py39hff726c5_0' :
8-
'quay.io/biocontainers/crispresso2:2.3.3--py39hff726c5_0' }"
7+
'https://depot.galaxyproject.org/singularity/crispresso2:2.3.4--py312hfcd9dac_0' :
8+
'quay.io/biocontainers/crispresso2:2.3.4--py312hfcd9dac_0' }"
99

1010
input:
1111
tuple val(meta), path(reads)
12+
val amplicon_sequences
13+
path amplicon_file
1214

1315
output:
1416
tuple val(meta), path("CRISPResso_on_*") , emit: results
@@ -31,10 +33,23 @@ process CRISPRESSO2 {
3133
read_inputs = "-r1 ${reads[0]} -r2 ${reads[1]}"
3234
}
3335

36+
// Handle amplicon sequence vs amplicon file
37+
def amplicon_input = ""
38+
if (amplicon_file && amplicon_sequences) {
39+
error "Both amplicon_file and amplicon_sequences are provided. Please provide only one."
40+
} else if (amplicon_file) {
41+
amplicon_input = "-a \"\$(paste -sd, ${amplicon_file})\""
42+
} else if (amplicon_sequences) {
43+
amplicon_input = "-a ${amplicon_sequences}"
44+
} else if (task.ext.args && !task.ext.args.contains("--auto")) {
45+
error "Neither amplicon_file nor amplicon_sequences is provided and automatic amplicon detection is not enabled. Please provide one."
46+
}
47+
3448
"""
3549
export MPLCONFIGDIR=.matplotlib
3650
CRISPResso \\
3751
${read_inputs} \\
52+
${amplicon_input} \\
3853
--name ${prefix} \\
3954
--output_folder . \\
4055
${args}

modules/nf-core/crispresso2/meta.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ input:
3131
pattern: "*.{fastq,fq,fastq.gz,fq.gz}"
3232
ontologies:
3333
- edam: http://edamontology.org/format_1930 # FASTQ
34+
- amplicon_sequences:
35+
type: string
36+
description: A comma-separated list of amplicon sequences.
37+
pattern: "^([ACGTUMRWSYKVHDBN]+,)*[ACGTUMRWSYKVHDBN]+$"
38+
- amplicon_file:
39+
type: file
40+
description: A text file containing amplicon sequences, one per line.
41+
pattern: "*.txt"
42+
ontologies:
43+
- edam: http://edamontology.org/format_2330 # Textual format
3444
output:
3545
results:
3646
- - meta:

modules/nf-core/crispresso2/tests/main.nf.test

Lines changed: 106 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,84 @@ nextflow_process {
88
tag "modules_nfcore"
99
tag "crispresso2"
1010

11-
test("crispresso2 - single_end") {
11+
config "./nextflow.config"
1212

13-
config "./single_end.config"
13+
test("crispresso2 - single_end - auto") {
1414

1515
when {
16+
params {
17+
module_args = "--suppress_plots --auto"
18+
}
1619
process {
1720
"""
1821
input[0] = [
1922
[ id:'test', single_end:true ],
2023
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
2124
]
25+
input[1] = []
26+
input[2] = []
2227
"""
2328
}
2429
}
2530

2631
then {
27-
assertAll(
32+
def html_out = process.out.html[0][1]
33+
def htmls = html_out instanceof List ? html_out : [html_out]
34+
assertAll(
2835
{ assert process.success },
2936
{ assert snapshot(
3037
process.out.results[0][1].size(),
31-
file(process.out.html[0][1]).name,
38+
htmls.collect{ html -> file(html).name }.sort(),
3239
process.out.txt[0][1].size(),
3340
process.out.findAll { key, val -> key.startsWith("versions")}
3441
).match() },
3542
)
3643
}
3744
}
3845

39-
test("crispresso2 - paired_end") {
46+
test("crispresso2 - paired_end - auto") {
4047

41-
config "./paired_end.config"
48+
when {
49+
params {
50+
// fastp argument added due to https://github.com/pinellolab/CRISPResso2/issues/648
51+
module_args = "--suppress_plots --auto --fastp_command 'fastp --merged_out /dev/stdout'"
52+
}
53+
process {
54+
"""
55+
input[0] = [
56+
[ id:'paired_test', single_end:false ],
57+
[
58+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
59+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
60+
]
61+
]
62+
input[1] = []
63+
input[2] = []
64+
"""
65+
}
66+
}
67+
68+
then {
69+
def html_out = process.out.html[0][1]
70+
def htmls = html_out instanceof List ? html_out : [html_out]
71+
assertAll(
72+
{ assert process.success },
73+
{ assert snapshot(
74+
process.out.results[0][1].size(),
75+
htmls.collect{ html -> file(html).name }.sort(),
76+
process.out.txt[0][1].size(),
77+
process.out.findAll { key, val -> key.startsWith("versions")}
78+
).match() },
79+
)
80+
}
81+
}
82+
83+
test("crispresso2 - paired_end - amplicon string") {
4284

4385
when {
86+
params {
87+
module_args = "--suppress_plots"
88+
}
4489
process {
4590
"""
4691
input[0] = [
@@ -50,44 +95,93 @@ nextflow_process {
5095
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
5196
]
5297
]
98+
input[1] = "CCTGTTGTCTATGTGATAGACGTGCCACATGCTTTTCCACTGCTTCAGACACTTATGCCTGTTGGCATCATTCTATTGGATTTGATTACGTCTATAATCCGTTTATGATTGATGTTCAACAATGGGGTTTTACAGGTAACCTACAAAGCA"
99+
input[2] = []
53100
"""
54101
}
55102
}
56103

57104
then {
105+
def html_out = process.out.html[0][1]
106+
def htmls = html_out instanceof List ? html_out : [html_out]
58107
assertAll(
59108
{ assert process.success },
60109
{ assert snapshot(
61110
process.out.results[0][1].size(),
62-
process.out.html[0][1].collect{ html -> file(html).name }.sort(),
111+
htmls.collect{ html -> file(html).name }.sort(),
63112
process.out.txt[0][1].size(),
64113
process.out.findAll { key, val -> key.startsWith("versions")}
65114
).match() },
66115
)
67116
}
68117
}
69118

70-
test("crispresso2 - nhej_analysis") {
119+
test("crispresso2 - paired_end - amplicon file") {
71120

72-
config "./nhej.config"
121+
when {
122+
params {
123+
module_args = "--suppress_plots"
124+
}
125+
process {
126+
"""
127+
input[0] = [
128+
[ id:'paired_test', single_end:false ],
129+
[
130+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
131+
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
132+
]
133+
]
134+
input[1] = []
135+
input[2] = file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/amplicon.txt', checkIfExists: true)
136+
"""
137+
}
138+
}
139+
140+
then {
141+
def html_out = process.out.html[0][1]
142+
def htmls = html_out instanceof List ? html_out : [html_out]
143+
assertAll(
144+
{ assert process.success },
145+
{ assert snapshot(
146+
process.out.results[0][1].size(),
147+
htmls.collect{ html -> file(html).name }.sort(),
148+
process.out.txt[0][1].size(),
149+
process.out.findAll { key, val -> key.startsWith("versions")}
150+
).match() },
151+
)
152+
}
153+
}
154+
155+
test("crispresso2 - single_end - stub") {
156+
157+
options '-stub'
73158

74159
when {
160+
params {
161+
module_args = ""
162+
}
75163
process {
76164
"""
77165
input[0] = [
78-
[ id:'nhej_test', single_end:true ],
166+
[ id:'test', single_end:true ],
79167
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
80168
]
169+
input[1] = []
170+
input[2] = []
81171
"""
82172
}
83173
}
84174

85175
then {
176+
def html_out = process.out.html[0][1]
177+
def htmls = html_out instanceof List ? html_out : [html_out]
178+
def results_out = process.out.results[0][1]
179+
def results_size = results_out instanceof List ? results_out.size() : file(results_out).list().size()
86180
assertAll(
87181
{ assert process.success },
88182
{ assert snapshot(
89-
process.out.results[0][1].size(),
90-
file(process.out.html[0][1]).name,
183+
results_size,
184+
htmls.collect{ html -> file(html).name }.sort(),
91185
process.out.txt[0][1].size(),
92186
process.out.findAll { key, val -> key.startsWith("versions")}
93187
).match() },
Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,118 @@
11
{
2-
"crispresso2 - paired_end": {
2+
"crispresso2 - single_end - stub": {
3+
"content": [
4+
4,
5+
[
6+
"test.html"
7+
],
8+
2,
9+
{
10+
"versions_crispresso2": [
11+
[
12+
"CRISPRESSO2",
13+
"crispresso2",
14+
"2.3.4"
15+
]
16+
]
17+
}
18+
],
19+
"timestamp": "2026-05-29T08:37:50.096728513",
20+
"meta": {
21+
"nf-test": "0.9.5",
22+
"nextflow": "26.04.0"
23+
}
24+
},
25+
"crispresso2 - single_end - auto": {
326
"content": [
427
2,
528
[
6-
"CRISPResso_on_paired_test.html",
7-
"fastp.html"
29+
"CRISPResso_on_test.html"
830
],
931
9,
1032
{
1133
"versions_crispresso2": [
1234
[
1335
"CRISPRESSO2",
1436
"crispresso2",
15-
"2.3.3"
37+
"2.3.4"
1638
]
1739
]
1840
}
1941
],
20-
"timestamp": "2026-03-13T14:56:09.120398517",
42+
"timestamp": "2026-05-29T08:37:00.619464624",
2143
"meta": {
22-
"nf-test": "0.9.4",
23-
"nextflow": "25.10.4"
44+
"nf-test": "0.9.5",
45+
"nextflow": "26.04.0"
2446
}
2547
},
26-
"crispresso2 - nhej_analysis": {
48+
"crispresso2 - paired_end - amplicon file": {
2749
"content": [
2850
2,
29-
"CRISPResso_on_nhej_test.html",
51+
[
52+
"CRISPResso_on_paired_test.html"
53+
],
3054
9,
3155
{
3256
"versions_crispresso2": [
3357
[
3458
"CRISPRESSO2",
3559
"crispresso2",
36-
"2.3.3"
60+
"2.3.4"
3761
]
3862
]
3963
}
4064
],
41-
"timestamp": "2026-03-13T15:34:17.493407027",
65+
"timestamp": "2026-05-29T08:37:39.832299521",
4266
"meta": {
43-
"nf-test": "0.9.4",
44-
"nextflow": "25.10.4"
67+
"nf-test": "0.9.5",
68+
"nextflow": "26.04.0"
4569
}
4670
},
47-
"crispresso2 - single_end": {
71+
"crispresso2 - paired_end - amplicon string": {
4872
"content": [
4973
2,
50-
"CRISPResso_on_test.html",
74+
[
75+
"CRISPResso_on_paired_test.html"
76+
],
77+
9,
78+
{
79+
"versions_crispresso2": [
80+
[
81+
"CRISPRESSO2",
82+
"crispresso2",
83+
"2.3.4"
84+
]
85+
]
86+
}
87+
],
88+
"timestamp": "2026-05-29T08:37:27.388735504",
89+
"meta": {
90+
"nf-test": "0.9.5",
91+
"nextflow": "26.04.0"
92+
}
93+
},
94+
"crispresso2 - paired_end - auto": {
95+
"content": [
96+
2,
97+
[
98+
"CRISPResso_on_paired_test.html",
99+
"fastp.html"
100+
],
51101
9,
52102
{
53103
"versions_crispresso2": [
54104
[
55105
"CRISPRESSO2",
56106
"crispresso2",
57-
"2.3.3"
107+
"2.3.4"
58108
]
59109
]
60110
}
61111
],
62-
"timestamp": "2026-03-13T15:32:17.852481198",
112+
"timestamp": "2026-05-29T08:37:14.636686941",
63113
"meta": {
64-
"nf-test": "0.9.4",
65-
"nextflow": "25.10.4"
114+
"nf-test": "0.9.5",
115+
"nextflow": "26.04.0"
66116
}
67117
}
68118
}

0 commit comments

Comments
 (0)