單細胞之rds,loom和h5ad數據格式轉換

Seurat依舊是單細胞分析的利器,也有越來越的的單細胞分析工具基于python開發(fā)。在數據分析時,有時需要將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')

?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容