Installation

Minimal installation

If you only want to use the core functionalities, namely smoother.SpatialWeightMatrix and smoother.SpatialLoss, Smoother can be directly installed using pip.

$ pip install git+https://github.com/JiayuSuPKU/Smoother.git#egg=smoother

Note

This will be enough if you do not plan to run spatial dimensionality reduction models and convex optimization solvers.

Minimal software dependencies include

torch
scipy
scikit-learn
pandas
tqdm

Full installation

Models in the dimensionality reduction module (smoother.SpatialAE, smoother.SpatialVAE) is built upon scvi-tools. Here we refer to the original repository for installation instructions on different systems.

$ pip install scvi-tools

Note

scvi-tools` doesn’t officially support Apple’s M chips yet. To run SCVI and the corresponding SpatialVAE on Macs with Apple silicon, a temporary solution is to compile both Pytorch and PyG on M1 chips using compatible wheel files.

$ conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64

$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch

$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric

$ pip install scvi-tools

To solve data imputation and deconvolution models using convex optimization, you need to also install the ‘cvxpy’ package.

$ conda install -c conda-forge cvxpy

To run other functions, e.g., the simulation scripts, we recommend using the conda environment provided in the repo. You can create a new conda environment called ‘smoother’ and install the package in it using the following commands:

# download the repo from github
git clone git@github.com:JiayuSuPKU/Smoother.git

# cd into the repo and create a new conda environment called 'smoother'
conda env create --file environment.yml
conda activate smoother

# add the new conda enviroment to Jupyter
python -m ipykernel install --user --name=smoother

# install the package
pip install -e .

The following software dependencies specified in the environment.yml will be installed

name: smoother
channels:
- conda-forge
dependencies:
- python<4.0
- pip
- scipy
- pytorch
- pandas
- scanpy
- python-igraph
- leidenalg
- scvi-tools
- scikit-learn
- matplotlib==3.5.3
- plotnine==0.8.0
- jupyterlab
- ipywidgets
- pynndescent
- cvxpy
- pip:
   - squidpy
   - fuzzy-c-means
   - scikit-bio==0.5.8