Skip to content

Commit 1d5be47

Browse files
committed
update schema
1 parent df1aa64 commit 1d5be47

4 files changed

Lines changed: 47 additions & 12 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ temp
1616
**/old_working
1717
old_working
1818
tests/subset.bam
19-
**/new_not_right
19+
**/new_not_right
20+
nextflow_schema.json_old

main.nf

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,14 @@ workflow {
2525
def pools_ch = Channel.fromList(samplesheetToList(params.pool_sheet, "schemas/input_schema.json"))
2626

2727
def rename_maps = [:]
28-
if (params.rename_map) {
29-
file(params.rename_map)
30-
.readLines()
31-
.drop(1)
32-
.each { line ->
33-
def parts = line.trim().split(",")
34-
if (parts.size() == 2) {
35-
rename_maps[parts[0].trim()] = parts[1].trim()
36-
}
37-
}
28+
29+
30+
if (params.rename_map) {
31+
def rename_rows = samplesheetToList(params.rename_map, "schemas/rename_map_schema.json")
32+
rename_rows.each { row ->
33+
rename_maps[row[0]] = row[1]
3834
}
35+
}
3936
log.info "Rename maps: ${rename_maps}"
4037

4138
LIMA_BOTH_END(pools_ch)

nextflow_schema.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
"fa_icon": "fas fa-folder-open",
2828
"format": "directory-path",
2929
"type": "string"
30+
},
31+
"rename_map": {
32+
"description": "Optional CSV file mapping pool_ID.well_ID keys to user-defined sample names.",
33+
"fa_icon": "fas fa-file-csv",
34+
"format": "file-path",
35+
"help_text": "CSV with two columns: 'pool_ID.well_ID' and 'sample_ID'. Each key must follow the format <pool_ID>.<well_ID> where well_ID is [A-H][0-9]{2} (e.g. bc1015.A01). When multiple pools are present, entries for all pools may be included; each pool filters to its own entries by pool_ID prefix. The Barcode column always retains the original pool_ID.well_ID key.",
36+
"mimetype": "text/csv",
37+
"pattern": "^\\S+\\.(csv)$",
38+
"schema": "schemas/rename_map_schema.json",
39+
"type": "string"
3040
}
3141
},
3242
"required": [
@@ -37,4 +47,4 @@
3747
}
3848
},
3949
"type": "object"
40-
}
50+
}

schemas/rename_map_schema.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "rename_map schema",
4+
"description": "Schema for the rename_map CSV.",
5+
"type": "array",
6+
"items": {
7+
"type": "object",
8+
"properties": {
9+
"pool_ID.well_ID": {
10+
"type": "string",
11+
"description": "Original barcode key in the format pool_ID.well_ID (e.g. bc1015.A01).",
12+
"pattern": "^[A-Za-z0-9]+\\.[A-H][0-9]{2}$",
13+
"errorMessage": "pool_ID.well_ID must follow <pool_ID>.<well_ID> where well_ID is a plate coordinate [A-H][0-9]{2}, e.g. bc1015.A01"
14+
},
15+
"sample_ID": {
16+
"type": "string",
17+
"description": "User-defined sample name to assign to this well.",
18+
"pattern": "^\\S+$",
19+
"errorMessage": "sample_ID must be a non-empty string with no whitespace"
20+
}
21+
},
22+
"required": [
23+
"pool_ID.well_ID",
24+
"sample_ID"
25+
]
26+
}
27+
}

0 commit comments

Comments
 (0)