spatial-aim 1.0.1__tar.gz → 1.2.0__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.
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/.github/workflows/ci.yml +17 -17
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/.gitignore +4 -2
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/PKG-INFO +47 -46
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/README.md +43 -43
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/environment.yml +4 -3
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/pyproject.toml +11 -10
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/src/spatial_aim.egg-info/PKG-INFO +47 -46
- spatial_aim-1.2.0/src/spatial_aim.egg-info/SOURCES.txt +101 -0
- spatial_aim-1.2.0/src/spatial_aim.egg-info/entry_points.txt +2 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/src/spatial_aim.egg-info/requires.txt +1 -0
- spatial_aim-1.2.0/src/spatial_aim.egg-info/scm_file_list.json +97 -0
- spatial_aim-1.2.0/src/spatial_aim.egg-info/scm_version.json +8 -0
- spatial_aim-1.2.0/src/spatial_aim.egg-info/top_level.txt +1 -0
- spatial_aim-1.2.0/src/spatialaim/__init__.py +47 -0
- spatial_aim-1.2.0/src/spatialaim/__main__.py +6 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/aggregation.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/biology.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/confidence.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/ksweep.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/loading.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/onehot.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/reconstruction.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/topology.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/cli.py +25 -25
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/clustering.py +2 -2
- spatial_aim-1.0.1/src/aim/aim_config.py → spatial_aim-1.2.0/src/spatialaim/config.py +5 -5
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/README.md +11 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/__init__.py +12 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/_common.py +192 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_01_mouse_ssp.py +339 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_02_colorectal_cancer.py +333 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_03_mouse_liver.py +284 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_04_mouse_kidney.py +307 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_05_mouse_embryo.py +482 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_06_mouse_retina.py +488 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_07_mouse_mpfc.py +277 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_08_mouse_visual_cortex.py +312 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_09_human_breast_cancer.py +259 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/curate_10_human_mtg.py +212 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/dump_retina_counts.R +55 -0
- spatial_aim-1.2.0/src/spatialaim/data/curate_datasets/environment_retina_qs.yml +17 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/__init__.py +6 -6
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/common.py +3 -3
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/runner.py +4 -4
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/validate_pair.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/validate_sc.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/validate/validate_st.py +1 -1
- spatial_aim-1.2.0/src/spatialaim/gui/__init__.py +8 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/__main__.py +12 -12
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/app.py +612 -164
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/compute.py +8 -8
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/data_access.py +16 -3
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/render.py +842 -77
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/scaffold.py +6 -6
- spatial_aim-1.2.0/src/spatialaim/gui/state_names.py +113 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/gui/widgets.py +189 -54
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/io.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/base.py +2 -2
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/reference.py +5 -5
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/wann.py +4 -4
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/cossim.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/kselection.py +1 -1
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/registry.py +8 -8
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/sweep.py +5 -5
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/tree.py +3 -3
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/tests/test_cli.py +13 -13
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/tests/test_gui_imports.py +2 -2
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/tests/test_registry.py +1 -1
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/tests/test_sweep_sample.py +13 -11
- spatial_aim-1.0.1/src/aim/__init__.py +0 -47
- spatial_aim-1.0.1/src/aim/__main__.py +0 -6
- spatial_aim-1.0.1/src/aim/data/prepare/build_imaging_pairs.py +0 -397
- spatial_aim-1.0.1/src/aim/data/prepare/build_xenium_breast_pair.py +0 -310
- spatial_aim-1.0.1/src/aim/data/prepare/convertTsvToCsv.py +0 -39
- spatial_aim-1.0.1/src/aim/data/prepare/convert_csv_to_h5ad.py +0 -217
- spatial_aim-1.0.1/src/aim/data/prepare/createOnlyHVGDataset.py +0 -69
- spatial_aim-1.0.1/src/aim/data/prepare/createSmallerDataset.py +0 -102
- spatial_aim-1.0.1/src/aim/data/prepare/normalize_gene_names.py +0 -56
- spatial_aim-1.0.1/src/aim/data/prepare/perturb_sc_noise.py +0 -107
- spatial_aim-1.0.1/src/aim/data/prepare/register_st_patches.py +0 -180
- spatial_aim-1.0.1/src/aim/data/prepare/split_st_into_islands.py +0 -551
- spatial_aim-1.0.1/src/aim/data/prepare/split_st_into_patches.py +0 -240
- spatial_aim-1.0.1/src/aim/data/prepare/subset_st_hvg.py +0 -43
- spatial_aim-1.0.1/src/aim/gui/__init__.py +0 -8
- spatial_aim-1.0.1/src/aim/reference_aligners/__init__.py +0 -0
- spatial_aim-1.0.1/src/spatial_aim.egg-info/SOURCES.txt +0 -98
- spatial_aim-1.0.1/src/spatial_aim.egg-info/entry_points.txt +0 -2
- spatial_aim-1.0.1/src/spatial_aim.egg-info/scm_file_list.json +0 -94
- spatial_aim-1.0.1/src/spatial_aim.egg-info/scm_version.json +0 -8
- spatial_aim-1.0.1/src/spatial_aim.egg-info/top_level.txt +0 -1
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/.github/workflows/release.yml +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/.pre-commit-config.yaml +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/LICENSE +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/docs/aim_gui.gif +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/docs/figure_2_1.png +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/renovate.json +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/sample_dataset/ST/index.csv +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/sample_dataset/ST/sample_st.h5ad +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/sample_dataset/pairs.csv +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/sample_dataset/scRNA/index.csv +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/sample_dataset/scRNA/sample_sc.h5ad +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/setup.cfg +0 -0
- {spatial_aim-1.0.1 → spatial_aim-1.2.0}/src/spatial_aim.egg-info/dependency_links.txt +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/adata_schema.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/__init__.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/analysis.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/analysis/utils.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/data/__init__.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/__init__.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/confidence.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/mapping/nearest_centroid.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/__init__.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/biology.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/onehot.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/reconstruction.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/metrics/topology.py +0 -0
- {spatial_aim-1.0.1/src/aim/data/prepare → spatial_aim-1.2.0/src/spatialaim/reference_aligners}/__init__.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/environment_dot.yml +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/environment_tacco.yml +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/environment_tangram.yml +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/run_dot.R +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/run_dot.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/run_tacco.py +0 -0
- {spatial_aim-1.0.1/src/aim → spatial_aim-1.2.0/src/spatialaim}/reference_aligners/run_tangram.py +0 -0
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
python-version: "3.13"
|
|
19
19
|
- name: Install lint tools
|
|
20
20
|
run: pip install black mypy types-PyYAML
|
|
21
|
-
- name: Install package without deps so `
|
|
21
|
+
- name: Install package without deps so `spatialaim` is importable for mypy
|
|
22
22
|
run: pip install -e . --no-deps
|
|
23
23
|
- name: black
|
|
24
24
|
run: black --check .
|
|
@@ -58,8 +58,8 @@ jobs:
|
|
|
58
58
|
name: dist
|
|
59
59
|
path: dist/*
|
|
60
60
|
|
|
61
|
-
integration-
|
|
62
|
-
# End-to-end
|
|
61
|
+
integration-spatialaim:
|
|
62
|
+
# End-to-end SpatialAIM sweep on the sample dataset in spatialaim_env.
|
|
63
63
|
runs-on: ubuntu-latest
|
|
64
64
|
defaults:
|
|
65
65
|
run:
|
|
@@ -70,30 +70,30 @@ jobs:
|
|
|
70
70
|
fetch-depth: 0
|
|
71
71
|
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4
|
|
72
72
|
with:
|
|
73
|
-
activate-environment:
|
|
73
|
+
activate-environment: spatialaim_env
|
|
74
74
|
environment-file: environment.yml
|
|
75
75
|
auto-activate-base: false
|
|
76
76
|
miniforge-version: latest
|
|
77
77
|
cache-environment: true
|
|
78
78
|
- name: Install package (no deps; env already has them)
|
|
79
79
|
run: pip install -e . --no-deps
|
|
80
|
-
- name:
|
|
80
|
+
- name: spatialaim run — single pair (nearest_centroid)
|
|
81
81
|
run: |
|
|
82
|
-
|
|
82
|
+
spatialaim run \
|
|
83
83
|
--scdata sample_dataset/scRNA/sample_sc.h5ad \
|
|
84
84
|
--stdata sample_dataset/ST/sample_st.h5ad \
|
|
85
85
|
--output_dir sample_output/novel/nearest_centroid \
|
|
86
86
|
--mapping nearest_centroid --leiden_resolution 3.0
|
|
87
|
-
- name:
|
|
87
|
+
- name: spatialaim run — single pair (wann)
|
|
88
88
|
run: |
|
|
89
|
-
|
|
89
|
+
spatialaim run \
|
|
90
90
|
--scdata sample_dataset/scRNA/sample_sc.h5ad \
|
|
91
91
|
--stdata sample_dataset/ST/sample_st.h5ad \
|
|
92
92
|
--output_dir sample_output/novel/wann \
|
|
93
93
|
--mapping wann --leiden_resolution 3.0
|
|
94
|
-
- name:
|
|
94
|
+
- name: spatialaim run — batch (all pairs)
|
|
95
95
|
run: |
|
|
96
|
-
|
|
96
|
+
spatialaim run \
|
|
97
97
|
--pairs_csv sample_dataset/pairs.csv \
|
|
98
98
|
--sc_dir sample_dataset/scRNA \
|
|
99
99
|
--st_dir sample_dataset/ST \
|
|
@@ -103,7 +103,7 @@ jobs:
|
|
|
103
103
|
run: pytest -m slow
|
|
104
104
|
|
|
105
105
|
integration-reference:
|
|
106
|
-
# Reference-aligner path:
|
|
106
|
+
# Reference-aligner path: spatialaim_env orchestrates the sweep (single + batch) with
|
|
107
107
|
# `--mapping tangram`, so ReferenceMapper drives an AlignerWorker and
|
|
108
108
|
# tangram_env runs the aligner via `conda run`, once per K.
|
|
109
109
|
runs-on: ubuntu-latest
|
|
@@ -116,26 +116,26 @@ jobs:
|
|
|
116
116
|
fetch-depth: 0
|
|
117
117
|
- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4
|
|
118
118
|
with:
|
|
119
|
-
activate-environment:
|
|
119
|
+
activate-environment: spatialaim_env
|
|
120
120
|
environment-file: environment.yml
|
|
121
121
|
auto-activate-base: false
|
|
122
122
|
miniforge-version: latest
|
|
123
123
|
cache-environment: true
|
|
124
124
|
- name: Create tangram_env
|
|
125
|
-
run: conda env create -f src/
|
|
125
|
+
run: conda env create -f src/spatialaim/reference_aligners/environment_tangram.yml
|
|
126
126
|
- name: Install package into both envs (no deps)
|
|
127
127
|
run: |
|
|
128
128
|
pip install -e . --no-deps
|
|
129
129
|
conda run -n tangram_env pip install -e . --no-deps
|
|
130
|
-
- name:
|
|
130
|
+
- name: spatialaim run — single pair (tangram)
|
|
131
131
|
run: |
|
|
132
|
-
|
|
132
|
+
spatialaim run --mapping tangram \
|
|
133
133
|
--scdata sample_dataset/scRNA/sample_sc.h5ad \
|
|
134
134
|
--stdata sample_dataset/ST/sample_st.h5ad \
|
|
135
135
|
--output_dir sample_output/tangram/sample
|
|
136
|
-
- name:
|
|
136
|
+
- name: spatialaim run — batch (tangram)
|
|
137
137
|
run: |
|
|
138
|
-
|
|
138
|
+
spatialaim run --mapping tangram \
|
|
139
139
|
--pairs_csv sample_dataset/pairs.csv \
|
|
140
140
|
--sc_dir sample_dataset/scRNA \
|
|
141
141
|
--st_dir sample_dataset/ST \
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spatial-aim
|
|
3
|
-
Version: 1.0
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: SpatialAIM — annotation-independent mapping of scRNA-seq references onto high-resolution spatial transcriptomics
|
|
5
5
|
Author-email: Dominik Pysch <dominik.pysch@fau.de>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
7
7
|
Version 3, 29 June 2007
|
|
@@ -678,7 +678,7 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
678
678
|
Public License instead of this License. But first, please read
|
|
679
679
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
680
680
|
|
|
681
|
-
Project-URL: Repository, https://github.com/domipysch/
|
|
681
|
+
Project-URL: Repository, https://github.com/domipysch/SpatialAIM-Repository
|
|
682
682
|
Keywords: spatial transcriptomics,single-cell,scRNA-seq,cell state mapping,deconvolution,bioinformatics
|
|
683
683
|
Classifier: Development Status :: 3 - Alpha
|
|
684
684
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -708,6 +708,7 @@ Requires-Dist: kaleido>=0.2
|
|
|
708
708
|
Provides-Extra: data
|
|
709
709
|
Requires-Dist: matplotlib>=3.9; extra == "data"
|
|
710
710
|
Requires-Dist: scikit-learn>=1.4; extra == "data"
|
|
711
|
+
Requires-Dist: rdata>=1.1; extra == "data"
|
|
711
712
|
Provides-Extra: dev
|
|
712
713
|
Requires-Dist: pytest>=8; extra == "dev"
|
|
713
714
|
Requires-Dist: black>=24; extra == "dev"
|
|
@@ -718,7 +719,7 @@ Requires-Dist: twine>=5; extra == "dev"
|
|
|
718
719
|
Requires-Dist: types-PyYAML; extra == "dev"
|
|
719
720
|
Dynamic: license-file
|
|
720
721
|
|
|
721
|
-
#
|
|
722
|
+
# SpatialAIM — Annotation-Independent Mapping
|
|
722
723
|
|
|
723
724
|
**Quick install**
|
|
724
725
|
|
|
@@ -726,12 +727,12 @@ Dynamic: license-file
|
|
|
726
727
|
# Install from PyPi
|
|
727
728
|
pip install spatial-aim
|
|
728
729
|
# Run GUI
|
|
729
|
-
|
|
730
|
+
spatialaim gui
|
|
730
731
|
```
|
|
731
732
|
|
|
732
733
|
---
|
|
733
734
|
|
|
734
|
-
**
|
|
735
|
+
**SpatialAIM** maps an **unannotated** scRNA-seq reference (scRNA) onto single-cell-resolution spatial transcriptomics (ST) in a **GUI** or **CLI**. For a scRNA/ST pair it:
|
|
735
736
|
|
|
736
737
|
1. **Over-clusters** the scRNA reference once with Leiden into `L` start clusters.
|
|
737
738
|
2. Builds **one agglomeration tree** over those start clusters.
|
|
@@ -749,12 +750,12 @@ If you want to replace the Leiden overclustering from Step 1 with your own annot
|
|
|
749
750
|
|
|
750
751
|
## Outline
|
|
751
752
|
|
|
752
|
-
- [Why
|
|
753
|
+
- [Why SpatialAIM?](#why-spatialaim)
|
|
753
754
|
- [Input data format](#input-data-format)
|
|
754
755
|
- [For users](#for-users)
|
|
755
756
|
- [For developers](#for-developers)
|
|
756
757
|
|
|
757
|
-
## Why
|
|
758
|
+
## Why SpatialAIM?
|
|
758
759
|
|
|
759
760
|
Conventional mapping methods blindly map a **pre-annotated** scRNA reference onto spots, even if there is not enough signal in the spatial data to reliably distinguish between them.
|
|
760
761
|
The hierarchical cell type clustering is based on both the scRNA and the ST data at hand. The user can find a cell type granularity that can be mapped reliably.
|
|
@@ -763,7 +764,7 @@ The hierarchical cell type clustering is based on both the scRNA and the ST data
|
|
|
763
764
|
|
|
764
765
|
## Input data format
|
|
765
766
|
|
|
766
|
-
To run
|
|
767
|
+
To run SpatialAIM, you need a pair of a scRNA dataset and a ST dataset, both as raw counts in `.h5ad` format.
|
|
767
768
|
|
|
768
769
|
- **scRNA `<Name>.h5ad`**: `X` = raw counts (cells × genes); `var_names` = **uppercase** gene symbols.
|
|
769
770
|
- **ST `<Name>.h5ad`**: `X` = raw counts (spots × genes); `var_names` = **uppercase** gene symbols; `obsm["spatial"]` = (x, y)-coordinates of the spots: (n_spots × 2).
|
|
@@ -774,7 +775,7 @@ Just have the two `.h5ad` files available and you are good to go.
|
|
|
774
775
|
|
|
775
776
|
### Batch processing
|
|
776
777
|
|
|
777
|
-
|
|
778
|
+
SpatialAIM also supports batch processing of multiple pairs.
|
|
778
779
|
Organise the data relationally the following way so one scRNA reference can be reused across many ST slices:
|
|
779
780
|
|
|
780
781
|
```
|
|
@@ -788,46 +789,46 @@ DATA/
|
|
|
788
789
|
└── pairs.csv # links scRNA ↔ ST: PairID, scName, stName, …
|
|
789
790
|
```
|
|
790
791
|
|
|
791
|
-
See [`sample_dataset/`](sample_dataset) for a minimal example, and validate your own layout with [`
|
|
792
|
+
See [`sample_dataset/`](sample_dataset) for a minimal example, and validate your own layout with [`spatialaim validate`](#validate-a-dataset-pair-spatialaim-validate).
|
|
792
793
|
|
|
793
794
|
## For users
|
|
794
795
|
|
|
795
796
|
### Installation
|
|
796
797
|
|
|
797
|
-
|
|
798
|
+
SpatialAIM is installable from PyPI:
|
|
798
799
|
|
|
799
800
|
```bash
|
|
800
801
|
pip install spatial-aim
|
|
801
802
|
```
|
|
802
803
|
|
|
803
|
-
This installs one command, `
|
|
804
|
-
You can now already run `
|
|
804
|
+
This installs one command, `spatialaim`, with subcommands (`spatialaim --help`).
|
|
805
|
+
You can now already run `spatialaim` with the baseline mappers.
|
|
805
806
|
|
|
806
|
-
If you want to be able to select one of the reference aligners within
|
|
807
|
+
If you want to be able to select one of the reference aligners within SpatialAIM, you need `conda` installed on your machine.
|
|
807
808
|
Please install the corresponding conda environments on your computer.
|
|
808
809
|
|
|
809
810
|
| Method | Environment | Command |
|
|
810
811
|
| ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
811
|
-
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
812
|
-
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
813
|
-
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
812
|
+
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tangram.yml` |
|
|
813
|
+
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tacco.yml` |
|
|
814
|
+
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_dot.yml` then `Rscript -e "remotes::install_github('saezlab/DOT')"` |
|
|
814
815
|
|
|
815
|
-
> For
|
|
816
|
+
> For SpatialAIM to use the environments, please make sure SpatialAIM can find your conda executable.
|
|
816
817
|
> Either set the environment variable `CONDA_EXE` or add your path to your conda installation to `PATH`.
|
|
817
818
|
> Make sure `exe = os.environ.get("CONDA_EXE") or shutil.which("conda")` returns the path to your conda.
|
|
818
819
|
|
|
819
|
-
### Validate a dataset pair (`
|
|
820
|
+
### Validate a dataset pair (`spatialaim validate`)
|
|
820
821
|
|
|
821
822
|
Check whether your data meets the main requirements.
|
|
822
823
|
|
|
823
824
|
```bash
|
|
824
|
-
|
|
825
|
+
spatialaim validate --scdata path/to/sc.h5ad --stdata path/to/st.h5ad
|
|
825
826
|
```
|
|
826
827
|
|
|
827
828
|
or for every pair of a `pairs.csv` laid out as in [Batch Processing](#batch-processing):
|
|
828
829
|
|
|
829
830
|
```bash
|
|
830
|
-
|
|
831
|
+
spatialaim validate --pairs_csv path/to/DATA/pairs.csv
|
|
831
832
|
```
|
|
832
833
|
|
|
833
834
|
Validations per dataset:
|
|
@@ -844,21 +845,21 @@ Validations per dataset:
|
|
|
844
845
|
- whether any ST spot is left all-zero by it.
|
|
845
846
|
- If an `index.csv` sits next to the `.h5ad` files, its recorded counts and cell-type keys are cross-checked as well.
|
|
846
847
|
|
|
847
|
-
### Run via GUI (`
|
|
848
|
+
### Run via GUI (`spatialaim gui`)
|
|
848
849
|
|
|
849
|
-
Interactive [Streamlit](https://streamlit.io) app to run
|
|
850
|
+
Interactive [Streamlit](https://streamlit.io) app to run SpatialAIM from the browser and interactively browse the results for one scRNA/ST pair without any .
|
|
850
851
|
|
|
851
852
|
```bash
|
|
852
|
-
|
|
853
|
+
spatialaim gui [--server_port 8501]
|
|
853
854
|
```
|
|
854
855
|
|
|
855
856
|
Open the printed URL (default http://localhost:8501), set the inputs, pick one or multiple mapper(s), and click **Run**.
|
|
856
|
-
As soon as both `.h5ad` paths are set, the GUI runs the same checks as [`
|
|
857
|
+
As soon as both `.h5ad` paths are set, the GUI runs the same checks as [`spatialaim validate`](#validate-a-dataset-pair-spatialaim-validate) on that pair: a clean pair is confirmed with a tick in the sidebar, any error or warning is shown in a dialog you can close to continue anyway.
|
|
857
858
|
The GUI writes each mapper's sweep to `<output_dir>/<mapper>/`. The results using each mapper are visualized in different tabs. When having run multiple mappers, also a "Compare" tab appears.
|
|
858
859
|
|
|
859
|
-
### Run via CLI (`
|
|
860
|
+
### Run via CLI (`spatialaim run`)
|
|
860
861
|
|
|
861
|
-
Run
|
|
862
|
+
Run SpatialAIM via CLI on a single pair or in batch mode.
|
|
862
863
|
The spot→state mapper is chosen with argument `--mapping`:
|
|
863
864
|
|
|
864
865
|
- **`nearest_centroid`** (default): Per spot, select the cell state by highest cosine similarity between the state's centroid and the spot's expression. One-hot assignment by default.
|
|
@@ -878,7 +879,7 @@ Give such runs their own `--output_dir`: a run root is named after the mapper al
|
|
|
878
879
|
**Single pair**
|
|
879
880
|
|
|
880
881
|
```bash
|
|
881
|
-
|
|
882
|
+
spatialaim run --scdata path/to/sc.h5ad \
|
|
882
883
|
--stdata path/to/st.h5ad \
|
|
883
884
|
--output_dir path/to/out_dir \
|
|
884
885
|
[--mapping nearest_centroid|wann|tangram|tacco|dot] \
|
|
@@ -892,7 +893,7 @@ aim run --scdata path/to/sc.h5ad \
|
|
|
892
893
|
**Batch mode (all pairs in `pairs.csv`):**
|
|
893
894
|
|
|
894
895
|
```bash
|
|
895
|
-
|
|
896
|
+
spatialaim run --pairs_csv path/to/pairs.csv \
|
|
896
897
|
--sc_dir path/to/scRNA \
|
|
897
898
|
--st_dir path/to/ST \
|
|
898
899
|
--output_dir path/to/out_dir \
|
|
@@ -925,7 +926,7 @@ Each pair is written to `<out_dir>/<PairID>_<scName>__<stName>/`.
|
|
|
925
926
|
**Sample-dataset example:**
|
|
926
927
|
|
|
927
928
|
```bash
|
|
928
|
-
|
|
929
|
+
spatialaim run \
|
|
929
930
|
--scdata sample_dataset/scRNA/sample_sc.h5ad \
|
|
930
931
|
--stdata sample_dataset/ST/sample_st.h5ad \
|
|
931
932
|
--output_dir sample_output/sample
|
|
@@ -935,7 +936,7 @@ aim run \
|
|
|
935
936
|
|
|
936
937
|
### Annotation-based baseline
|
|
937
938
|
|
|
938
|
-
There is no separate command for it: `
|
|
939
|
+
There is no separate command for it: `spatialaim run --start_from_annotation <obs_column>` covers it.
|
|
939
940
|
The annotated types become the start clusters, and the sweep's **`K` = number-of-types** level is the baseline.
|
|
940
941
|
|
|
941
942
|
## For developers
|
|
@@ -947,36 +948,36 @@ This will include everything apart from the reference aligner methods.
|
|
|
947
948
|
|
|
948
949
|
```bash
|
|
949
950
|
conda env create -f environment.yml
|
|
950
|
-
conda activate
|
|
951
|
+
conda activate spatialaim_env
|
|
951
952
|
|
|
952
|
-
# Optional: Install the
|
|
953
|
+
# Optional: Install the SpatialAIM-CLI from local
|
|
953
954
|
pip install -e . --no-deps
|
|
954
955
|
```
|
|
955
956
|
|
|
956
957
|
#### Environments of reference aligners
|
|
957
958
|
|
|
958
|
-
If you want to use one of the reference aligners within
|
|
959
|
+
If you want to use one of the reference aligners within SpatialAIM or standalone, you have to additionally create the following environments. Each reference aligner runs in its own conda environment.
|
|
959
960
|
|
|
960
|
-
|
|
961
|
+
SpatialAIM orchestrates them out-of-process via `conda run`, so you need `conda` on `PATH`. The env `.yml` files live in the repo under [`src/spatialaim/reference_aligners/`](https://github.com/domipysch/SpatialAIM-Repository/tree/main/src/spatialaim/reference_aligners).
|
|
961
962
|
|
|
962
963
|
| Method | Environment | Create |
|
|
963
964
|
| ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
964
|
-
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
965
|
-
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
966
|
-
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
965
|
+
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tangram.yml` |
|
|
966
|
+
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tacco.yml` |
|
|
967
|
+
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_dot.yml` then `Rscript -e "remotes::install_github('saezlab/DOT')"` |
|
|
967
968
|
|
|
968
969
|
|
|
969
970
|
### Adding another reference aligner
|
|
970
971
|
|
|
971
972
|
Reference aligners are pluggable.
|
|
972
973
|
Each runs the same way: a wrapper launched out-of-process in its own conda env.
|
|
973
|
-
The framework learns about it from a **single registry**,[`src/
|
|
974
|
+
The framework learns about it from a **single registry**,[`src/spatialaim/reference_aligners/registry.py`](src/spatialaim/reference_aligners/registry.py).
|
|
974
975
|
|
|
975
976
|
Adding a reference aligner is three steps:
|
|
976
977
|
|
|
977
|
-
**1. Add the conda environment file and create it**, e.g. `conda env create -f src/
|
|
978
|
+
**1. Add the conda environment file and create it**, e.g. `conda env create -f src/spatialaim/reference_aligners/environment_<name>.yml`.
|
|
978
979
|
|
|
979
|
-
**2. Write `src/
|
|
980
|
+
**2. Write `src/spatialaim/reference_aligners/run_<name>.py`** satisfying the CLI API:
|
|
980
981
|
|
|
981
982
|
| | Contract |
|
|
982
983
|
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -988,16 +989,16 @@ Invoked with only those four args, the wrapper must reproduce its canonical mapp
|
|
|
988
989
|
|
|
989
990
|
**3. Register it**
|
|
990
991
|
|
|
991
|
-
Add one line to `REFERENCE_ALIGNERS` ([`src/
|
|
992
|
+
Add one line to `REFERENCE_ALIGNERS` ([`src/spatialaim/reference_aligners/registry.py`](src/spatialaim/reference_aligners/registry.py)).
|
|
992
993
|
|
|
993
994
|
```python
|
|
994
|
-
ReferenceAligner("<name>", "<name>_env", "
|
|
995
|
+
ReferenceAligner("<name>", "<name>_env", "spatialaim.reference_aligners.run_<name>"),
|
|
995
996
|
```
|
|
996
997
|
|
|
997
998
|
It is then selectable everywhere automatically:
|
|
998
999
|
|
|
999
|
-
- `
|
|
1000
|
-
- `
|
|
1000
|
+
- `spatialaim gui` (it will be selectable in the sidebar)
|
|
1001
|
+
- `spatialaim run --mapping <name>` (as an SpatialAIM reference mapper, one alignment per `K`) — including `--start_from_annotation`, where it maps onto a pre-existing annotation
|
|
1001
1002
|
|
|
1002
1003
|
**4. Create PR**
|
|
1003
1004
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SpatialAIM — Annotation-Independent Mapping
|
|
2
2
|
|
|
3
3
|
**Quick install**
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
# Install from PyPi
|
|
7
7
|
pip install spatial-aim
|
|
8
8
|
# Run GUI
|
|
9
|
-
|
|
9
|
+
spatialaim gui
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
**
|
|
14
|
+
**SpatialAIM** maps an **unannotated** scRNA-seq reference (scRNA) onto single-cell-resolution spatial transcriptomics (ST) in a **GUI** or **CLI**. For a scRNA/ST pair it:
|
|
15
15
|
|
|
16
16
|
1. **Over-clusters** the scRNA reference once with Leiden into `L` start clusters.
|
|
17
17
|
2. Builds **one agglomeration tree** over those start clusters.
|
|
@@ -29,12 +29,12 @@ If you want to replace the Leiden overclustering from Step 1 with your own annot
|
|
|
29
29
|
|
|
30
30
|
## Outline
|
|
31
31
|
|
|
32
|
-
- [Why
|
|
32
|
+
- [Why SpatialAIM?](#why-spatialaim)
|
|
33
33
|
- [Input data format](#input-data-format)
|
|
34
34
|
- [For users](#for-users)
|
|
35
35
|
- [For developers](#for-developers)
|
|
36
36
|
|
|
37
|
-
## Why
|
|
37
|
+
## Why SpatialAIM?
|
|
38
38
|
|
|
39
39
|
Conventional mapping methods blindly map a **pre-annotated** scRNA reference onto spots, even if there is not enough signal in the spatial data to reliably distinguish between them.
|
|
40
40
|
The hierarchical cell type clustering is based on both the scRNA and the ST data at hand. The user can find a cell type granularity that can be mapped reliably.
|
|
@@ -43,7 +43,7 @@ The hierarchical cell type clustering is based on both the scRNA and the ST data
|
|
|
43
43
|
|
|
44
44
|
## Input data format
|
|
45
45
|
|
|
46
|
-
To run
|
|
46
|
+
To run SpatialAIM, you need a pair of a scRNA dataset and a ST dataset, both as raw counts in `.h5ad` format.
|
|
47
47
|
|
|
48
48
|
- **scRNA `<Name>.h5ad`**: `X` = raw counts (cells × genes); `var_names` = **uppercase** gene symbols.
|
|
49
49
|
- **ST `<Name>.h5ad`**: `X` = raw counts (spots × genes); `var_names` = **uppercase** gene symbols; `obsm["spatial"]` = (x, y)-coordinates of the spots: (n_spots × 2).
|
|
@@ -54,7 +54,7 @@ Just have the two `.h5ad` files available and you are good to go.
|
|
|
54
54
|
|
|
55
55
|
### Batch processing
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
SpatialAIM also supports batch processing of multiple pairs.
|
|
58
58
|
Organise the data relationally the following way so one scRNA reference can be reused across many ST slices:
|
|
59
59
|
|
|
60
60
|
```
|
|
@@ -68,46 +68,46 @@ DATA/
|
|
|
68
68
|
└── pairs.csv # links scRNA ↔ ST: PairID, scName, stName, …
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
See [`sample_dataset/`](sample_dataset) for a minimal example, and validate your own layout with [`
|
|
71
|
+
See [`sample_dataset/`](sample_dataset) for a minimal example, and validate your own layout with [`spatialaim validate`](#validate-a-dataset-pair-spatialaim-validate).
|
|
72
72
|
|
|
73
73
|
## For users
|
|
74
74
|
|
|
75
75
|
### Installation
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
SpatialAIM is installable from PyPI:
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
80
|
pip install spatial-aim
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
This installs one command, `
|
|
84
|
-
You can now already run `
|
|
83
|
+
This installs one command, `spatialaim`, with subcommands (`spatialaim --help`).
|
|
84
|
+
You can now already run `spatialaim` with the baseline mappers.
|
|
85
85
|
|
|
86
|
-
If you want to be able to select one of the reference aligners within
|
|
86
|
+
If you want to be able to select one of the reference aligners within SpatialAIM, you need `conda` installed on your machine.
|
|
87
87
|
Please install the corresponding conda environments on your computer.
|
|
88
88
|
|
|
89
89
|
| Method | Environment | Command |
|
|
90
90
|
| ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
91
|
-
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
92
|
-
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
93
|
-
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
91
|
+
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tangram.yml` |
|
|
92
|
+
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tacco.yml` |
|
|
93
|
+
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_dot.yml` then `Rscript -e "remotes::install_github('saezlab/DOT')"` |
|
|
94
94
|
|
|
95
|
-
> For
|
|
95
|
+
> For SpatialAIM to use the environments, please make sure SpatialAIM can find your conda executable.
|
|
96
96
|
> Either set the environment variable `CONDA_EXE` or add your path to your conda installation to `PATH`.
|
|
97
97
|
> Make sure `exe = os.environ.get("CONDA_EXE") or shutil.which("conda")` returns the path to your conda.
|
|
98
98
|
|
|
99
|
-
### Validate a dataset pair (`
|
|
99
|
+
### Validate a dataset pair (`spatialaim validate`)
|
|
100
100
|
|
|
101
101
|
Check whether your data meets the main requirements.
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
|
-
|
|
104
|
+
spatialaim validate --scdata path/to/sc.h5ad --stdata path/to/st.h5ad
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
or for every pair of a `pairs.csv` laid out as in [Batch Processing](#batch-processing):
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
|
|
110
|
+
spatialaim validate --pairs_csv path/to/DATA/pairs.csv
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
Validations per dataset:
|
|
@@ -124,21 +124,21 @@ Validations per dataset:
|
|
|
124
124
|
- whether any ST spot is left all-zero by it.
|
|
125
125
|
- If an `index.csv` sits next to the `.h5ad` files, its recorded counts and cell-type keys are cross-checked as well.
|
|
126
126
|
|
|
127
|
-
### Run via GUI (`
|
|
127
|
+
### Run via GUI (`spatialaim gui`)
|
|
128
128
|
|
|
129
|
-
Interactive [Streamlit](https://streamlit.io) app to run
|
|
129
|
+
Interactive [Streamlit](https://streamlit.io) app to run SpatialAIM from the browser and interactively browse the results for one scRNA/ST pair without any .
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
|
|
132
|
+
spatialaim gui [--server_port 8501]
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
Open the printed URL (default http://localhost:8501), set the inputs, pick one or multiple mapper(s), and click **Run**.
|
|
136
|
-
As soon as both `.h5ad` paths are set, the GUI runs the same checks as [`
|
|
136
|
+
As soon as both `.h5ad` paths are set, the GUI runs the same checks as [`spatialaim validate`](#validate-a-dataset-pair-spatialaim-validate) on that pair: a clean pair is confirmed with a tick in the sidebar, any error or warning is shown in a dialog you can close to continue anyway.
|
|
137
137
|
The GUI writes each mapper's sweep to `<output_dir>/<mapper>/`. The results using each mapper are visualized in different tabs. When having run multiple mappers, also a "Compare" tab appears.
|
|
138
138
|
|
|
139
|
-
### Run via CLI (`
|
|
139
|
+
### Run via CLI (`spatialaim run`)
|
|
140
140
|
|
|
141
|
-
Run
|
|
141
|
+
Run SpatialAIM via CLI on a single pair or in batch mode.
|
|
142
142
|
The spot→state mapper is chosen with argument `--mapping`:
|
|
143
143
|
|
|
144
144
|
- **`nearest_centroid`** (default): Per spot, select the cell state by highest cosine similarity between the state's centroid and the spot's expression. One-hot assignment by default.
|
|
@@ -158,7 +158,7 @@ Give such runs their own `--output_dir`: a run root is named after the mapper al
|
|
|
158
158
|
**Single pair**
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
|
|
161
|
+
spatialaim run --scdata path/to/sc.h5ad \
|
|
162
162
|
--stdata path/to/st.h5ad \
|
|
163
163
|
--output_dir path/to/out_dir \
|
|
164
164
|
[--mapping nearest_centroid|wann|tangram|tacco|dot] \
|
|
@@ -172,7 +172,7 @@ aim run --scdata path/to/sc.h5ad \
|
|
|
172
172
|
**Batch mode (all pairs in `pairs.csv`):**
|
|
173
173
|
|
|
174
174
|
```bash
|
|
175
|
-
|
|
175
|
+
spatialaim run --pairs_csv path/to/pairs.csv \
|
|
176
176
|
--sc_dir path/to/scRNA \
|
|
177
177
|
--st_dir path/to/ST \
|
|
178
178
|
--output_dir path/to/out_dir \
|
|
@@ -205,7 +205,7 @@ Each pair is written to `<out_dir>/<PairID>_<scName>__<stName>/`.
|
|
|
205
205
|
**Sample-dataset example:**
|
|
206
206
|
|
|
207
207
|
```bash
|
|
208
|
-
|
|
208
|
+
spatialaim run \
|
|
209
209
|
--scdata sample_dataset/scRNA/sample_sc.h5ad \
|
|
210
210
|
--stdata sample_dataset/ST/sample_st.h5ad \
|
|
211
211
|
--output_dir sample_output/sample
|
|
@@ -215,7 +215,7 @@ aim run \
|
|
|
215
215
|
|
|
216
216
|
### Annotation-based baseline
|
|
217
217
|
|
|
218
|
-
There is no separate command for it: `
|
|
218
|
+
There is no separate command for it: `spatialaim run --start_from_annotation <obs_column>` covers it.
|
|
219
219
|
The annotated types become the start clusters, and the sweep's **`K` = number-of-types** level is the baseline.
|
|
220
220
|
|
|
221
221
|
## For developers
|
|
@@ -227,36 +227,36 @@ This will include everything apart from the reference aligner methods.
|
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
229
|
conda env create -f environment.yml
|
|
230
|
-
conda activate
|
|
230
|
+
conda activate spatialaim_env
|
|
231
231
|
|
|
232
|
-
# Optional: Install the
|
|
232
|
+
# Optional: Install the SpatialAIM-CLI from local
|
|
233
233
|
pip install -e . --no-deps
|
|
234
234
|
```
|
|
235
235
|
|
|
236
236
|
#### Environments of reference aligners
|
|
237
237
|
|
|
238
|
-
If you want to use one of the reference aligners within
|
|
238
|
+
If you want to use one of the reference aligners within SpatialAIM or standalone, you have to additionally create the following environments. Each reference aligner runs in its own conda environment.
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
SpatialAIM orchestrates them out-of-process via `conda run`, so you need `conda` on `PATH`. The env `.yml` files live in the repo under [`src/spatialaim/reference_aligners/`](https://github.com/domipysch/SpatialAIM-Repository/tree/main/src/spatialaim/reference_aligners).
|
|
241
241
|
|
|
242
242
|
| Method | Environment | Create |
|
|
243
243
|
| ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
244
|
-
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
245
|
-
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
246
|
-
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/
|
|
244
|
+
| Tangram | `tangram_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tangram.yml` |
|
|
245
|
+
| TACCO | `tacco_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_tacco.yml` |
|
|
246
|
+
| DOT | `dot_env` | `conda env create -f https://raw.githubusercontent.com/domipysch/SpatialAIM-Repository/main/src/spatialaim/reference_aligners/environment_dot.yml` then `Rscript -e "remotes::install_github('saezlab/DOT')"` |
|
|
247
247
|
|
|
248
248
|
|
|
249
249
|
### Adding another reference aligner
|
|
250
250
|
|
|
251
251
|
Reference aligners are pluggable.
|
|
252
252
|
Each runs the same way: a wrapper launched out-of-process in its own conda env.
|
|
253
|
-
The framework learns about it from a **single registry**,[`src/
|
|
253
|
+
The framework learns about it from a **single registry**,[`src/spatialaim/reference_aligners/registry.py`](src/spatialaim/reference_aligners/registry.py).
|
|
254
254
|
|
|
255
255
|
Adding a reference aligner is three steps:
|
|
256
256
|
|
|
257
|
-
**1. Add the conda environment file and create it**, e.g. `conda env create -f src/
|
|
257
|
+
**1. Add the conda environment file and create it**, e.g. `conda env create -f src/spatialaim/reference_aligners/environment_<name>.yml`.
|
|
258
258
|
|
|
259
|
-
**2. Write `src/
|
|
259
|
+
**2. Write `src/spatialaim/reference_aligners/run_<name>.py`** satisfying the CLI API:
|
|
260
260
|
|
|
261
261
|
| | Contract |
|
|
262
262
|
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -268,16 +268,16 @@ Invoked with only those four args, the wrapper must reproduce its canonical mapp
|
|
|
268
268
|
|
|
269
269
|
**3. Register it**
|
|
270
270
|
|
|
271
|
-
Add one line to `REFERENCE_ALIGNERS` ([`src/
|
|
271
|
+
Add one line to `REFERENCE_ALIGNERS` ([`src/spatialaim/reference_aligners/registry.py`](src/spatialaim/reference_aligners/registry.py)).
|
|
272
272
|
|
|
273
273
|
```python
|
|
274
|
-
ReferenceAligner("<name>", "<name>_env", "
|
|
274
|
+
ReferenceAligner("<name>", "<name>_env", "spatialaim.reference_aligners.run_<name>"),
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
It is then selectable everywhere automatically:
|
|
278
278
|
|
|
279
|
-
- `
|
|
280
|
-
- `
|
|
279
|
+
- `spatialaim gui` (it will be selectable in the sidebar)
|
|
280
|
+
- `spatialaim run --mapping <name>` (as an SpatialAIM reference mapper, one alignment per `K`) — including `--start_from_annotation`, where it maps onto a pre-existing annotation
|
|
281
281
|
|
|
282
282
|
**4. Create PR**
|
|
283
283
|
|