Skip to content

Commit b8cfb59

Browse files
committed
Troubleshoot installation and update notebook
1 parent 9c19b20 commit b8cfb59

3 files changed

Lines changed: 74 additions & 22 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ For a development installation (requires NodeJS and NPM),
3131
$ uv sync --extra dev --extra docs --extra all
3232

3333

34+
Alternatively, use conda:
35+
36+
$ conda create -n vitessce-dev python=3.12
37+
$ conda activate vitessce-dev
38+
$ pip install -e ".[dev,docs,all]"
39+
40+
Troubleshooting SpatialQuery installation on macOS:
41+
42+
$ # Use the macOS clang instead of from homebrew.
43+
$ CC=/usr/bin/clang CXX=/usr/bin/clang++ pip install -e ".[dev,docs,all,sq]"
44+
45+
3446
## Linting and testing
3547

3648
```sh

docs/notebooks/widget_plugin_spatial-query.ipynb

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@
1919
{
2020
"cell_type": "code",
2121
"execution_count": null,
22-
"metadata": {
23-
"tags": []
24-
},
25-
"outputs": [],
26-
"source": [
27-
"#!pip install \"vitessce[all]==3.3.0\" esbuild_py anndata\n",
28-
"!pip install \"mlxtend~=0.23.0\"\n",
29-
"#!pip install -i \"https://test.pypi.org/simple/\" SpatialQuery\n",
30-
"!pip install \"SpatialQuery @ git+https://github.com/ShaokunAn/Spatial-Query@main\""
31-
]
32-
},
33-
{
34-
"cell_type": "code",
35-
"execution_count": 1,
3622
"metadata": {},
3723
"outputs": [],
3824
"source": [
@@ -48,37 +34,74 @@
4834
"from vitessce.widget_plugins import SpatialQueryPlugin"
4935
]
5036
},
37+
{
38+
"cell_type": "markdown",
39+
"metadata": {},
40+
"source": [
41+
"## Download example dataset\n",
42+
"\n",
43+
"Download the `secondary_analysis.h5ad` file for sample `HBM838.LDFP.578` from the HuBMAP Portal at https://portal.hubmapconsortium.org/browse/dataset/5bf1e7b295343c4537206beda25aa4ca"
44+
]
45+
},
5146
{
5247
"cell_type": "code",
53-
"execution_count": 2,
48+
"execution_count": null,
5449
"metadata": {},
5550
"outputs": [],
5651
"source": [
57-
"adata = read_h5ad(join(\"data\", \"HBM987_KWLK_254\", \"secondary_analysis.h5ad\"))\n",
52+
"import os\n",
53+
"from os.path import join, isfile, isdir\n",
54+
"from urllib.request import urlretrieve\n",
55+
"\n",
56+
"adata_path = join(\"data\", \"HBM987_KWLK_254\", \"secondary_analysis.h5ad\")\n",
5857
"zarr_path = join(\"data\", \"HBM987_KWLK_254\", \"secondary_analysis.h5ad.zarr\")\n",
58+
"\n",
59+
"if not isdir(join(\"data\")):\n",
60+
" os.makedirs(join(\"data\"), exist_ok=True)\n",
61+
" if not isdir(join(\"data\", \"HBM987_KWLK_254\")):\n",
62+
" os.makedirs(join(\"data\", \"HBM987_KWLK_254\"), exist_ok=True)\n",
63+
" urlretrieve('https://assets.hubmapconsortium.org/0a21f3fa27109790483f2a0729be53de/secondary_analysis.h5ad', adata_path)"
64+
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": null,
69+
"metadata": {},
70+
"outputs": [],
71+
"source": [
72+
"adata = read_h5ad(adata_path)\n",
5973
"adata.write_zarr(zarr_path)"
6074
]
6175
},
6276
{
6377
"cell_type": "code",
64-
"execution_count": 3,
78+
"execution_count": null,
6579
"metadata": {},
6680
"outputs": [],
6781
"source": [
68-
"plugin = SpatialQueryPlugin(adata)"
82+
"adata"
6983
]
7084
},
7185
{
7286
"cell_type": "code",
73-
"execution_count": 12,
87+
"execution_count": null,
88+
"metadata": {},
89+
"outputs": [],
90+
"source": [
91+
"plugin = SpatialQueryPlugin(adata, label_key=\"predicted_label\", spatial_key=\"X_spatial\", feature_name=\"hugo_symbol\")"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": null,
7497
"metadata": {},
7598
"outputs": [],
7699
"source": [
77100
"vc = VitessceConfig(schema_version=\"1.0.16\", name=\"Spatial-Query\")\n",
78101
"dataset = vc.add_dataset(\"Query results\").add_object(AnnDataWrapper(\n",
79102
" adata_path=zarr_path,\n",
80103
" obs_feature_matrix_path=\"X\",\n",
81-
" obs_set_paths=[\"obs/predicted.ASCT.celltype\"],\n",
104+
" obs_set_paths=[\"obs/predicted_label\"],\n",
82105
" obs_set_names=[\"Cell Type\"],\n",
83106
" obs_spots_path=\"obsm/X_spatial\",\n",
84107
" feature_labels_path=\"var/hugo_symbol\",\n",
@@ -119,13 +142,20 @@
119142
},
120143
{
121144
"cell_type": "code",
122-
"execution_count": 13,
145+
"execution_count": null,
123146
"metadata": {},
124147
"outputs": [],
125148
"source": [
126149
"vw = vc.widget(height=900, plugins=[plugin], remount_on_uid_change=False)\n",
127150
"vw"
128151
]
152+
},
153+
{
154+
"cell_type": "code",
155+
"execution_count": null,
156+
"metadata": {},
157+
"outputs": [],
158+
"source": []
129159
}
130160
],
131161
"metadata": {
@@ -144,7 +174,7 @@
144174
"name": "python",
145175
"nbconvert_exporter": "python",
146176
"pygments_lexer": "ipython3",
147-
"version": "3.10.14"
177+
"version": "3.12.13"
148178
}
149179
},
150180
"nbformat": 4,

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ demos = [
9999
"snakemake",
100100
"pyyaml",
101101
]
102+
# SpatialQuery
103+
sq = [
104+
# To install: uv sync --extra sq --no-build-isolation-package SpatialQuery
105+
# or: uv sync --extra all --extra notebook --extra sq --no-build-isolation-package SpatialQuery
106+
"pybind11",
107+
"SpatialQuery @ git+https://github.com/ShaokunAn/Spatial-Query@main"
108+
]
102109

103110
[dependency-groups]
104111
dev = [
@@ -125,6 +132,9 @@ override-dependencies = []
125132
[tool.hatch.build]
126133
exclude = [".github", "docs", "demos", "binder"]
127134

135+
[tool.hatch.metadata]
136+
allow-direct-references = true
137+
128138
[project.urls]
129139
repository = "https://github.com/vitessce/vitessce-python"
130140

0 commit comments

Comments
 (0)