Skip to content

Commit 386569c

Browse files
committed
Working example for new channel-assignment scheme (ref #61)
1 parent e50a482 commit 386569c

File tree

4 files changed

+43
-30
lines changed

4 files changed

+43
-30
lines changed

examples/wf_params_uzh_1_well_2x2_sites.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"dims": [2, 2],
44
"coarsening_xy": 3,
55
"coarsening_z": 1,
6-
"num_levels": 5
6+
"num_levels": 5,
7+
"channel_file": "wf_params_uzh_1_well_2x2_sites_channels.json"
78
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"A01_C01": {
3+
"label": "DAPI",
4+
"colormap": "00FFFF",
5+
"start": 110,
6+
"end": 600
7+
},
8+
"A01_C02": {
9+
"label": "nanog",
10+
"colormap": "FF00FF",
11+
"start": 115,
12+
"end": 200
13+
},
14+
"A02_C03": {
15+
"label": "Lamin B1",
16+
"colormap": "FFFF00",
17+
"start": 115,
18+
"end": 1000
19+
},
20+
"fake": {
21+
"label": "Fake",
22+
"colormap": "FFFFFF",
23+
"start": 115,
24+
"end": 1000
25+
}
26+
}

fractal/fractal_cmd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ def workflow_apply(
442442
num_levels = params["num_levels"]
443443
rows, cols = params["dims"]
444444
workflow_name = params["workflow_name"]
445+
path_dict_channels = params["channel_file"]
445446
delete_input = params.get("delete_input", False)
446447

447448
# FIXME validate tasks somewhere?
@@ -486,6 +487,7 @@ def collect_intermediate_results(inputs=[]):
486487
kwargs = dict(
487488
in_paths=resources_in,
488489
out_path=resource_out,
490+
path_dict_channels=path_dict_channels,
489491
ext=ext,
490492
num_levels=num_levels,
491493
)

fractal/tasks/create_zarr_structure.py

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,19 @@ def create_zarr_structure(
3030
:type num_levels: int
3131
"""
3232

33-
# FIXME: remove hard-coded default (for None)
34-
if path_dict_channels is None:
35-
dict_channels = {
36-
"A01_C01": dict(
37-
label="DAPI", colormap="00FFFF", start=110, end=600
38-
),
39-
"A01_C02": dict(
40-
label="nanog", colormap="FF00FF", start=115, end=200
41-
),
42-
"A02_C03": dict(
43-
label="Lamin B1", colormap="FFFF00", start=115, end=1000
44-
),
45-
"fake": dict(label="Fake", colormap="FFFFFF", start=115, end=1000),
46-
}
47-
else:
48-
try:
49-
with open(path_dict_channels, "r") as json_file:
50-
dict_channels = json.load(json_file)
51-
except FileNotFoundError:
52-
raise Exception(
53-
"ERROR in create_zarr_structure: "
54-
f"{path_dict_channels} missing."
55-
)
56-
except TypeError:
57-
raise Exception(
58-
"ERROR in create_zarr_structure: "
59-
f"{path_dict_channels} has wrong type "
60-
"(probably a None instead of a string)."
61-
)
33+
try:
34+
with open(path_dict_channels, "r") as json_file:
35+
dict_channels = json.load(json_file)
36+
except FileNotFoundError:
37+
raise Exception(
38+
"ERROR in create_zarr_structure: " f"{path_dict_channels} missing."
39+
)
40+
except TypeError:
41+
raise Exception(
42+
"ERROR in create_zarr_structure: "
43+
f"{path_dict_channels} has wrong type "
44+
"(probably a None instead of a string)."
45+
)
6246

6347
# Identify all plates and all channels, across all input folders
6448
plates = []

0 commit comments

Comments
 (0)