spatialrna 0.3.0.dev0__tar.gz → 0.3.0.dev2__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.dev2/PKG-INFO +57 -0
- spatialrna-0.3.0.dev2/README.md +31 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/pyproject.toml +6 -5
- spatialrna-0.3.0.dev2/src/spatialrna.egg-info/PKG-INFO +57 -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.dev2}/setup.cfg +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/__init__.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/cluster.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/datasets.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/graph_build.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/graph_zarr_io.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/readers.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/train_val.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna/viz.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna.egg-info/SOURCES.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna.egg-info/dependency_links.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna.egg-info/requires.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/src/spatialrna.egg-info/top_level.txt +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/tests/test_cluster_viz.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/tests/test_readers.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/tests/test_tiling.py +0 -0
- {spatialrna-0.3.0.dev0 → spatialrna-0.3.0.dev2}/tests/test_zarr_roundtrip.py +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spatialrna
|
|
3
|
+
Version: 0.3.0.dev2
|
|
4
|
+
Summary: A package for spatial RNA graph data processing and analysis.
|
|
5
|
+
Author: Ruqian Lyu
|
|
6
|
+
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Requires-Dist: zarr>=3
|
|
17
|
+
Requires-Dist: numcodecs
|
|
18
|
+
Requires-Dist: tqdm
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Provides-Extra: gnn
|
|
22
|
+
Requires-Dist: torch; extra == "gnn"
|
|
23
|
+
Requires-Dist: torch_geometric; extra == "gnn"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest; extra == "dev"
|
|
26
|
+
|
|
27
|
+
# spatialrna
|
|
28
|
+
|
|
29
|
+
A package that provides an easier interface for building graph data from spatial transcriptomics data.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
Create a conda environment with Python >= 3.10:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
conda create -n spatialrna python=3.10
|
|
38
|
+
conda activate spatialrna
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To use the graphs with GNN models, also install PyTorch and PyTorch Geometric matching your CUDA version (see the PyTorch and PyG installation guides).
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install spatialrna
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Development pre-release (0.3.x):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install --pre spatialrna
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Documentation is available at https://ruqianl.github.io/spatialrna_docs/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# spatialrna
|
|
2
|
+
|
|
3
|
+
A package that provides an easier interface for building graph data from spatial transcriptomics data.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Prerequisites
|
|
7
|
+
|
|
8
|
+
Create a conda environment with Python >= 3.10:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
conda create -n spatialrna python=3.10
|
|
12
|
+
conda activate spatialrna
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To use the graphs with GNN models, also install PyTorch and PyTorch Geometric matching your CUDA version (see the PyTorch and PyG installation guides).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install spatialrna
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Development pre-release (0.3.x):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install --pre spatialrna
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
Documentation is available at https://ruqianl.github.io/spatialrna_docs/
|
|
@@ -3,18 +3,18 @@ requires = ["setuptools>=68"]
|
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
|
-
name
|
|
7
|
-
|
|
8
|
-
description = "Spatial RNA graph data processing and analysis for single-molecule spatial transcriptomics (Xenium / Atera): graphs, GNN training / embedding, clustering, spatial maps."
|
|
6
|
+
name="spatialrna"
|
|
7
|
+
description = "A package for spatial RNA graph data processing and analysis."
|
|
9
8
|
readme = "README.md"
|
|
9
|
+
version = "0.3.0.dev2"
|
|
10
|
+
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" },{ name = "Ruqian Lyu" }]
|
|
11
|
+
license = { text = "MIT" }
|
|
10
12
|
requires-python = ">=3.10"
|
|
11
|
-
authors = [{ name = "Anne Pan", email = "anne.pan@svi.edu.au" }]
|
|
12
13
|
classifiers = [
|
|
13
14
|
"Programming Language :: Python :: 3",
|
|
14
15
|
"Operating System :: OS Independent",
|
|
15
16
|
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
16
17
|
]
|
|
17
|
-
# Core: readers, graph builders, clustering, maps. No torch needed.
|
|
18
18
|
dependencies = [
|
|
19
19
|
"numpy",
|
|
20
20
|
"pandas",
|
|
@@ -26,6 +26,7 @@ dependencies = [
|
|
|
26
26
|
"matplotlib",
|
|
27
27
|
]
|
|
28
28
|
|
|
29
|
+
|
|
29
30
|
[project.optional-dependencies]
|
|
30
31
|
# SpatialRNA dataset, datasets, train_val. Install torch and the PyG wheels matching
|
|
31
32
|
# your CUDA first -- see README.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spatialrna
|
|
3
|
+
Version: 0.3.0.dev2
|
|
4
|
+
Summary: A package for spatial RNA graph data processing and analysis.
|
|
5
|
+
Author: Ruqian Lyu
|
|
6
|
+
Author-email: Anne Pan <anne.pan@svi.edu.au>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Requires-Dist: zarr>=3
|
|
17
|
+
Requires-Dist: numcodecs
|
|
18
|
+
Requires-Dist: tqdm
|
|
19
|
+
Requires-Dist: scikit-learn
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Provides-Extra: gnn
|
|
22
|
+
Requires-Dist: torch; extra == "gnn"
|
|
23
|
+
Requires-Dist: torch_geometric; extra == "gnn"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest; extra == "dev"
|
|
26
|
+
|
|
27
|
+
# spatialrna
|
|
28
|
+
|
|
29
|
+
A package that provides an easier interface for building graph data from spatial transcriptomics data.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
Create a conda environment with Python >= 3.10:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
conda create -n spatialrna python=3.10
|
|
38
|
+
conda activate spatialrna
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To use the graphs with GNN models, also install PyTorch and PyTorch Geometric matching your CUDA version (see the PyTorch and PyG installation guides).
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install spatialrna
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Development pre-release (0.3.x):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install --pre spatialrna
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Documentation is available at 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.dev2}/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
|