scTenifoldXct 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.
- sctenifoldxct-0.1.0/.dockerignore +26 -0
- sctenifoldxct-0.1.0/.github/workflows/testing.yml +39 -0
- sctenifoldxct-0.1.0/.gitignore +150 -0
- sctenifoldxct-0.1.0/Dockerfile +22 -0
- sctenifoldxct-0.1.0/LICENSE +21 -0
- sctenifoldxct-0.1.0/LS_git.jpeg +0 -0
- sctenifoldxct-0.1.0/MANIFEST.in +3 -0
- sctenifoldxct-0.1.0/PKG-INFO +137 -0
- sctenifoldxct-0.1.0/README.md +96 -0
- sctenifoldxct-0.1.0/data/README.md +3 -0
- sctenifoldxct-0.1.0/data/adata_merge_example.h5ad +0 -0
- sctenifoldxct-0.1.0/data/adata_short_example.h5ad +0 -0
- sctenifoldxct-0.1.0/environment.yml +60 -0
- sctenifoldxct-0.1.0/requirements.txt +11 -0
- sctenifoldxct-0.1.0/scTenifoldXct/__init__.py +4 -0
- sctenifoldxct-0.1.0/scTenifoldXct/cko.py +15 -0
- sctenifoldxct-0.1.0/scTenifoldXct/core.py +546 -0
- sctenifoldxct-0.1.0/scTenifoldXct/dataLoader.py +133 -0
- sctenifoldxct-0.1.0/scTenifoldXct/database/LR.csv +8050 -0
- sctenifoldxct-0.1.0/scTenifoldXct/database/TF.csv +1565 -0
- sctenifoldxct-0.1.0/scTenifoldXct/merge.py +249 -0
- sctenifoldxct-0.1.0/scTenifoldXct/nn.py +214 -0
- sctenifoldxct-0.1.0/scTenifoldXct/pcNet.py +122 -0
- sctenifoldxct-0.1.0/scTenifoldXct/stat.py +142 -0
- sctenifoldxct-0.1.0/scTenifoldXct/stiefel.py +29 -0
- sctenifoldxct-0.1.0/scTenifoldXct/version.py +1 -0
- sctenifoldxct-0.1.0/scTenifoldXct/visualization.py +178 -0
- sctenifoldxct-0.1.0/scTenifoldXct.egg-info/PKG-INFO +137 -0
- sctenifoldxct-0.1.0/scTenifoldXct.egg-info/SOURCES.txt +41 -0
- sctenifoldxct-0.1.0/scTenifoldXct.egg-info/dependency_links.txt +1 -0
- sctenifoldxct-0.1.0/scTenifoldXct.egg-info/requires.txt +11 -0
- sctenifoldxct-0.1.0/scTenifoldXct.egg-info/top_level.txt +1 -0
- sctenifoldxct-0.1.0/setup.cfg +4 -0
- sctenifoldxct-0.1.0/setup.py +59 -0
- sctenifoldxct-0.1.0/tests/__init__.py +0 -0
- sctenifoldxct-0.1.0/tests/conftest.py +40 -0
- sctenifoldxct-0.1.0/tests/test_core.py +8 -0
- sctenifoldxct-0.1.0/tests/test_nn.py +7 -0
- sctenifoldxct-0.1.0/tests/test_stat.py +41 -0
- sctenifoldxct-0.1.0/tests/test_visualization.py +0 -0
- sctenifoldxct-0.1.0/tutorials/tutorial-load_data_from_SCRATCH.ipynb +177 -0
- sctenifoldxct-0.1.0/tutorials/tutorial-merge_short_example.ipynb +450 -0
- sctenifoldxct-0.1.0/tutorials/tutorial-short_example.ipynb +1115 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
**/__pycache__
|
|
2
|
+
**/.venv
|
|
3
|
+
**/.classpath
|
|
4
|
+
**/.dockerignore
|
|
5
|
+
**/.env
|
|
6
|
+
**/.git
|
|
7
|
+
**/.gitignore
|
|
8
|
+
**/.project
|
|
9
|
+
**/.settings
|
|
10
|
+
**/.toolstarget
|
|
11
|
+
**/.vs
|
|
12
|
+
**/.vscode
|
|
13
|
+
**/*.*proj.user
|
|
14
|
+
**/*.dbmdl
|
|
15
|
+
**/*.jfm
|
|
16
|
+
**/bin
|
|
17
|
+
**/charts
|
|
18
|
+
**/docker-compose*
|
|
19
|
+
**/compose*
|
|
20
|
+
**/Dockerfile*
|
|
21
|
+
**/node_modules
|
|
22
|
+
**/npm-debug.log
|
|
23
|
+
**/obj
|
|
24
|
+
**/secrets.dev.yaml
|
|
25
|
+
**/values.dev.yaml
|
|
26
|
+
README.md
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Python package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- dev
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v3
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v3
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install flake8 pytest
|
|
29
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
30
|
+
- name: Lint with flake8
|
|
31
|
+
run: |
|
|
32
|
+
# stop the build if there are Python syntax errors or undefined names
|
|
33
|
+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
34
|
+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
35
|
+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
36
|
+
- name: Test with pytest
|
|
37
|
+
run: |
|
|
38
|
+
pytest
|
|
39
|
+
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
105
|
+
__pypackages__/
|
|
106
|
+
|
|
107
|
+
# Celery stuff
|
|
108
|
+
celerybeat-schedule
|
|
109
|
+
celerybeat.pid
|
|
110
|
+
|
|
111
|
+
# SageMath parsed files
|
|
112
|
+
*.sage.py
|
|
113
|
+
|
|
114
|
+
# Environments
|
|
115
|
+
.env
|
|
116
|
+
.venv
|
|
117
|
+
env/
|
|
118
|
+
venv/
|
|
119
|
+
ENV/
|
|
120
|
+
env.bak/
|
|
121
|
+
venv.bak/
|
|
122
|
+
|
|
123
|
+
# Spyder project settings
|
|
124
|
+
.spyderproject
|
|
125
|
+
.spyproject
|
|
126
|
+
|
|
127
|
+
# Rope project settings
|
|
128
|
+
.ropeproject
|
|
129
|
+
|
|
130
|
+
# mkdocs documentation
|
|
131
|
+
/site
|
|
132
|
+
|
|
133
|
+
# mypy
|
|
134
|
+
.mypy_cache/
|
|
135
|
+
.dmypy.json
|
|
136
|
+
dmypy.json
|
|
137
|
+
|
|
138
|
+
# Pyre type checker
|
|
139
|
+
.pyre/
|
|
140
|
+
|
|
141
|
+
# pytype static type analyzer
|
|
142
|
+
.pytype/
|
|
143
|
+
|
|
144
|
+
# Cython debug symbols
|
|
145
|
+
cython_debug/
|
|
146
|
+
|
|
147
|
+
# scTenifoldXct
|
|
148
|
+
scTenifoldXct/*.pyc
|
|
149
|
+
tutorials/*
|
|
150
|
+
!tutorials/*.ipynb
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
FROM python:3.8-slim
|
|
2
|
+
|
|
3
|
+
# Keeps Python from generating .pyc files in the container
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
|
|
6
|
+
# Turns off buffering for easier container logging
|
|
7
|
+
ENV PYTHONUNBUFFERED=1
|
|
8
|
+
|
|
9
|
+
# Install pip requirements
|
|
10
|
+
COPY requirements.txt .
|
|
11
|
+
RUN python -m pip install --no-cache-dir -r requirements.txt
|
|
12
|
+
|
|
13
|
+
WORKDIR /app
|
|
14
|
+
COPY ./scTenifoldXct /app/scTenifoldXct
|
|
15
|
+
COPY ./tutorials /app/tutorials
|
|
16
|
+
|
|
17
|
+
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
|
|
18
|
+
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
|
19
|
+
USER appuser
|
|
20
|
+
|
|
21
|
+
# During debugging, this entry point will be overridden.
|
|
22
|
+
CMD ["sh"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Yongjian Yang
|
|
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.
|
|
Binary file
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scTenifoldXct
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: scTenifoldXct
|
|
5
|
+
Home-page: https://github.com/cailab-tamu/scTenifoldXct
|
|
6
|
+
Author: Yongjian Yang, TAMU
|
|
7
|
+
Author-email: yjyang027@tamu.edu
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: neural network,embedding,manifold-learning,computational-biology,single-cell,cell-cell interaction,gene regulatroy network,visualization
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: anndata
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: pandas
|
|
23
|
+
Requires-Dist: python_igraph
|
|
24
|
+
Requires-Dist: ray
|
|
25
|
+
Requires-Dist: scanpy
|
|
26
|
+
Requires-Dist: scipy
|
|
27
|
+
Requires-Dist: statsmodels
|
|
28
|
+
Requires-Dist: torch
|
|
29
|
+
Requires-Dist: tqdm
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: author-email
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: description-content-type
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# scTenifoldXct
|
|
43
|
+
a semi-supervised method for predicting cell-cell interactions and mapping cellular communication graphs via manifold learning <br>
|
|
44
|
+
<span style="color:red;">New!</span> Data has been added. Feel free to explore and use it. <br>
|
|
45
|
+
<span style="color:red;">New!</span> A standalone UI has been added. [Give it a try!](https://sctenifold.streamlit.app/)
|
|
46
|
+
[[Paper]](https://doi.org/10.1016/j.cels.2023.01.004)
|
|
47
|
+
<br/>
|
|
48
|
+
<p align="center">
|
|
49
|
+
<img src="LS_git.jpeg" alt="drawing" width="300"/>
|
|
50
|
+
</p>
|
|
51
|
+
<br/>
|
|
52
|
+
|
|
53
|
+
### Install Dependencies
|
|
54
|
+
We suggest first intall dependencies of scTenifoldXct with `conda`:
|
|
55
|
+
```shell
|
|
56
|
+
git clone https://github.com/cailab-tamu/scTenifoldXct.git
|
|
57
|
+
cd scTenifoldXct
|
|
58
|
+
conda env create -f environment.yml
|
|
59
|
+
conda activate scTenifold
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Install scTenifoldXct
|
|
63
|
+
Install scTenifoldXct with `pip`:
|
|
64
|
+
```shell
|
|
65
|
+
pip install git+https://github.com/cailab-tamu/scTenifoldXct.git
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
or install it manually from source:
|
|
69
|
+
```shell
|
|
70
|
+
pip install .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Usages
|
|
74
|
+
|
|
75
|
+
#### Quick Start
|
|
76
|
+
The following code runs scTenifoldXct on an example data set in the tutorials:
|
|
77
|
+
```python
|
|
78
|
+
import scanpy as sc
|
|
79
|
+
import scTenifoldXct as st
|
|
80
|
+
|
|
81
|
+
adata = sc.read_h5ad('data/adata_short_example.h5ad') # load data
|
|
82
|
+
xct = st.scTenifoldXct(data = adata, # an AnnData
|
|
83
|
+
source_celltype = 'Inflam. FIB', # sender cell type
|
|
84
|
+
target_celltype = 'Inflam. DC', # receiver cell type
|
|
85
|
+
obs_label = 'ident', # colname in adata.obs indicating cell types
|
|
86
|
+
rebuild_GRN = True, # whether to build GRNs
|
|
87
|
+
GRN_file_dir = 'Net_example_dev', # folder path to GRNs
|
|
88
|
+
verbose = True, # whether to verbose the processing
|
|
89
|
+
n_cpus = -1) # CPU multiprocessing, -1 to use all
|
|
90
|
+
emb = xct.get_embeds(train = True) # Manifold alignment to project data to low-dimensional embeddings
|
|
91
|
+
xct_pairs = xct.null_test() # non-parametric test to get significant interactions
|
|
92
|
+
print(xct_pairs)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Tutorial
|
|
96
|
+
We have included two tutorial notebooks on scTenifoldXct usage and results visualization.
|
|
97
|
+
|
|
98
|
+
Single-sample interaction analysis:<br> https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-short_example.ipynb <br>
|
|
99
|
+
Two-sample differential interaction analysis:<br> https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-merge_short_example.ipynb
|
|
100
|
+
<br/>
|
|
101
|
+
|
|
102
|
+
### Run scTenifoldXct from command-line by `Docker`
|
|
103
|
+
scTenifoldXct provides command-line utilities for users who are not familiar with Python.<br>
|
|
104
|
+
A Docker image of scTenifoldXct can be built from the repository. The Docker image has all required packages and databases included.
|
|
105
|
+
|
|
106
|
+
```shell
|
|
107
|
+
docker build -t sctenifold .
|
|
108
|
+
docker run -it --name xct --shm-size=8gb sctenifold
|
|
109
|
+
```
|
|
110
|
+
If successful, a Bash terminal will be present in the newly created container.<br>
|
|
111
|
+
An example for running single-sample analysis:
|
|
112
|
+
```shell
|
|
113
|
+
python -m scTenifoldXct.core tutorials/data/adata_short_example.h5ad \
|
|
114
|
+
--rebuild \
|
|
115
|
+
-s "Inflam. FIB" \
|
|
116
|
+
-r "Inflam. DC" \
|
|
117
|
+
--n_cpus 8 \
|
|
118
|
+
-v
|
|
119
|
+
```
|
|
120
|
+
For runnning two-sample analysis:
|
|
121
|
+
```shell
|
|
122
|
+
python -m scTenifoldXct.merge tutorials/data/adata_merge_example.h5ad \
|
|
123
|
+
NormalvsTumor N T \
|
|
124
|
+
--rebuild \
|
|
125
|
+
-s "B cells" \
|
|
126
|
+
-r "Fibroblasts" \
|
|
127
|
+
--n_cpus 8 \
|
|
128
|
+
-v
|
|
129
|
+
```
|
|
130
|
+
Users should copy their own data to the container for their analyses.
|
|
131
|
+
|
|
132
|
+
When analysis completes, hit Ctrl + p and Ctrl + q to detach from the container and then copy the result to the host:
|
|
133
|
+
```shell
|
|
134
|
+
docker cp xct:/app/xct_results/ .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# scTenifoldXct
|
|
2
|
+
a semi-supervised method for predicting cell-cell interactions and mapping cellular communication graphs via manifold learning <br>
|
|
3
|
+
<span style="color:red;">New!</span> Data has been added. Feel free to explore and use it. <br>
|
|
4
|
+
<span style="color:red;">New!</span> A standalone UI has been added. [Give it a try!](https://sctenifold.streamlit.app/)
|
|
5
|
+
[[Paper]](https://doi.org/10.1016/j.cels.2023.01.004)
|
|
6
|
+
<br/>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="LS_git.jpeg" alt="drawing" width="300"/>
|
|
9
|
+
</p>
|
|
10
|
+
<br/>
|
|
11
|
+
|
|
12
|
+
### Install Dependencies
|
|
13
|
+
We suggest first intall dependencies of scTenifoldXct with `conda`:
|
|
14
|
+
```shell
|
|
15
|
+
git clone https://github.com/cailab-tamu/scTenifoldXct.git
|
|
16
|
+
cd scTenifoldXct
|
|
17
|
+
conda env create -f environment.yml
|
|
18
|
+
conda activate scTenifold
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Install scTenifoldXct
|
|
22
|
+
Install scTenifoldXct with `pip`:
|
|
23
|
+
```shell
|
|
24
|
+
pip install git+https://github.com/cailab-tamu/scTenifoldXct.git
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or install it manually from source:
|
|
28
|
+
```shell
|
|
29
|
+
pip install .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Usages
|
|
33
|
+
|
|
34
|
+
#### Quick Start
|
|
35
|
+
The following code runs scTenifoldXct on an example data set in the tutorials:
|
|
36
|
+
```python
|
|
37
|
+
import scanpy as sc
|
|
38
|
+
import scTenifoldXct as st
|
|
39
|
+
|
|
40
|
+
adata = sc.read_h5ad('data/adata_short_example.h5ad') # load data
|
|
41
|
+
xct = st.scTenifoldXct(data = adata, # an AnnData
|
|
42
|
+
source_celltype = 'Inflam. FIB', # sender cell type
|
|
43
|
+
target_celltype = 'Inflam. DC', # receiver cell type
|
|
44
|
+
obs_label = 'ident', # colname in adata.obs indicating cell types
|
|
45
|
+
rebuild_GRN = True, # whether to build GRNs
|
|
46
|
+
GRN_file_dir = 'Net_example_dev', # folder path to GRNs
|
|
47
|
+
verbose = True, # whether to verbose the processing
|
|
48
|
+
n_cpus = -1) # CPU multiprocessing, -1 to use all
|
|
49
|
+
emb = xct.get_embeds(train = True) # Manifold alignment to project data to low-dimensional embeddings
|
|
50
|
+
xct_pairs = xct.null_test() # non-parametric test to get significant interactions
|
|
51
|
+
print(xct_pairs)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Tutorial
|
|
55
|
+
We have included two tutorial notebooks on scTenifoldXct usage and results visualization.
|
|
56
|
+
|
|
57
|
+
Single-sample interaction analysis:<br> https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-short_example.ipynb <br>
|
|
58
|
+
Two-sample differential interaction analysis:<br> https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-merge_short_example.ipynb
|
|
59
|
+
<br/>
|
|
60
|
+
|
|
61
|
+
### Run scTenifoldXct from command-line by `Docker`
|
|
62
|
+
scTenifoldXct provides command-line utilities for users who are not familiar with Python.<br>
|
|
63
|
+
A Docker image of scTenifoldXct can be built from the repository. The Docker image has all required packages and databases included.
|
|
64
|
+
|
|
65
|
+
```shell
|
|
66
|
+
docker build -t sctenifold .
|
|
67
|
+
docker run -it --name xct --shm-size=8gb sctenifold
|
|
68
|
+
```
|
|
69
|
+
If successful, a Bash terminal will be present in the newly created container.<br>
|
|
70
|
+
An example for running single-sample analysis:
|
|
71
|
+
```shell
|
|
72
|
+
python -m scTenifoldXct.core tutorials/data/adata_short_example.h5ad \
|
|
73
|
+
--rebuild \
|
|
74
|
+
-s "Inflam. FIB" \
|
|
75
|
+
-r "Inflam. DC" \
|
|
76
|
+
--n_cpus 8 \
|
|
77
|
+
-v
|
|
78
|
+
```
|
|
79
|
+
For runnning two-sample analysis:
|
|
80
|
+
```shell
|
|
81
|
+
python -m scTenifoldXct.merge tutorials/data/adata_merge_example.h5ad \
|
|
82
|
+
NormalvsTumor N T \
|
|
83
|
+
--rebuild \
|
|
84
|
+
-s "B cells" \
|
|
85
|
+
-r "Fibroblasts" \
|
|
86
|
+
--n_cpus 8 \
|
|
87
|
+
-v
|
|
88
|
+
```
|
|
89
|
+
Users should copy their own data to the container for their analyses.
|
|
90
|
+
|
|
91
|
+
When analysis completes, hit Ctrl + p and Ctrl + q to detach from the container and then copy the result to the host:
|
|
92
|
+
```shell
|
|
93
|
+
docker cp xct:/app/xct_results/ .
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
channels:
|
|
2
|
+
- conda-forge
|
|
3
|
+
dependencies:
|
|
4
|
+
- python~=3.9.6
|
|
5
|
+
- pip>=22.0.4
|
|
6
|
+
- pycairo>=1.21.0
|
|
7
|
+
- anndata>=0.7.4
|
|
8
|
+
- numpy>=1.17.0
|
|
9
|
+
- matplotlib-base>=3.1.2
|
|
10
|
+
- pandas>=0.21
|
|
11
|
+
- scipy>=1.4
|
|
12
|
+
- seaborn
|
|
13
|
+
- h5py>=3
|
|
14
|
+
- tqdm
|
|
15
|
+
- scikit-learn>=0.22
|
|
16
|
+
- statsmodels~=0.13.1
|
|
17
|
+
- patsy
|
|
18
|
+
- networkx>=2.3
|
|
19
|
+
- natsort
|
|
20
|
+
- joblib
|
|
21
|
+
- numba>=0.41.0
|
|
22
|
+
- umap-learn>=0.3.10
|
|
23
|
+
- packaging
|
|
24
|
+
- setuptools-scm
|
|
25
|
+
- black>=20.8b1
|
|
26
|
+
- docutils
|
|
27
|
+
- sphinx<4.2,>=4.1
|
|
28
|
+
- sphinx_rtd_theme>=0.3.1
|
|
29
|
+
- python-igraph~=0.9.8
|
|
30
|
+
- leidenalg
|
|
31
|
+
- louvain!=0.6.2,>=0.6
|
|
32
|
+
# - scikit-misc~=0.1.4
|
|
33
|
+
- pytest>=4.4
|
|
34
|
+
- pytest-nunit
|
|
35
|
+
- dask-core!=2.17.0
|
|
36
|
+
- fsspec
|
|
37
|
+
- zappy
|
|
38
|
+
- zarr
|
|
39
|
+
- profimp
|
|
40
|
+
- flit-core
|
|
41
|
+
- ipywidgets
|
|
42
|
+
- pip:
|
|
43
|
+
- flit
|
|
44
|
+
- session-info
|
|
45
|
+
# - bbknn
|
|
46
|
+
- scanpydoc<0.7.6,>=0.7.4
|
|
47
|
+
# - harmonypy
|
|
48
|
+
# - magic-impute>=2.0
|
|
49
|
+
# - cudf
|
|
50
|
+
# - cuml
|
|
51
|
+
# - cugraph
|
|
52
|
+
# - scanorama
|
|
53
|
+
# - scrublet
|
|
54
|
+
- torch>=1.8.0
|
|
55
|
+
- scikit-misc>=0.1.3
|
|
56
|
+
- scanpy>=1.7.2
|
|
57
|
+
- ray # https://docs.ray.io/en/latest/ray-overview/installation.html
|
|
58
|
+
- notebook
|
|
59
|
+
name: scTenifold
|
|
60
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import List, Union
|
|
2
|
+
import anndata
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def get_cko_data(data: anndata.AnnData, cko_gene_names: Union[List[str], str]) -> anndata.AnnData:
|
|
6
|
+
"""
|
|
7
|
+
Get the adata with the cko genes.
|
|
8
|
+
"""
|
|
9
|
+
cko_gene_names = [cko_gene_names.lower()] if isinstance(cko_gene_names, str) else [gene.lower() for gene in cko_gene_names]
|
|
10
|
+
data.var_names = data.var_names.str.lower()
|
|
11
|
+
gene_index = [data.var_names.get_loc(gene_name) for gene_name in cko_gene_names]
|
|
12
|
+
data.X[:, gene_index] = 0.
|
|
13
|
+
print(f"CKO genes {cko_gene_names} are set")
|
|
14
|
+
|
|
15
|
+
return data
|