我正在尝试执行单细胞 RNA seq 分析,并有一个 .h5ad 文件,我正尝试将其转换为 seurat 对象以开始分析它。
到目前为止,我已经将文件转换为 h5seurat 文件。我面临的问题是在我尝试加载此 h5seurat 文件时的步骤。
这是我用 R 编写的代码:
library(Seurat)
library(SeuratObject)
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes")
}
remotes::install_github("mojaveazure/seurat-disk", force = TRUE)
library(SeuratDisk)
#reading in the h5ad file
#STEP1: convert the annData object to h5Seurat object
Convert("file.h5ad", dest="h5seurat", overwrite=TRUE)
#STEP2:loading the h5Seurat file
file_seurat<- LoadH5Seurat("file.h5seurat")
当我运行 STEP2 时,这是我收到的错误消息:
Error in fixupDN.if.valid(value, x@Dim) : length of Dimnames[[1]] (28728) is not equal to Dim[1] (2219)
我知道这意味着以下之间存在差异: Dimnames[[1]] :指分配给长度为 28,728 的行(通常是特征)的名称。 Dim[1] :指数据矩阵中的实际行数,大小为 2,219。
但我不确定我需要做什么来解决这个问题。感谢我能得到的所有帮助!
就我而言,您的代码适用于此处提供的数据集:https://github.com/chanzuckerberg/cellxgene/blob/main/example-dataset/pbmc3k.h5ad,您能否检查一下是否也是如此你?如果是这样,这可能是您的数据集中的问题。
也许首先尝试使用包anndataR将其作为h5ad打开,并验证尺寸是否是您期望的尺寸?