单细胞之rds,loom和h5ad数据格式转换

Seurat依旧是单细胞分析的利器,也有越来越的的单细胞分析工具基于python开发。在数据分析时,有时需要将seurat的结果迁移到python下游分析,手动迁移seurat的cluster,umap,pca等结果很麻烦,现在和大家分享一款数据格式转换工具,帮助大家完成R与python多平台的多工具的数据分析。

工具来自这篇文章——Comparison of visualization tools for single-cell RNAseq data


安装与使用

这里是github上    README.md

Installation

sceasy is installable either as a bioconda package:

conda install -c bioconda r-sceasy

or as an R package:

devtools::install_github("cellgeni/sceasy")

which will require the biconductor packages BiocManager and LoomExperiment:

if (!requireNamespace("BiocManager", quietly = TRUE))

    install.packages("BiocManager")

BiocManager::install(c("LoomExperiment", "SingleCellExperiment"))

To use sceasy ensure the anndata package is installed:

conda install anndata -c bioconda

Optionally, if you plan to convert between loom and anndata, please also ensure that the loompy package is installed:

conda install loompy  -c bioconda

You will also need to install reticulate package:

install.packages('reticulate')

Usage

Before converting your data please load the following libraries in your R session:

library(sceasy)

library(reticulate)

use_condaenv('EnvironmentName')

loompy <- reticulate::import('loompy')

Seurat to AnnData

sceasy::convertFormat(seurat_object, from="seurat", to="anndata",

                      outFile='filename.h5ad')

AnnData to Seurat

sceasy::convertFormat(h5ad_file, from="anndata", to="seurat",

                      outFile='filename.rds')

Seurat to SingleCellExperiment

sceasy::convertFormat(seurat_object, from="seurat", to="sce",

                      outFile='filename.rds')

SingleCellExperiment to AnnData

sceasy::convertFormat(sce_object, from="sce", to="anndata",

                      outFile='filename.h5ad')

SingleCellExperiment to Loom

sceasy::convertFormat(sce_object, from="sce", to="loom",

                      outFile='filename.loom')

Loom to AnnData

sceasy::convertFormat('filename.loom', from="loom", to="anndata",

                      outFile='filename.h5ad')

Loom to SingleCellExperiment

sceasy::convertFormat('filename.loom', from="loom", to="sce",

                      outFile='filename.rds')

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容