comflow 0.0.3__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.
- comflow/__init__.py +10 -0
- comflow/_optimal_transport/__init__.py +13 -0
- comflow/_optimal_transport/_cot.py +850 -0
- comflow/_optimal_transport/_cot_preRevise.py +850 -0
- comflow/_optimal_transport/_unot.py +485 -0
- comflow/_optimal_transport/_usot.py +117 -0
- comflow/_utils/__init__.py +20 -0
- comflow/_utils/_binarization.py +43 -0
- comflow/_utils/_clustering.py +57 -0
- comflow/_utils/_plotting.py +398 -0
- comflow/_utils/_similarity.py +479 -0
- comflow/plotting/__init__.py +5 -0
- comflow/plotting/_plotting.py +794 -0
- comflow/preprocessing/__init__.py +3 -0
- comflow/preprocessing/_infer_spatial.py +161 -0
- comflow/preprocessing/_ligand_receptor_database.py +153 -0
- comflow/tools/__init__.py +12 -0
- comflow/tools/_downstream_analysis.py +870 -0
- comflow/tools/_spatial_communication.py +1250 -0
- comflow-0.0.3.dist-info/LICENSE.md +21 -0
- comflow-0.0.3.dist-info/METADATA +113 -0
- comflow-0.0.3.dist-info/RECORD +24 -0
- comflow-0.0.3.dist-info/WHEEL +5 -0
- comflow-0.0.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Zixuan Cang
|
|
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.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: comflow
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: ComFlow: an optimal transport framework for deciphering intra- and intercellular signaling landscapes in 2D and 3D tissue systems.
|
|
5
|
+
Home-page: UNKNOWN
|
|
6
|
+
License: MIT License
|
|
7
|
+
Keywords: cell-cell communicaiton,spatial transcriptomics,optimal transport,intracellular signaling,intercellular signaling
|
|
8
|
+
Platform: UNKNOWN
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE.md
|
|
20
|
+
Requires-Dist: anndata>=0.7.6
|
|
21
|
+
Requires-Dist: igraph
|
|
22
|
+
Requires-Dist: karateclub>=1.2.2
|
|
23
|
+
Requires-Dist: leidenalg>=0.9.0
|
|
24
|
+
Requires-Dist: libpysal
|
|
25
|
+
Requires-Dist: matplotlib
|
|
26
|
+
Requires-Dist: networkx>=2.5.1
|
|
27
|
+
Requires-Dist: numpy>=1.19.5
|
|
28
|
+
Requires-Dist: pandas>=1.3.5
|
|
29
|
+
Requires-Dist: plotly>=5.3.1
|
|
30
|
+
Requires-Dist: pot>=0.8.0
|
|
31
|
+
Requires-Dist: scanpy>=1.8.2
|
|
32
|
+
Requires-Dist: scikit-learn>=1.0.2
|
|
33
|
+
Requires-Dist: scipy
|
|
34
|
+
Requires-Dist: seaborn
|
|
35
|
+
Provides-Extra: docs
|
|
36
|
+
Requires-Dist: sphinx==5.3.0; extra == "docs"
|
|
37
|
+
Requires-Dist: sphinx-autodoc-typehints==1.18.1; extra == "docs"
|
|
38
|
+
Requires-Dist: sphinx-rtd-theme==1.0.0; extra == "docs"
|
|
39
|
+
Requires-Dist: sphinx-rtd-size==0.2.0; extra == "docs"
|
|
40
|
+
Requires-Dist: sphinxcontrib-applehelp==1.0.2; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinxcontrib-devhelp==1.0.2; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinxcontrib-htmlhelp==2.0.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinxcontrib-jsmath==1.0.1; extra == "docs"
|
|
44
|
+
Requires-Dist: sphinxcontrib-qthelp==1.0.3; extra == "docs"
|
|
45
|
+
Requires-Dist: sphinxcontrib-serializinghtml==1.1.5; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx-mdinclude==0.5.3; extra == "docs"
|
|
47
|
+
Requires-Dist: nbsphinx==0.8.9; extra == "docs"
|
|
48
|
+
Requires-Dist: ipykernel==6.16.0; extra == "docs"
|
|
49
|
+
Requires-Dist: sphinx-gallery==0.11.1; extra == "docs"
|
|
50
|
+
Provides-Extra: tradeseq
|
|
51
|
+
Requires-Dist: anndata2ri==1.0.6; extra == "tradeseq"
|
|
52
|
+
Requires-Dist: rpy2==3.4.2; extra == "tradeseq"
|
|
53
|
+
|
|
54
|
+
# ComFlow
|
|
55
|
+
ComFlow: an optimal transport framework for deciphering intra-
|
|
56
|
+
and intercellular signaling landscapes in 2D and 3D tissue systems
|
|
57
|
+
|
|
58
|
+
[](https://pypi.org/project/comflow)
|
|
59
|
+

|
|
60
|
+
[](https://comflow.readthedocs.io/en/latest/)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
Install from PyPI by `pip install comflow` or install from source by cd to this directory and `pip install .`
|
|
65
|
+
|
|
66
|
+
[Optional] Install [tradeSeq](https://github.com/statOmics/tradeSeq) in R to analyze the CCC differentially expressed genes. \
|
|
67
|
+
Currently, tradeSeq version 1.0.1 with R version 3.6.3 has been tested to work. \
|
|
68
|
+
In order for the R-python interface to work properly, rpy2==3.4.2 and anndata2ri==1.0.6 should be installed.
|
|
69
|
+
To use this feature, install from PyPI by `pip install comflow[tradeSeq]` or from source by `pip install .[tradeSeq]`.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
**Basic usage**
|
|
73
|
+
|
|
74
|
+
_Import packages_
|
|
75
|
+
```
|
|
76
|
+
import comflow as ct
|
|
77
|
+
import scanpy as sc
|
|
78
|
+
import pandas as pd
|
|
79
|
+
import numpy as np
|
|
80
|
+
```
|
|
81
|
+
_Load a spatial dataset_ \
|
|
82
|
+
(e.g., a Visium dataset)
|
|
83
|
+
```
|
|
84
|
+
adata = sc.datasets.visium_sge(sample_id='V1_Mouse_Brain_Sagittal_Posterior')
|
|
85
|
+
adata.var_names_make_unique()
|
|
86
|
+
```
|
|
87
|
+
_Basic processing_
|
|
88
|
+
```
|
|
89
|
+
sc.pp.normalize_total(adata, inplace=True)
|
|
90
|
+
sc.pp.log1p(adata)
|
|
91
|
+
```
|
|
92
|
+
_Specify ligand-receptor pairs_
|
|
93
|
+
```
|
|
94
|
+
LR=np.array([['Tgfb1', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway'],['Tgfb2', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway'],['Tgfb3', 'Tgfbr1_Tgfbr2', 'Tgfb_pathway']],dtype=str)
|
|
95
|
+
df_ligrec = pd.DataFrame(data=LR)
|
|
96
|
+
```
|
|
97
|
+
(or use pairs from a ligand-receptor database `df_ligrec=ct.pp.ligand_receptor_database(database='CellChat', species='mouse')`.)
|
|
98
|
+
|
|
99
|
+
_Construct CCC networks_ \
|
|
100
|
+
Use collective optimal transport to construct CCC networks for the ligand-receptor pairs with a spatial distance constraint of 200 (coupling between cells with distance greater than 200 is prohibited). For example, the spot-by-spot matrix for the pair Tgfb1 (ligand) and Tgfbr1_Tgfbr2 (receptor)is stored in `adata.obsp['comflow-user_database-Tgfb1-Tgfbr1_Tgfbr2']`. The total sent or received signal for each pair is stored in `adata.obsm['comflow-user_database-sum-sender']` and `adata.obsm['comflow-user_database-sum-receiver']`.
|
|
101
|
+
```
|
|
102
|
+
ct.tl.spatial_communication(adata,
|
|
103
|
+
database_name='user_database', df_ligrec=df_ligrec, dis_thr=200, heteromeric=True)
|
|
104
|
+
```
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
See detailed documentation and examples at [https://comflow.readthedocs.io/en/latest/index.html](https://comflow.readthedocs.io/en/latest/index.html).
|
|
108
|
+
|
|
109
|
+
## References
|
|
110
|
+
|
|
111
|
+
Xie, M. B., Zhu, Y., Hu, Y., Kim, M., Liu, Y. H., Huang, J., Li, B., Rafat, M., Meltzer,S., Hwang, T. H., Cang, Z., Zhao, Y., Zhou, X. M.. ComFlow: an optimal transport framework for deciphering intra- and intercellular signaling landscapes in 2D and 3D tissue systems.
|
|
112
|
+
|
|
113
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
comflow/__init__.py,sha256=ZnPuUmmvVJKs6oCGgNeB5tDVU9jACr-BEWxAJg7JwgU,247
|
|
2
|
+
comflow/_optimal_transport/__init__.py,sha256=o_OajN843LP6gnABQe9XB9Z1oT4fCfdZZFN5R2SXLpY,470
|
|
3
|
+
comflow/_optimal_transport/_cot.py,sha256=Jwl5yG7Xa2DUgXMn-JZrhAXKAv5PPSinGDVgP-QVcig,34046
|
|
4
|
+
comflow/_optimal_transport/_cot_preRevise.py,sha256=2csEbdUeEXvejFEbjByGyulr-4y3rBASDARKMbw2NyE,33160
|
|
5
|
+
comflow/_optimal_transport/_unot.py,sha256=IgcorOMOKMqtbgE3s6llYsp-dayTwxAw-C-s190paQY,19364
|
|
6
|
+
comflow/_optimal_transport/_usot.py,sha256=RSYp7NPxaH46-ExGE4hL_ciyRrS63hdxo6YYKhTPCt4,4084
|
|
7
|
+
comflow/_utils/__init__.py,sha256=MWakUVdFtbP5HyxXPCJeJzFunm-J0pvF0nWp0uZIE-0,911
|
|
8
|
+
comflow/_utils/_binarization.py,sha256=Lq4J0Oxi-o9QQJMNmutNFpusUalO5PF_tNJTfmnPWq0,1411
|
|
9
|
+
comflow/_utils/_clustering.py,sha256=uyDXE39UpZc0CoUAgY19x7Kw-P2JH1C_eoegZLHUidw,1586
|
|
10
|
+
comflow/_utils/_plotting.py,sha256=STNc9jefb4l37193_br2eI36jxUjSitlfC3W1kCQ9Os,16331
|
|
11
|
+
comflow/_utils/_similarity.py,sha256=5m8kXk1r8_2dJ4x6MaJirD5gXHB5QCfXro0IjEtJNUE,14327
|
|
12
|
+
comflow/plotting/__init__.py,sha256=gEo86KAgMQ0diYqdH-c1DczVxz101yZz5pzsuWXN_pk,269
|
|
13
|
+
comflow/plotting/_plotting.py,sha256=mG6vseMhkQ1HBE-K60i2Ks7X0FxN6mwQr9tnvs3vj-8,31049
|
|
14
|
+
comflow/preprocessing/__init__.py,sha256=9rRWYsdi70SUYk1hSZLDtXBR5NYn-qmOL7IDOWFJmEo,175
|
|
15
|
+
comflow/preprocessing/_infer_spatial.py,sha256=Znq4cmlEcVX1CmwTKEufRWwg-3OW9IPGNRYWN31Lx5o,6953
|
|
16
|
+
comflow/preprocessing/_ligand_receptor_database.py,sha256=GghtdVdvp8wSu9N8ZHE3x1QhbAvQ8FB5pk2PqxlyXWs,6737
|
|
17
|
+
comflow/tools/__init__.py,sha256=kWscnwaUOZNzVxzxFnL9NCrpgcGIJ1Wz2nIRIKIz37w,743
|
|
18
|
+
comflow/tools/_downstream_analysis.py,sha256=UsYQ_v4JD4Nz9UAV6i07q5RvzuUR-AbOyal65J8T0Dk,38249
|
|
19
|
+
comflow/tools/_spatial_communication.py,sha256=FkYgWU_N3NWXKhqCFgwDFvw2tscRCDmVGbRANtfdXcw,56858
|
|
20
|
+
comflow-0.0.3.dist-info/LICENSE.md,sha256=3kvcd4lSa0Knpwb7PskYFdrCJpu_aCRvxmUWnhM9x5Q,1068
|
|
21
|
+
comflow-0.0.3.dist-info/METADATA,sha256=dw8zoONnnxXE6a_GOQtaU8SZBxlc0KamcQKAm3xrUik,5142
|
|
22
|
+
comflow-0.0.3.dist-info/WHEEL,sha256=EWGgdj_eH-g9dwsWZOTG0kmGucEuKPxGzOKD-jAVUHs,92
|
|
23
|
+
comflow-0.0.3.dist-info/top_level.txt,sha256=8kC3s0kOJ84TBQFYwbHuWjlegXMhcO1T2PW9fp2nJGc,8
|
|
24
|
+
comflow-0.0.3.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
comflow
|