-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigure_views.py
More file actions
71 lines (53 loc) · 1.88 KB
/
figure_views.py
File metadata and controls
71 lines (53 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import json
import mobie
import pandas as pd
def save_view(name, view, save_to_project):
view["uiSelectionGroup"] = "mobie-paper"
view["isExclusive"] = True
if save_to_project:
metadata = mobie.metadata.read_dataset_metadata("./data/20200406_164555_328")
metadata["views"][name] = view
mobie.metadata.write_dataset_metadata("./data/20200406_164555_328", metadata)
else:
view_root = "./data/20200406_164555_328/misc/bookmarks"
os.makedirs(view_root, exist_ok=True)
view_file = os.path.join(view_root, "mobie-paper.json")
if os.path.exists(view_file):
with open(view_file) as f:
views = json.load(f)
else:
views = {"views": {}}
views["views"][name] = view
with open(view_file, "w") as f:
json.dump(views, f, indent=2, sort_keys=True)
def panel_a():
metadata = mobie.metadata.read_dataset_metadata("./data/20200406_164555_328")
views = metadata["views"]
grid = views["full_grid"]
# make green channel visible
serum = grid["sourceDisplays"][1]["imageDisplay"]
serum["visible"] = True
grid["sourceDisplays"][1]["imageDisplay"] = serum
# select well F9
wells = grid["sourceDisplays"][-1]["sourceAnnotationDisplay"]
table = pd.read_csv("./data/20200406_164555_328/tables/well/default.tsv", sep="\t")
well_names = table.annotation_id.values.tolist()
well_id = well_names.index("F09")
wells["selectedAnnotationIds"] = [f"0;{well_id}"]
wells["showAsBoundaries"] = True
wells["boundaryThickness"] = 100
grid["sourceDisplays"][-1]["sourceAnnotationDisplay"] = wells
# save the new view
save_view("Figure3a", grid, save_to_project=True)
def panel_b():
pass
def panel_c():
pass
def panel_d():
pass
if __name__ == "__main__":
panel_a()
panel_b()
panel_c()
panel_d()