Seurat error: error in evaluating the argument 'x' in selecting a method for function 'colSums': invalid character indexing"

huangapple go评论230阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年6月8日 01:23:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76425722.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定