【单细胞测序】数据格式转换:sceasy
dooooob
2020年12月05日 12:04
收录于文集
共23篇

虽然一些处理软件自带了格式转换的方法,比如Seurat的as.loom,但有时候会发现自带的方法不能满足需求。这边推荐一个综合了各种格式转换的R包:sceasy。 https://github.com/cellgeni/sceasy

安装

BiocManager::install(c("LoomExperiment", "SingleCellExperiment"), update=F)

install.packages('reticulate')

devtools::install_github("cellgeni/sceasy")

还需要在python安装anndata包(版本 < 0.6.20), oompy包(版本 < 3.0.0)

使用

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')