/scDIOR

scDIOR: Single cell data IO softwaRe

Primary LanguageHTMLGNU General Public License v3.0GPL-3.0

scDIOR

scDIOR: Single cell RNA-seq Data IO softwaRe


Directory


Overview top

scDIOR software contains two modules, dior for R and diopy for Python. The data conversion was implemented by a ‘.h5’ file of HDF5 format, which harmonizes the different data types between R and Python. The different aspects of single-cell information were stored in HDF5 group with dataset. scDIOR creates 8 HDF5 groups to store core single-cell information, including data, layers, obs, var, dimR, graphs, uns and spatial.

overview

Installing scDIORtop

Users install and operate scDIOR following two ways:

  1. The environment is created by conda create in which scDIOR is installed.
  2. Docker images are available on the jiekailab/scdior-image.

1. Conda environment

The environment is created by conda create in which dior and diopy are installed.

conda create -n conda_env python=3.8 R=4.0
  1. R installation:
# for R
install.packages('devtools')
devtools::install_github('JiekaiLab/dior')
# or devtools::install_github('JiekaiLab/dior@HEAD')
  1. Python installation:
# for python
pip install diopy

2. Docker image

It is recommend to perform scDIOR in docker image, which ensures that the operating environment remains stable. scDIOR image is available on the jiekailab/scdior-image.

Brief description

  1. We first built the basic jupyter image which based on jupyter/base-notebook (jupyter managing Python and R) and fixuid (fixing user/group mapping issues in containers). This basic image is on jiekailab/scdior-image:base-jupyter-notebook1.0.
  2. Based on our customized basic image, we built scDIOR image again by Dockerfile. For the content of Dockerfile, it is at this link.

The current latest image contains the following main analysis platforms and software:

R version Python version
R 4.0.5 Python 3.8.8
Seurat 4.0.2 Scanpy 1.8.1
SingleCellExperiment 1.12.0 scvelo 0.2.3
monocle3 1.0.0 anndata 0.7.6
dior 0.1.5 diopy 0.5.2

Version control

At present, scDIOR is widely compatible with Seurat (v3~v4) and Scanpy (1.4~1.8) in different docker image. We configured multiple version docker image (https://hub.docker.com/repository/docker/jiekailab/scdior-image) to confirm that scDIOR can work well between multiple versions of Scanpy and Seurat.

Demo link

Platform Software Version data IO
R Seurat v3~v4 ☑️
Python Scanpy 1.4~1.8 ☑️

Operation Environment

1. Docker image

Pulling the scDIOR image by docker pull jiekailab/scdior-image.

  1. Local computer

    1. Starting the container of scDIOR image
    docker run -p 8840:8888 \ # Port mapping (local computer and docker image)
            --name scdior \
            -e JUPYTER_ENABLE_LAB=yes \
            -e JUPYTER_TOKEN=1234 \
            -v ~/:/home/jovyan \ # Directory mapping
            --rm \
            -it jiekailab/scdior-image
    1. Opening jupyter notebook in user's browser
    localhost:8840
  2. **Remote server **

    1. Logging in server through ssh -L
    ssh -L localhost:8840:localhost:8853 user@remote_ip
    # localhost:8840:localhost:8853 Port mapping (local and remote server)
    #  user@remote_ip remote useer
    1. Starting container of scDIOR image
    IMG=jiekailab/scdior-image
    PORT=8853
    PROJECT=scdior
    MEMORY=64g 
    CWD=$(docker inspect $IMG | grep WorkingDir | head -n 1 | sed 's/.* "//;s/"//g;s/,//g') 
    docker run -p $PORT:8888 \ # Port mapping (remote server  and docker image)
            --name $PROJECT \
            -m $MEMORY \
            -u $(id -u):$(id -g) \ # id mapping (user id and user group)
            -e JUPYTER_ENABLE_LAB=yes \
            -e JUPYTER_TOKEN=1234 \
            -v $PWD:$CWD \ # # Directory mapping
            --rm \
            -it $IMG
    1. Starting jupyter in user's browser
    localhost:8840

2. Conda environment

The environment is activated by conda activate.

  1. Local computer

    1. Activating conda environment
    conda activate conda_env
    1. Operating jupyter lab or jupyter notebook
    jupyter lab --port=8840
    # or jupyter notebook --port=8840
    1. Opening jupyter notebook in user's browser
    localhost:8840
  2. Remote server

    1. Logging in server through ssh -L
    ssh -L localhost:8840:localhost:8853 user@remote_ip
    # localhost:8840:localhost:8853 Port mapping (local and remote server)
    #  user@remote_ip remote useer
    1. Activating conda environment
    conda activate conda_env
    1. Operating jupyter lab or jupyter notebook
    jupyter lab --port=8853
    # or jupyter notebook --port=8853
    1. Opening jupyter notebook in user's browser
    localhost:8840

scDIOR demotop

Here, we list several demos to show the powerful performance of scDIOR.

1. Comparison of trajectory inferences

Users can perform trajectory analysis using Monocle3 in R, then transform the single-cell data to Scanpy in Python using scDIOR, such as expression profiles of spliced and unspliced, as well as cell layout. The expression profile can be used to run dynamical RNA velocity analysis and results can be projected on the layout of Monocle3.

Demo link

1.trajectory_inference

2. Data IO for batch correction

User can employ single-cell data preprocess and normalization method provided by Scanpy, and utilize batches correction method provided by Seurat.

Demo link

batch_correct

3. Data IO for spatial omics data

scDIOR supports spatial omics data IO between R and Python platforms.

Demo link

sptail_summary

4. Extended function

  1. The function to load ‘.rds’ file in Python directly;
  2. The function to load ‘.h5ad’ file in R directly;
  3. Command line

Demo link

extend_function


Reference websites top

  1. jupyter docker stacks:
    1. https://github.com/jupyter/docker-stacks
    2. https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html
  2. fixuid: https://github.com/boxboat/fixuid
  3. Seurat: https://satijalab.org/seurat/index.html
  4. monocle3:https://cole-trapnell-lab.github.io/monocle3/
  5. Scanpy: https://scanpy.readthedocs.io/en/stable/index.html
  6. Scvelo: https://scanpy.readthedocs.io/en/stable/index.html