英文:
Seurat error: error in evaluating the argument 'x' in selecting a method for function 'colSums': invalid character indexing"
问题
I'm sorry for any confusion, but it seems like the text you provided is a mixture of code and comments in English. Could you please specify which part you would like to have translated into Chinese?
英文:
library(dplyr)
library(Seurat)
library(patchwork)
hvc.data <- readRDS(file = "E:\\Nikhil Sampath\\HVCcounts_forNS.RDS")
hvc <- CreateSeuratObject(counts = hvc.data, project = "hvc stuff", min.cells = 3, min.features = 200)
Mito_genes <-
c(
"ATP6",
"ATP8",
"COX1",
"COX2",
"COX3",
"CYTB",
"ND1",
"ND2",
"ND3",
"ND4",
"ND4L",
"ND5",
"ND6"
)
hvc[["percent.mito"]] <-
PercentageFeatureSet(
hvc,
features = Mito_genes
)
I'm working through the tutorial for Seurat 4.3.0, and I'm having an issue with the PercentageFeatureSet command.
I am basically trying to use PercentageFeatureSet() to look through an assay and add a column indicating the percentage of mitochondrial rna present within the sample data. I was initially running Seurat 5.0, so i reinstalled to 4.3.0, and that didn't help. I've tried using GetAssayData() to pull the assay data straight from the initial RDS file, and then using that to create a Suerat object, but I got the same error. Sorry if any of my lanugage is incorrect, this is my first day using the library.
答案1
得分: 1
一种可能的解释是,您在数据中使用的基因名称与您在Mito_genes中定义的基因名称的格式不同。例如,如果您的数据是使用ENSEMBL基因ID(ENSG000xxx)生成的,那么就会出现这种情况。
要确定这一点,可以尝试查看数据中的一些基因ID,使用以下命令:
head(rownames(GetAssayData(hvc)))
英文:
One likely explanation is that your gene names in the data are not the same format as the gene names you're defining in Mito_genes. For example, that would be the case if your data was generated using ENSEMBL gene IDs (ENSG000xxx).
To determine that, try looking at some gene IDs in your data, with:
head(rownames(GetAssayData(hvc)))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论