a semi-supervised method for predicting cell-cell interactions and mapping cellular communication graphs via manifold learning
New! Data has been added. Feel free to explore and use it.
New! A standalone UI has been added. Give it a try!
[Paper]
We suggest first intall dependencies of scTenifoldXct with conda
:
git clone https://github.com/cailab-tamu/scTenifoldXct.git
cd scTenifoldXct
conda env create -f environment.yml
conda activate scTenifold
Install scTenifoldXct with pip
:
pip install git+https://github.com/cailab-tamu/scTenifoldXct.git
or install it manually from source:
pip install .
The following code runs scTenifoldXct on an example data set in the tutorials:
import scanpy as sc
import scTenifoldXct as st
adata = sc.read_h5ad('data/adata_short_example.h5ad') # load data
xct = st.scTenifoldXct(data = adata, # an AnnData
source_celltype = 'Inflam. FIB', # sender cell type
target_celltype = 'Inflam. DC', # receiver cell type
obs_label = 'ident', # colname in adata.obs indicating cell types
rebuild_GRN = True, # whether to build GRNs
GRN_file_dir = 'Net_example_dev', # folder path to GRNs
verbose = True, # whether to verbose the processing
n_cpus = -1) # CPU multiprocessing, -1 to use all
emb = xct.get_embeds(train = True) # Manifold alignment to project data to low-dimensional embeddings
xct_pairs = xct.null_test() # non-parametric test to get significant interactions
print(xct_pairs)
We have included two tutorial notebooks on scTenifoldXct usage and results visualization.
Single-sample interaction analysis:
https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-short_example.ipynb
Two-sample differential interaction analysis:
https://github.com/cailab-tamu/scTenifoldXct/blob/master/tutorials/tutorial-merge_short_example.ipynb
Docker
scTenifoldXct provides command-line utilities for users who are not familiar with Python.
A Docker image of scTenifoldXct can be built from the repository. The Docker image has all required packages and databases included.
docker build -t sctenifold .
docker run -it --name xct --shm-size=8gb sctenifold
If successful, a Bash terminal will be present in the newly created container.
An example for running single-sample analysis:
python -m scTenifoldXct.core tutorials/data/adata_short_example.h5ad \
--rebuild \
-s "Inflam. FIB" \
-r "Inflam. DC" \
--n_cpus 8 \
-v
For runnning two-sample analysis:
python -m scTenifoldXct.merge tutorials/data/adata_merge_example.h5ad \
NormalvsTumor N T \
--rebuild \
-s "B cells" \
-r "Fibroblasts" \
--n_cpus 8 \
-v
Users should copy their own data to the container for their analyses.
When analysis completes, hit Ctrl + p and Ctrl + q to detach from the container and then copy the result to the host:
docker cp xct:/app/xct_results/ .