Skip to content

Commit ff1eff2

Browse files
committed
Refactor samplesheet validation and input handling in ChIP-seq pipeline
1 parent aa983f0 commit ff1eff2

File tree

7 files changed

+105
-310
lines changed

7 files changed

+105
-310
lines changed

assets/schema_input.json

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
"properties": {
1010
"sample": {
1111
"type": "string",
12-
"pattern": "^\\S+$",
13-
"errorMessage": "Sample name must be provided and cannot contain spaces",
12+
"pattern": "^[a-zA-Z0-9_.-]+$",
13+
"errorMessage": "Sample name must be provided and can only contain alphanumeric characters, underscores, dots and dashes",
1414
"meta": ["id"]
1515
},
1616
"fastq_1": {
1717
"type": "string",
1818
"format": "file-path",
19-
"exists": true,
2019
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
2120
"errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
2221
},
@@ -25,7 +24,8 @@
2524
"anyOf": [
2625
{
2726
"type": "string",
28-
"pattern": "^\\S+\\.f(ast)?q\\.gz$"
27+
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
28+
"format": "file-path"
2929
},
3030
{
3131
"type": "string",
@@ -35,27 +35,59 @@
3535
},
3636
"replicate": {
3737
"type": "integer",
38-
"errorMessage": "Replicate id not an integer!",
38+
"minimum": 1,
39+
"errorMessage": "Replicate id must be provided and must be a positive integer",
3940
"meta": ["replicate"]
4041
},
4142
"antibody": {
42-
"type": "string",
43-
"pattern": "^\\S+$",
44-
"errorMessage": "Antibody entry cannot contain spaces",
43+
"anyOf": [
44+
{
45+
"type": "string",
46+
"pattern": "^[a-zA-Z0-9_.-]+$",
47+
"minLength": 1
48+
},
49+
{
50+
"type": "string",
51+
"maxLength": 0
52+
}
53+
],
54+
"errorMessage": "Antibody entry can only contain alphanumeric characters, underscores, dots and dashes",
4555
"meta": ["antibody"]
4656
},
4757
"control": {
48-
"type": "string",
49-
"pattern": "^\\S+$",
50-
"errorMessage": "Control entry cannot contain spaces",
58+
"anyOf": [
59+
{
60+
"type": "string",
61+
"pattern": "^[a-zA-Z0-9_.-]+$",
62+
"minLength": 1
63+
},
64+
{
65+
"type": "string",
66+
"maxLength": 0
67+
}
68+
],
69+
"errorMessage": "Control sample name can only contain alphanumeric characters, underscores, dots and dashes",
5170
"meta": ["control"]
5271
},
5372
"control_replicate": {
54-
"type": "integer",
55-
"errorMessage": "Replicate id not an integer!",
73+
"anyOf": [
74+
{
75+
"type": "integer",
76+
"minimum": 1
77+
},
78+
{
79+
"type": "string",
80+
"maxLength": 0
81+
}
82+
],
83+
"errorMessage": "Control replicate id must be a positive integer when specified",
5684
"meta": ["control_replicate"]
5785
}
5886
},
59-
"required": ["sample", "fastq_1"]
87+
"required": ["sample", "fastq_1", "replicate"],
88+
"dependentRequired": {
89+
"antibody": ["control"],
90+
"control": ["antibody", "control_replicate"]
91+
}
6092
}
6193
}

bin/check_samplesheet.py

Lines changed: 0 additions & 247 deletions
This file was deleted.

main.nf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ workflow NFCORE_CHIPSEQ {
7171
//
7272
// WORKFLOW: Run nf-core/chipseq workflow
7373
//
74-
ch_samplesheet = Channel.value(file(params.input, checkIfExists: true))
75-
7674
CHIPSEQ(
77-
ch_samplesheet,
75+
PIPELINE_INITIALISATION.out.samplesheet,
7876
ch_versions,
7977
PREPARE_GENOME.out.fasta,
8078
PREPARE_GENOME.out.fai,

modules/local/samplesheet_check.nf

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)