S2. Interoperability

Here, we briefly demonstrate how the single-cell objects may be converted between R and python to run CCC analyses in either language:

[1]:
import os
import scanpy as sc

data_path = '../../data/'

to R

For use in R, the .h5ad file saved in Tutorial 1 can be loaded in R as a SeuratObject using SeuratDisk. See the companion supplementary R tutorial for loading these saved files.

from R

SCE

Here, we can load the data that was generated in the R version of Tutorial l using SingleCellExperiment:

[2]:
file_name = os.path.join(data_path, 'processed_fromR_toPython.h5ad')
adata_fromR_sce = sc.read_h5ad(file_name)

Seurat

We can also load the Seurat data we generated in the supplementary R Tutorial:

[3]:
file_name = os.path.join(data_path, 'processed_fromR_toPython_Seurat.h5ad')
adata_fromR_seurat = sc.read_h5ad(file_name)
/home/hratch/miniconda3/envs/ccc_protocols/lib/python3.10/site-packages/anndata/compat/__init__.py:298: FutureWarning: Moving element from .uns['neighbors']['distances'] to .obsp['distances'].

This is where adjacency matrices should go now.
  warn(