一行代码将h5ad转换为rds(其他常用格式也有)

一行代码将h5ad转换为rds(其他常用格式也有)

使用sceasy这个R包

安装:

devtools::install_github("cellgeni/sceasy")
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

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

转换:

sceasy::convertFormat('../data/citeseq.h5ad', from="anndata", to="seurat",
                       outFile='citeseq.rds')

下面是sceasy的github仓库

cellgeni/sceasy: A package to help convert different single-cell data formats to each other (github.com)

其他格式转换

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')
  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值