obi-notebook 0.2.dev0__tar.gz → 0.2.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/PKG-INFO +1 -1
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/example.ipynb +40 -4
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook/get_entities.py +38 -4
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/PKG-INFO +1 -1
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/.github/workflows/sdist.yml +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/.github/workflows/tox.yml +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/.gitignore +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/CHANGELOG.rst +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/LICENSE.txt +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/README.md +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/demo.gif +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/pyproject.toml +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/setup.cfg +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook/__init__.py +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook/get_projects.py +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/SOURCES.txt +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/dependency_links.txt +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/requires.txt +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/top_level.txt +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/tox.ini +0 -0
- {obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: obi_notebook
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.dev1
|
|
4
4
|
Summary: convenience functions for OBI notebooks
|
|
5
5
|
Author-email: Open Brain Institute <jean-denis.courcol@epfl.ch>
|
|
6
6
|
Maintainer-email: Open Brain Institute <jean-denis.courcol@epfl.ch>
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"source": [
|
|
10
10
|
"import obi_auth\n",
|
|
11
11
|
"\n",
|
|
12
|
-
"from obi_notebook import get_entities, get_projects"
|
|
12
|
+
"from obi_notebook import get_entities, get_projects\n",
|
|
13
|
+
"\n",
|
|
14
|
+
"environment_str = \"staging\""
|
|
13
15
|
]
|
|
14
16
|
},
|
|
15
17
|
{
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
"metadata": {},
|
|
28
30
|
"outputs": [],
|
|
29
31
|
"source": [
|
|
30
|
-
"token = obi_auth.get_token(environment
|
|
32
|
+
"token = obi_auth.get_token(environment=environment_str)"
|
|
31
33
|
]
|
|
32
34
|
},
|
|
33
35
|
{
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
"metadata": {},
|
|
46
48
|
"outputs": [],
|
|
47
49
|
"source": [
|
|
48
|
-
"project_context = get_projects.get_projects(token)"
|
|
50
|
+
"project_context = get_projects.get_projects(token, env=\"staging\")"
|
|
49
51
|
]
|
|
50
52
|
},
|
|
51
53
|
{
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
" default_scale=\"small\",\n",
|
|
79
81
|
" exclude_scales=[\"single\"],\n",
|
|
80
82
|
" add_columns=[\"subject.name\"],\n",
|
|
83
|
+
" env=environment_str,\n",
|
|
81
84
|
")"
|
|
82
85
|
]
|
|
83
86
|
},
|
|
@@ -109,18 +112,51 @@
|
|
|
109
112
|
" project_context=project_context,\n",
|
|
110
113
|
" page_size=100,\n",
|
|
111
114
|
" add_columns=[\"mtypes\"],\n",
|
|
115
|
+
" env=environment_str,\n",
|
|
112
116
|
")"
|
|
113
117
|
]
|
|
114
118
|
},
|
|
115
119
|
{
|
|
116
120
|
"cell_type": "code",
|
|
117
121
|
"execution_count": null,
|
|
118
|
-
"id": "
|
|
122
|
+
"id": "2c9d28c4",
|
|
119
123
|
"metadata": {},
|
|
120
124
|
"outputs": [],
|
|
121
125
|
"source": [
|
|
122
126
|
"morph_ids"
|
|
123
127
|
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"cell_type": "code",
|
|
131
|
+
"execution_count": null,
|
|
132
|
+
"id": "90757b52",
|
|
133
|
+
"metadata": {},
|
|
134
|
+
"outputs": [],
|
|
135
|
+
"source": [
|
|
136
|
+
"cell_mesh_ids = []\n",
|
|
137
|
+
"circuit_ids = get_entities.get_entities(\n",
|
|
138
|
+
" \"em-cell-mesh\",\n",
|
|
139
|
+
" token,\n",
|
|
140
|
+
" cell_mesh_ids,\n",
|
|
141
|
+
" return_entities=False,\n",
|
|
142
|
+
" multi_select=True,\n",
|
|
143
|
+
" show_pages=True,\n",
|
|
144
|
+
" project_context=project_context,\n",
|
|
145
|
+
" page_size=10,\n",
|
|
146
|
+
" env=environment_str,\n",
|
|
147
|
+
" add_columns=[\"dense_reconstruction_cell_id\", \"subject.name\"],\n",
|
|
148
|
+
")"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"cell_type": "code",
|
|
153
|
+
"execution_count": null,
|
|
154
|
+
"id": "6964ebe2",
|
|
155
|
+
"metadata": {},
|
|
156
|
+
"outputs": [],
|
|
157
|
+
"source": [
|
|
158
|
+
"cell_mesh_ids"
|
|
159
|
+
]
|
|
124
160
|
}
|
|
125
161
|
],
|
|
126
162
|
"metadata": {
|
|
@@ -10,7 +10,9 @@ from IPython.display import clear_output, display
|
|
|
10
10
|
|
|
11
11
|
LST_MTYPES_ = None
|
|
12
12
|
LST_SPECIES_ = None
|
|
13
|
+
LST_EMDATASETS_ = None
|
|
13
14
|
STR_NO_MTYPE = "NONE"
|
|
15
|
+
ENTITY_CLASS_DICT = {"em-cell-mesh": "EMCellMesh"}
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
def _estimate_column_widths(df, char_width=8, padding=2, max_size=250):
|
|
@@ -29,7 +31,10 @@ def _resolve_list_to_first_element(obj):
|
|
|
29
31
|
return obj["pref_label"]
|
|
30
32
|
|
|
31
33
|
|
|
32
|
-
_df_postprocess_funs = {
|
|
34
|
+
_df_postprocess_funs = {
|
|
35
|
+
"reconstruction-morphology": {"mtypes": _resolve_list_to_first_element},
|
|
36
|
+
"em-cell-mesh": {"dense_reconstruction_cell_id": str},
|
|
37
|
+
}
|
|
33
38
|
|
|
34
39
|
|
|
35
40
|
def _list_of_existing_mtypes(entity_core_url, token):
|
|
@@ -62,6 +67,21 @@ def _list_of_existing_species(entity_core_url, token):
|
|
|
62
67
|
return LST_SPECIES_
|
|
63
68
|
|
|
64
69
|
|
|
70
|
+
def _list_of_existing_em_dense_datasets(entity_core_url, token):
|
|
71
|
+
global LST_EMDATASETS_
|
|
72
|
+
if LST_EMDATASETS_ is None:
|
|
73
|
+
response = requests.get(
|
|
74
|
+
f"{entity_core_url}/em-dense-reconstruction-dataset",
|
|
75
|
+
headers={"authorization": f"Bearer {token}"},
|
|
76
|
+
params={"page_size": 1000},
|
|
77
|
+
timeout=30,
|
|
78
|
+
)
|
|
79
|
+
data = response.json()
|
|
80
|
+
df_species = pd.json_normalize(data["data"])
|
|
81
|
+
LST_EMDATASETS_ = list(df_species["name"])
|
|
82
|
+
return LST_EMDATASETS_
|
|
83
|
+
|
|
84
|
+
|
|
65
85
|
def get_entities(
|
|
66
86
|
entity_type,
|
|
67
87
|
token,
|
|
@@ -108,6 +128,7 @@ def get_entities(
|
|
|
108
128
|
description="Scale:",
|
|
109
129
|
)
|
|
110
130
|
filters_dict["scale"] = scale_filter
|
|
131
|
+
filters_dict["name__ilike"] = widgets.Text(description="Name:")
|
|
111
132
|
elif entity_type == "reconstruction-morphology":
|
|
112
133
|
lst_mtypes = _list_of_existing_mtypes(entity_core_url, token) + [""]
|
|
113
134
|
mtype_filter = widgets.Combobox(
|
|
@@ -120,8 +141,17 @@ def get_entities(
|
|
|
120
141
|
lst_species = _list_of_existing_species(entity_core_url, token) + [""]
|
|
121
142
|
species_filter = widgets.Dropdown(options=lst_species, value="", description="Species:")
|
|
122
143
|
filters_dict["species__name"] = species_filter
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
filters_dict["name__ilike"] = widgets.Text(description="Name:")
|
|
145
|
+
elif entity_type == "em-cell-mesh":
|
|
146
|
+
lst_em_datasets = _list_of_existing_em_dense_datasets(entity_core_url, token) + [""]
|
|
147
|
+
em_dataset_filter = widgets.Combobox(
|
|
148
|
+
placeholder="Select EM Dataset",
|
|
149
|
+
description="EM-Dataset:",
|
|
150
|
+
options=lst_em_datasets,
|
|
151
|
+
ensure_option=True,
|
|
152
|
+
)
|
|
153
|
+
filters_dict["em_dense_reconstruction_dataset__name__ilike"] = em_dataset_filter
|
|
154
|
+
filters_dict["dense_reconstruction_cell_id"] = widgets.Text(description="Cell ID:")
|
|
125
155
|
|
|
126
156
|
if show_pages:
|
|
127
157
|
filters_dict["page"] = widgets.Dropdown(
|
|
@@ -252,7 +282,11 @@ def get_entities(
|
|
|
252
282
|
token_manager=token,
|
|
253
283
|
)
|
|
254
284
|
|
|
255
|
-
|
|
285
|
+
entity_class_default = "".join(
|
|
286
|
+
[_token.capitalize() for _token in entity_type.split("-")]
|
|
287
|
+
)
|
|
288
|
+
entity_class_name = ENTITY_CLASS_DICT.get(entity_type, entity_class_default)
|
|
289
|
+
model_class = getattr(models, entity_class_name)
|
|
256
290
|
retrieved_entities = client.search_entity(
|
|
257
291
|
entity_type=model_class, query={"id__in": list(l_ids)}
|
|
258
292
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: obi_notebook
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.dev1
|
|
4
4
|
Summary: convenience functions for OBI notebooks
|
|
5
5
|
Author-email: Open Brain Institute <jean-denis.courcol@epfl.ch>
|
|
6
6
|
Maintainer-email: Open Brain Institute <jean-denis.courcol@epfl.ch>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{obi_notebook-0.2.dev0 → obi_notebook-0.2.dev1}/src/obi_notebook.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|