spaflow 0.1.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.
- spaflow-0.1.0/LICENSE +21 -0
- spaflow-0.1.0/PKG-INFO +124 -0
- spaflow-0.1.0/README.md +99 -0
- spaflow-0.1.0/pyproject.toml +47 -0
- spaflow-0.1.0/src/spaflow/LRdatabase/CellChat/CellChatDB.ligrec.human.csv +1940 -0
- spaflow-0.1.0/src/spaflow/LRdatabase/CellChat/CellChatDB.ligrec.mouse.csv +2020 -0
- spaflow-0.1.0/src/spaflow/LRdatabase/CellChat/CellChatDB.ligrec.zebrafish.csv +2775 -0
- spaflow-0.1.0/src/spaflow/LRdatabase/CellPhoneDB_v4.0/CellPhoneDBv4.0.human.csv +1681 -0
- spaflow-0.1.0/src/spaflow/LRdatabase/CellPhoneDB_v4.0/CellPhoneDBv4.0.mouse.csv +1411 -0
- spaflow-0.1.0/src/spaflow/__init__.py +2 -0
- spaflow-0.1.0/src/spaflow/lr.py +152 -0
- spaflow-0.1.0/src/spaflow/model.py +414 -0
- spaflow-0.1.0/src/spaflow/py.typed +0 -0
- spaflow-0.1.0/src/spaflow/run.py +385 -0
- spaflow-0.1.0/src/spaflow/utils.py +196 -0
spaflow-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 huchen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
spaflow-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spaflow
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A spatial CCC tool to infer ligand-receptor interaction
|
|
5
|
+
Keywords: anndata,bioinformatics,ligand-receptor,scanpy,spatial-transcriptomics,squidpy
|
|
6
|
+
Author: huchen
|
|
7
|
+
Author-email: huchen <chen.13589@osu.edu>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
18
|
+
Requires-Dist: scanpy[leiden]>=1.10.3
|
|
19
|
+
Requires-Dist: squidpy>=1.6.1
|
|
20
|
+
Requires-Dist: setuptools<82
|
|
21
|
+
Requires-Dist: upsetplot==0.9.0
|
|
22
|
+
Requires-Dist: adjusttext==1.3.0
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# spaflow
|
|
27
|
+
|
|
28
|
+
`spaflow` is a spatial cell-cell communication tool for ligand-receptor interaction analysis in spatial transcriptomics data.
|
|
29
|
+
|
|
30
|
+
It is designed to answer a practical question:
|
|
31
|
+
|
|
32
|
+
"Where are ligand-receptor signals active in tissue, and which locations show stronger-than-expected spatial communication?"
|
|
33
|
+
|
|
34
|
+
The package is built around `Scanpy` and `Squidpy` and uses spatial permutation testing to identify ligand-receptor hotspots.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Create the envionment and install from PyPI:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
conda create -n spaflow python=3.10 -y
|
|
42
|
+
pip install spaflow
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If you are working from the repository:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv sync
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Tutorial
|
|
52
|
+
|
|
53
|
+
The main tutorial lives in [tutorial.ipynb](tutorial.ipynb). The workflow is:
|
|
54
|
+
|
|
55
|
+
1. Load a spatial `AnnData` object.
|
|
56
|
+
2. Filter the ligand-receptor database to pairs supported by the dataset.
|
|
57
|
+
3. Run `spaflow`.
|
|
58
|
+
4. Visualize ligand-receptor activity and hotspot calls.
|
|
59
|
+
|
|
60
|
+
### 1. Load data
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import warnings
|
|
64
|
+
|
|
65
|
+
warnings.filterwarnings("ignore")
|
|
66
|
+
|
|
67
|
+
import scanpy as sc
|
|
68
|
+
from spaflow import filter_lr_database, run_spaflow
|
|
69
|
+
|
|
70
|
+
adata = sc.read("your_data.h5ad")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Filter the ligand-receptor database
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
df_ligrec = filter_lr_database(adata)
|
|
77
|
+
df_ligrec.head()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
By default, this keeps supported ligand-receptor pairs for secreted signaling.
|
|
81
|
+
|
|
82
|
+
### 3. Run SpaFlow
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
spaflow_adata = run_spaflow(adata, df_ligrec)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 4. Visualize results
|
|
89
|
+
|
|
90
|
+
The tutorial notebook shows a spatial plot for `TNFSF14-LTBR`:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
lr = "TNFSF14-LTBR"
|
|
94
|
+
|
|
95
|
+
spaflow_adata.uns[f"{lr}_sig_colors"] = ["#DDDDDD", "#EE6677"]
|
|
96
|
+
|
|
97
|
+
sc.pl.spatial(
|
|
98
|
+
spaflow_adata,
|
|
99
|
+
color=[lr, f"{lr}_sig", "Classes"],
|
|
100
|
+
img_key=None,
|
|
101
|
+
size=1.5,
|
|
102
|
+
frameon=False,
|
|
103
|
+
cmap="Spectral_r",
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In this example, `"Classes"` is an annotation column already present in the tutorial dataset. Replace it with a column from your own `adata.obs` if needed.
|
|
108
|
+
|
|
109
|
+
## Output
|
|
110
|
+
|
|
111
|
+
`run_spaflow` returns a copy of the input `AnnData` with additional columns in `adata.obs`.
|
|
112
|
+
|
|
113
|
+
For each ligand-receptor complex, the output typically includes:
|
|
114
|
+
|
|
115
|
+
- `<complex>`: ligand-receptor interaction activity
|
|
116
|
+
- `<complex>_sig`: ligand-receptor interaction hotspots
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
These outputs can be used directly in `scanpy.pl.spatial` or downstream statistical summaries.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## Notes
|
|
124
|
+
- The notebooks under `figures/` are manuscript-oriented analysis notebooks rather than package onboarding material.
|
spaflow-0.1.0/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# spaflow
|
|
2
|
+
|
|
3
|
+
`spaflow` is a spatial cell-cell communication tool for ligand-receptor interaction analysis in spatial transcriptomics data.
|
|
4
|
+
|
|
5
|
+
It is designed to answer a practical question:
|
|
6
|
+
|
|
7
|
+
"Where are ligand-receptor signals active in tissue, and which locations show stronger-than-expected spatial communication?"
|
|
8
|
+
|
|
9
|
+
The package is built around `Scanpy` and `Squidpy` and uses spatial permutation testing to identify ligand-receptor hotspots.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Create the envionment and install from PyPI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
conda create -n spaflow python=3.10 -y
|
|
17
|
+
pip install spaflow
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you are working from the repository:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv sync
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tutorial
|
|
27
|
+
|
|
28
|
+
The main tutorial lives in [tutorial.ipynb](tutorial.ipynb). The workflow is:
|
|
29
|
+
|
|
30
|
+
1. Load a spatial `AnnData` object.
|
|
31
|
+
2. Filter the ligand-receptor database to pairs supported by the dataset.
|
|
32
|
+
3. Run `spaflow`.
|
|
33
|
+
4. Visualize ligand-receptor activity and hotspot calls.
|
|
34
|
+
|
|
35
|
+
### 1. Load data
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import warnings
|
|
39
|
+
|
|
40
|
+
warnings.filterwarnings("ignore")
|
|
41
|
+
|
|
42
|
+
import scanpy as sc
|
|
43
|
+
from spaflow import filter_lr_database, run_spaflow
|
|
44
|
+
|
|
45
|
+
adata = sc.read("your_data.h5ad")
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. Filter the ligand-receptor database
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
df_ligrec = filter_lr_database(adata)
|
|
52
|
+
df_ligrec.head()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
By default, this keeps supported ligand-receptor pairs for secreted signaling.
|
|
56
|
+
|
|
57
|
+
### 3. Run SpaFlow
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
spaflow_adata = run_spaflow(adata, df_ligrec)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 4. Visualize results
|
|
64
|
+
|
|
65
|
+
The tutorial notebook shows a spatial plot for `TNFSF14-LTBR`:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
lr = "TNFSF14-LTBR"
|
|
69
|
+
|
|
70
|
+
spaflow_adata.uns[f"{lr}_sig_colors"] = ["#DDDDDD", "#EE6677"]
|
|
71
|
+
|
|
72
|
+
sc.pl.spatial(
|
|
73
|
+
spaflow_adata,
|
|
74
|
+
color=[lr, f"{lr}_sig", "Classes"],
|
|
75
|
+
img_key=None,
|
|
76
|
+
size=1.5,
|
|
77
|
+
frameon=False,
|
|
78
|
+
cmap="Spectral_r",
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
In this example, `"Classes"` is an annotation column already present in the tutorial dataset. Replace it with a column from your own `adata.obs` if needed.
|
|
83
|
+
|
|
84
|
+
## Output
|
|
85
|
+
|
|
86
|
+
`run_spaflow` returns a copy of the input `AnnData` with additional columns in `adata.obs`.
|
|
87
|
+
|
|
88
|
+
For each ligand-receptor complex, the output typically includes:
|
|
89
|
+
|
|
90
|
+
- `<complex>`: ligand-receptor interaction activity
|
|
91
|
+
- `<complex>_sig`: ligand-receptor interaction hotspots
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
These outputs can be used directly in `scanpy.pl.spatial` or downstream statistical summaries.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Notes
|
|
99
|
+
- The notebooks under `figures/` are manuscript-oriented analysis notebooks rather than package onboarding material.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "spaflow"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A spatial CCC tool to infer ligand-receptor interaction"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "huchen", email = "chen.13589@osu.edu" }
|
|
11
|
+
]
|
|
12
|
+
keywords = [
|
|
13
|
+
"anndata",
|
|
14
|
+
"bioinformatics",
|
|
15
|
+
"ligand-receptor",
|
|
16
|
+
"scanpy",
|
|
17
|
+
"spatial-transcriptomics",
|
|
18
|
+
"squidpy",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"scanpy[leiden]>=1.10.3",
|
|
32
|
+
"squidpy>=1.6.1",
|
|
33
|
+
"setuptools<82",
|
|
34
|
+
"upsetplot==0.9.0",
|
|
35
|
+
"adjustText==1.3.0"
|
|
36
|
+
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"ipykernel",
|
|
42
|
+
"ipywidgets",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["uv_build>=0.11.3,<0.12.0"]
|
|
47
|
+
build-backend = "uv_build"
|