CAST is a Python library for physically aligning different spatial transcriptome regardless of technologies, magnification, individual variation, and experimental batch effects. CAST is composed of three modules: CAST Mark, CAST Stack, and CAST Projection.
For Windows system, we suggest to use the Anaconda powershell
to run following code.
- [Optional] It is recommended to create a conda environment for CAST.
For example, create a new environment named cast_demo
and activate it.
conda create -y -n cast_demo python=3.9
conda activate cast_demo
- [Optional] CAST requires
pytorch
anddgl
Users could use nvcc --version
to check the CUDA version for installation.
Here we provide with an example of the CUDA 11.3
installation code.
#### If CPU only ####
conda install pytorch==1.11.0 cpuonly -c pytorch
conda install -c dglteam dgl
#### If GPU available ####
conda install -y -c pytorch pytorch==1.11.0 cudatoolkit=11.3
conda install -y -c dglteam dgl-cuda11.3==0.9.1
If git
is available:
pip install git+https://github.com/wanglab-broad/CAST.git
If git
is unavailable:
-
Download the package and unpack it
-
run the code:
cd $package
pip install -e .
We provide with several demos to demonstrate the functions in CAST package. Due to file size restrictions at GitHub, we cannot upload sample datasets associated with the demos. Please kindly find the data at our zenodo archive for the paper: https://zenodo.org/doi/10.5281/zenodo.12215314. This Zenodo repo also contains code and data to reproduce results in the paper.
Users can use following code to open the Jupyter notebook
(We recommend to use Chrome
to open the jupyter notebook).
cd $demo_path
jupyter notebook
#### If remote kernel ####
jupyter notebook --ip=0.0.0.0 --port=8800
#### If dead kernel ####
jupyter notebook --NotebookApp.max_buffer_size=21474836480
In this demo, CAST_Mark can captures the common spatial features across multiple samples
Users should first replace $demo_path
with the CAST demo Path in the first cell.
In this demo, Stack_Align can align two samples together.
Users should first replace $demo_path
with the CAST demo Path in the first cell.
In this demo, CAST_projectiong will project one sample to another one.
Users should first replace $demo_path
with the CAST demo Path in the first cell.
We also updated more demos in the tutorial pages.