spatialrna 0.3.0.dev0__py3-none-any.whl → 0.3.0.dev2__py3-none-any.whl

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.
@@ -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/
@@ -6,7 +6,7 @@ spatialrna/graph_zarr_io.py,sha256=Ny7-MtGp0F27I_ZF4ZXhGsPDbY1R8rhAm6CFbWCCLPc,4
6
6
  spatialrna/readers.py,sha256=M-LlPpx4R3wfmXhs8XPHyraonWD2mzbBQOR2VJUSLPI,14010
7
7
  spatialrna/train_val.py,sha256=XGYCWvojxY4lAlcFt9HrDGIFAYQlRhnjUgO_ImntBWk,6307
8
8
  spatialrna/viz.py,sha256=t7NOWaHzgu1DLKWPk1piesVs7msxC7EoiLV4zAiI25Q,16113
9
- spatialrna-0.3.0.dev0.dist-info/METADATA,sha256=EINur4TvlZj8o0hAt3TiCdiz8ljDBsyHMD96LlrOFfU,4140
10
- spatialrna-0.3.0.dev0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
11
- spatialrna-0.3.0.dev0.dist-info/top_level.txt,sha256=ut3eWOeVxuENQDeJnQpkMdZWj05UCaHadGGT1tdX3vU,11
12
- spatialrna-0.3.0.dev0.dist-info/RECORD,,
9
+ spatialrna-0.3.0.dev2.dist-info/METADATA,sha256=py53ZY3LKy4ABN4xT_6XFWSZAykc7ATuFSE4S9Hru2Q,1415
10
+ spatialrna-0.3.0.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
11
+ spatialrna-0.3.0.dev2.dist-info/top_level.txt,sha256=ut3eWOeVxuENQDeJnQpkMdZWj05UCaHadGGT1tdX3vU,11
12
+ spatialrna-0.3.0.dev2.dist-info/RECORD,,
@@ -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.