spatialrna 0.3.0.dev0__tar.gz → 0.3.0.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.
- spatialrna-0.3.0.dev1/PKG-INFO +34 -0
- spatialrna-0.3.0.dev1/README.md +10 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/pyproject.toml +3 -3
- spatialrna-0.3.0.dev1/src/spatialrna.egg-info/PKG-INFO +34 -0
- spatialrna-0.3.0.dev0/PKG-INFO +0 -102
- spatialrna-0.3.0.dev0/README.md +0 -78
- spatialrna-0.3.0.dev0/src/spatialrna.egg-info/PKG-INFO +0 -102
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/setup.cfg +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/__init__.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/cluster.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/datasets.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/graph_build.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/graph_zarr_io.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/readers.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/train_val.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna/viz.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna.egg-info/SOURCES.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna.egg-info/dependency_links.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna.egg-info/requires.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna.egg-info/top_level.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/tests/test_cluster_viz.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/tests/test_readers.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/tests/test_tiling.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/tests/test_zarr_roundtrip.py +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spatialrna
|
|
3
|
+
Version: 0.3.0.dev1
|
|
4
|
+
Summary: Spatial RNA graph data processing and analysis for iST (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps.
|
|
5
|
+
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
Requires-Dist: zarr>=3
|
|
15
|
+
Requires-Dist: numcodecs
|
|
16
|
+
Requires-Dist: tqdm
|
|
17
|
+
Requires-Dist: scikit-learn
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Provides-Extra: gnn
|
|
20
|
+
Requires-Dist: torch; extra == "gnn"
|
|
21
|
+
Requires-Dist: torch_geometric; extra == "gnn"
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest; extra == "dev"
|
|
24
|
+
|
|
25
|
+
description = "A package for spatial RNA graph data processing and analysis."
|
|
26
|
+
readme = "README.md"
|
|
27
|
+
version = "0.3.0.dev1"
|
|
28
|
+
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" },{ name = "Ruqian Lyu" }]
|
|
29
|
+
license = { text = "MIT" }
|
|
30
|
+
requires-python = ">=3.12"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Repository = "https://gitlab.svi.edu.au/biocellgen-public/spatialrna_pypi_public"
|
|
34
|
+
Documentation = "https://ruqianl.github.io/spatialrna_docs/"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
description = "A package for spatial RNA graph data processing and analysis."
|
|
2
|
+
readme = "README.md"
|
|
3
|
+
version = "0.3.0.dev1"
|
|
4
|
+
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" },{ name = "Ruqian Lyu" }]
|
|
5
|
+
license = { text = "MIT" }
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
|
|
8
|
+
[project.urls]
|
|
9
|
+
Repository = "https://gitlab.svi.edu.au/biocellgen-public/spatialrna_pypi_public"
|
|
10
|
+
Documentation = "https://ruqianl.github.io/spatialrna_docs/"
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "spatialrna"
|
|
7
|
-
version = "0.3.0.
|
|
8
|
-
description = "Spatial RNA graph data processing and analysis for
|
|
7
|
+
version = "0.3.0.dev1"
|
|
8
|
+
description = "Spatial RNA graph data processing and analysis for iST (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps."
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
11
|
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" }]
|
|
12
12
|
classifiers = [
|
|
13
13
|
"Programming Language :: Python :: 3",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spatialrna
|
|
3
|
+
Version: 0.3.0.dev1
|
|
4
|
+
Summary: Spatial RNA graph data processing and analysis for iST (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps.
|
|
5
|
+
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
Requires-Dist: zarr>=3
|
|
15
|
+
Requires-Dist: numcodecs
|
|
16
|
+
Requires-Dist: tqdm
|
|
17
|
+
Requires-Dist: scikit-learn
|
|
18
|
+
Requires-Dist: matplotlib
|
|
19
|
+
Provides-Extra: gnn
|
|
20
|
+
Requires-Dist: torch; extra == "gnn"
|
|
21
|
+
Requires-Dist: torch_geometric; extra == "gnn"
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest; extra == "dev"
|
|
24
|
+
|
|
25
|
+
description = "A package for spatial RNA graph data processing and analysis."
|
|
26
|
+
readme = "README.md"
|
|
27
|
+
version = "0.3.0.dev1"
|
|
28
|
+
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" },{ name = "Ruqian Lyu" }]
|
|
29
|
+
license = { text = "MIT" }
|
|
30
|
+
requires-python = ">=3.12"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Repository = "https://gitlab.svi.edu.au/biocellgen-public/spatialrna_pypi_public"
|
|
34
|
+
Documentation = "https://ruqianl.github.io/spatialrna_docs/"
|
spatialrna-0.3.0.dev0/PKG-INFO
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: spatialrna
|
|
3
|
-
Version: 0.3.0.dev0
|
|
4
|
-
Summary: Spatial RNA graph data processing and analysis for single-molecule spatial transcriptomics (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps.
|
|
5
|
-
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
6
|
-
Classifier: Programming Language :: Python :: 3
|
|
7
|
-
Classifier: Operating System :: OS Independent
|
|
8
|
-
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
9
|
-
Requires-Python: >=3.10
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: numpy
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: scipy
|
|
14
|
-
Requires-Dist: zarr>=3
|
|
15
|
-
Requires-Dist: numcodecs
|
|
16
|
-
Requires-Dist: tqdm
|
|
17
|
-
Requires-Dist: scikit-learn
|
|
18
|
-
Requires-Dist: matplotlib
|
|
19
|
-
Provides-Extra: gnn
|
|
20
|
-
Requires-Dist: torch; extra == "gnn"
|
|
21
|
-
Requires-Dist: torch_geometric; extra == "gnn"
|
|
22
|
-
Provides-Extra: dev
|
|
23
|
-
Requires-Dist: pytest; extra == "dev"
|
|
24
|
-
|
|
25
|
-
# spatialrna
|
|
26
|
-
|
|
27
|
-
Spatial RNA graph data processing and analysis for single-molecule spatial
|
|
28
|
-
transcriptomics (10x Xenium and Atera): transcripts → tile graphs and subgraphs →
|
|
29
|
-
any graph neural network (train / validate / embed) → clusters → spatial maps.
|
|
30
|
-
|
|
31
|
-
This continues the lab's `spatialrna` 0.2 (Ruqian Lyu) with the same scope and adds
|
|
32
|
-
reading of raw Xenium / Atera outputs, zarr storage, a fast KD-tree graph builder,
|
|
33
|
-
balanced grid tiling for large sections, and GPU Gaussian mixtures. The ISTIST
|
|
34
|
-
pipeline builds on it with its own model (CrossSampleGAT), transcript-level
|
|
35
|
-
annotation, statistics and an HTML report.
|
|
36
|
-
|
|
37
|
-
## Install
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
pip install -e . # readers, graph builders, clustering, maps (no torch)
|
|
41
|
-
pip install -e ".[gnn]" # + SpatialRNA dataset, datasets, train_val
|
|
42
|
-
# (install torch + PyG for your CUDA first)
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Python >= 3.10, zarr-python >= 3.
|
|
46
|
-
|
|
47
|
-
## Modules
|
|
48
|
-
|
|
49
|
-
| module | what it does | 0.2 equivalent | needs torch |
|
|
50
|
-
|---|---|---|---|
|
|
51
|
-
| `readers` | Xenium / Atera `transcripts.zarr.zip` → transcripts (layout auto-detected) | – | no |
|
|
52
|
-
| `graph_build` | KD-tree radius graphs, subgraph sampling, `plan_tiles` (grid tiling) | – | no |
|
|
53
|
-
| `graph_zarr_io` | `SpatialRNA`: tiles (strips or grid) + padding → radius graphs → subgraphs, zarr I/O | `spatialrna.py` | yes |
|
|
54
|
-
| `datasets` | `ZarrGraphDataset` over many tile / subgraph stores | `spatialrna_ondisk.py` | yes |
|
|
55
|
-
| `train_val` | model-agnostic link-prediction training / validation, `embed_tile` | `train_val.py` | yes |
|
|
56
|
-
| `cluster` | `gmm` (GPU or numpy EM), `kmeans` | `run_kmeans.py` | optional |
|
|
57
|
-
| `viz` | `pixel_map`, two-panel overviews, one panel per label | `viz.py` | no |
|
|
58
|
-
|
|
59
|
-
## Quick start
|
|
60
|
-
|
|
61
|
-
```python
|
|
62
|
-
import numpy as np, torch
|
|
63
|
-
import spatialrna as sr
|
|
64
|
-
|
|
65
|
-
df = sr.readers.load_transcripts("/path/to/output") # x, y, z, qv, gene
|
|
66
|
-
print(sr.readers.describe("/path/to/output"))
|
|
67
|
-
|
|
68
|
-
# tile graphs (here: 100 near-square tiles with equal transcript counts)
|
|
69
|
-
# SpatialRNA(root="data/S01.zarr", sample_name="S01", cohort_zarr_path="data/cohort.zarr",
|
|
70
|
-
# num_tiles=100, tile_mode="grid", one_hot_encoding=enc, ...)
|
|
71
|
-
|
|
72
|
-
# train any model(x, edge_index) on the tiles / subgraphs
|
|
73
|
-
from spatialrna import train_val as tv
|
|
74
|
-
from spatialrna.datasets import ZarrGraphDataset
|
|
75
|
-
graphs = ZarrGraphDataset.from_sample_store("data/S01.zarr", kind="subgraphs")
|
|
76
|
-
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
|
|
77
|
-
loss, acc = tv.train_link_prediction(model, graphs, opt, device, num_genes)
|
|
78
|
-
emb, tx_id = tv.embed_tile(model, graphs[0], device, num_genes)
|
|
79
|
-
|
|
80
|
-
# clusters and a map
|
|
81
|
-
labels, gmm = sr.cluster.gmm(emb.numpy(), 12)
|
|
82
|
-
fig = sr.viz.pixel_map(x, y, labels)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Tiling
|
|
86
|
-
|
|
87
|
-
`SpatialRNA(tile_mode="strips")` (default, as in 0.2) cuts `num_tiles` equal-width
|
|
88
|
-
bands along `tile_by_dim`. `tile_mode="grid"` cuts near-square tiles with equal
|
|
89
|
-
transcript counts: no empty tiles in irregular tissue and little padding with many
|
|
90
|
-
tiles (~5–7 % at 500 tiles, vs ~40 % for 500 strips).
|
|
91
|
-
|
|
92
|
-
## Tests
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
pip install -e ".[dev]"
|
|
96
|
-
pytest # test_zarr_roundtrip needs the [gnn] extra
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Note on the name
|
|
100
|
-
|
|
101
|
-
`spatialrna` 0.1–0.2 on PyPI is maintained by Ruqian Lyu; this is 0.3.0.dev0.
|
|
102
|
-
Coordinate with her before uploading to PyPI under the same name.
|
spatialrna-0.3.0.dev0/README.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# spatialrna
|
|
2
|
-
|
|
3
|
-
Spatial RNA graph data processing and analysis for single-molecule spatial
|
|
4
|
-
transcriptomics (10x Xenium and Atera): transcripts → tile graphs and subgraphs →
|
|
5
|
-
any graph neural network (train / validate / embed) → clusters → spatial maps.
|
|
6
|
-
|
|
7
|
-
This continues the lab's `spatialrna` 0.2 (Ruqian Lyu) with the same scope and adds
|
|
8
|
-
reading of raw Xenium / Atera outputs, zarr storage, a fast KD-tree graph builder,
|
|
9
|
-
balanced grid tiling for large sections, and GPU Gaussian mixtures. The ISTIST
|
|
10
|
-
pipeline builds on it with its own model (CrossSampleGAT), transcript-level
|
|
11
|
-
annotation, statistics and an HTML report.
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pip install -e . # readers, graph builders, clustering, maps (no torch)
|
|
17
|
-
pip install -e ".[gnn]" # + SpatialRNA dataset, datasets, train_val
|
|
18
|
-
# (install torch + PyG for your CUDA first)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Python >= 3.10, zarr-python >= 3.
|
|
22
|
-
|
|
23
|
-
## Modules
|
|
24
|
-
|
|
25
|
-
| module | what it does | 0.2 equivalent | needs torch |
|
|
26
|
-
|---|---|---|---|
|
|
27
|
-
| `readers` | Xenium / Atera `transcripts.zarr.zip` → transcripts (layout auto-detected) | – | no |
|
|
28
|
-
| `graph_build` | KD-tree radius graphs, subgraph sampling, `plan_tiles` (grid tiling) | – | no |
|
|
29
|
-
| `graph_zarr_io` | `SpatialRNA`: tiles (strips or grid) + padding → radius graphs → subgraphs, zarr I/O | `spatialrna.py` | yes |
|
|
30
|
-
| `datasets` | `ZarrGraphDataset` over many tile / subgraph stores | `spatialrna_ondisk.py` | yes |
|
|
31
|
-
| `train_val` | model-agnostic link-prediction training / validation, `embed_tile` | `train_val.py` | yes |
|
|
32
|
-
| `cluster` | `gmm` (GPU or numpy EM), `kmeans` | `run_kmeans.py` | optional |
|
|
33
|
-
| `viz` | `pixel_map`, two-panel overviews, one panel per label | `viz.py` | no |
|
|
34
|
-
|
|
35
|
-
## Quick start
|
|
36
|
-
|
|
37
|
-
```python
|
|
38
|
-
import numpy as np, torch
|
|
39
|
-
import spatialrna as sr
|
|
40
|
-
|
|
41
|
-
df = sr.readers.load_transcripts("/path/to/output") # x, y, z, qv, gene
|
|
42
|
-
print(sr.readers.describe("/path/to/output"))
|
|
43
|
-
|
|
44
|
-
# tile graphs (here: 100 near-square tiles with equal transcript counts)
|
|
45
|
-
# SpatialRNA(root="data/S01.zarr", sample_name="S01", cohort_zarr_path="data/cohort.zarr",
|
|
46
|
-
# num_tiles=100, tile_mode="grid", one_hot_encoding=enc, ...)
|
|
47
|
-
|
|
48
|
-
# train any model(x, edge_index) on the tiles / subgraphs
|
|
49
|
-
from spatialrna import train_val as tv
|
|
50
|
-
from spatialrna.datasets import ZarrGraphDataset
|
|
51
|
-
graphs = ZarrGraphDataset.from_sample_store("data/S01.zarr", kind="subgraphs")
|
|
52
|
-
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
|
|
53
|
-
loss, acc = tv.train_link_prediction(model, graphs, opt, device, num_genes)
|
|
54
|
-
emb, tx_id = tv.embed_tile(model, graphs[0], device, num_genes)
|
|
55
|
-
|
|
56
|
-
# clusters and a map
|
|
57
|
-
labels, gmm = sr.cluster.gmm(emb.numpy(), 12)
|
|
58
|
-
fig = sr.viz.pixel_map(x, y, labels)
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Tiling
|
|
62
|
-
|
|
63
|
-
`SpatialRNA(tile_mode="strips")` (default, as in 0.2) cuts `num_tiles` equal-width
|
|
64
|
-
bands along `tile_by_dim`. `tile_mode="grid"` cuts near-square tiles with equal
|
|
65
|
-
transcript counts: no empty tiles in irregular tissue and little padding with many
|
|
66
|
-
tiles (~5–7 % at 500 tiles, vs ~40 % for 500 strips).
|
|
67
|
-
|
|
68
|
-
## Tests
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
pip install -e ".[dev]"
|
|
72
|
-
pytest # test_zarr_roundtrip needs the [gnn] extra
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Note on the name
|
|
76
|
-
|
|
77
|
-
`spatialrna` 0.1–0.2 on PyPI is maintained by Ruqian Lyu; this is 0.3.0.dev0.
|
|
78
|
-
Coordinate with her before uploading to PyPI under the same name.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: spatialrna
|
|
3
|
-
Version: 0.3.0.dev0
|
|
4
|
-
Summary: Spatial RNA graph data processing and analysis for single-molecule spatial transcriptomics (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps.
|
|
5
|
-
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
6
|
-
Classifier: Programming Language :: Python :: 3
|
|
7
|
-
Classifier: Operating System :: OS Independent
|
|
8
|
-
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
9
|
-
Requires-Python: >=3.10
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: numpy
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: scipy
|
|
14
|
-
Requires-Dist: zarr>=3
|
|
15
|
-
Requires-Dist: numcodecs
|
|
16
|
-
Requires-Dist: tqdm
|
|
17
|
-
Requires-Dist: scikit-learn
|
|
18
|
-
Requires-Dist: matplotlib
|
|
19
|
-
Provides-Extra: gnn
|
|
20
|
-
Requires-Dist: torch; extra == "gnn"
|
|
21
|
-
Requires-Dist: torch_geometric; extra == "gnn"
|
|
22
|
-
Provides-Extra: dev
|
|
23
|
-
Requires-Dist: pytest; extra == "dev"
|
|
24
|
-
|
|
25
|
-
# spatialrna
|
|
26
|
-
|
|
27
|
-
Spatial RNA graph data processing and analysis for single-molecule spatial
|
|
28
|
-
transcriptomics (10x Xenium and Atera): transcripts → tile graphs and subgraphs →
|
|
29
|
-
any graph neural network (train / validate / embed) → clusters → spatial maps.
|
|
30
|
-
|
|
31
|
-
This continues the lab's `spatialrna` 0.2 (Ruqian Lyu) with the same scope and adds
|
|
32
|
-
reading of raw Xenium / Atera outputs, zarr storage, a fast KD-tree graph builder,
|
|
33
|
-
balanced grid tiling for large sections, and GPU Gaussian mixtures. The ISTIST
|
|
34
|
-
pipeline builds on it with its own model (CrossSampleGAT), transcript-level
|
|
35
|
-
annotation, statistics and an HTML report.
|
|
36
|
-
|
|
37
|
-
## Install
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
pip install -e . # readers, graph builders, clustering, maps (no torch)
|
|
41
|
-
pip install -e ".[gnn]" # + SpatialRNA dataset, datasets, train_val
|
|
42
|
-
# (install torch + PyG for your CUDA first)
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Python >= 3.10, zarr-python >= 3.
|
|
46
|
-
|
|
47
|
-
## Modules
|
|
48
|
-
|
|
49
|
-
| module | what it does | 0.2 equivalent | needs torch |
|
|
50
|
-
|---|---|---|---|
|
|
51
|
-
| `readers` | Xenium / Atera `transcripts.zarr.zip` → transcripts (layout auto-detected) | – | no |
|
|
52
|
-
| `graph_build` | KD-tree radius graphs, subgraph sampling, `plan_tiles` (grid tiling) | – | no |
|
|
53
|
-
| `graph_zarr_io` | `SpatialRNA`: tiles (strips or grid) + padding → radius graphs → subgraphs, zarr I/O | `spatialrna.py` | yes |
|
|
54
|
-
| `datasets` | `ZarrGraphDataset` over many tile / subgraph stores | `spatialrna_ondisk.py` | yes |
|
|
55
|
-
| `train_val` | model-agnostic link-prediction training / validation, `embed_tile` | `train_val.py` | yes |
|
|
56
|
-
| `cluster` | `gmm` (GPU or numpy EM), `kmeans` | `run_kmeans.py` | optional |
|
|
57
|
-
| `viz` | `pixel_map`, two-panel overviews, one panel per label | `viz.py` | no |
|
|
58
|
-
|
|
59
|
-
## Quick start
|
|
60
|
-
|
|
61
|
-
```python
|
|
62
|
-
import numpy as np, torch
|
|
63
|
-
import spatialrna as sr
|
|
64
|
-
|
|
65
|
-
df = sr.readers.load_transcripts("/path/to/output") # x, y, z, qv, gene
|
|
66
|
-
print(sr.readers.describe("/path/to/output"))
|
|
67
|
-
|
|
68
|
-
# tile graphs (here: 100 near-square tiles with equal transcript counts)
|
|
69
|
-
# SpatialRNA(root="data/S01.zarr", sample_name="S01", cohort_zarr_path="data/cohort.zarr",
|
|
70
|
-
# num_tiles=100, tile_mode="grid", one_hot_encoding=enc, ...)
|
|
71
|
-
|
|
72
|
-
# train any model(x, edge_index) on the tiles / subgraphs
|
|
73
|
-
from spatialrna import train_val as tv
|
|
74
|
-
from spatialrna.datasets import ZarrGraphDataset
|
|
75
|
-
graphs = ZarrGraphDataset.from_sample_store("data/S01.zarr", kind="subgraphs")
|
|
76
|
-
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
|
|
77
|
-
loss, acc = tv.train_link_prediction(model, graphs, opt, device, num_genes)
|
|
78
|
-
emb, tx_id = tv.embed_tile(model, graphs[0], device, num_genes)
|
|
79
|
-
|
|
80
|
-
# clusters and a map
|
|
81
|
-
labels, gmm = sr.cluster.gmm(emb.numpy(), 12)
|
|
82
|
-
fig = sr.viz.pixel_map(x, y, labels)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Tiling
|
|
86
|
-
|
|
87
|
-
`SpatialRNA(tile_mode="strips")` (default, as in 0.2) cuts `num_tiles` equal-width
|
|
88
|
-
bands along `tile_by_dim`. `tile_mode="grid"` cuts near-square tiles with equal
|
|
89
|
-
transcript counts: no empty tiles in irregular tissue and little padding with many
|
|
90
|
-
tiles (~5–7 % at 500 tiles, vs ~40 % for 500 strips).
|
|
91
|
-
|
|
92
|
-
## Tests
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
pip install -e ".[dev]"
|
|
96
|
-
pytest # test_zarr_roundtrip needs the [gnn] extra
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Note on the name
|
|
100
|
-
|
|
101
|
-
`spatialrna` 0.1–0.2 on PyPI is maintained by Ruqian Lyu; this is 0.3.0.dev0.
|
|
102
|
-
Coordinate with her before uploading to PyPI under the same name.
|
|
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
|
{spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev1}/src/spatialrna.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|