This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in measuring percentage of mit.genes
JHY_pbmc[["percent.mt"]] <- PercentageFeatureSet(JHY_pbmc, 
                                                 features  = c("gene-nad5","gene-nad1",
                                                               "gene-nad2","gene-nad4",
                                                               "gene-nad7","gene-cox1",
                                                               "gene-cox2","gene-ccmFc2"), 
                                                assay = 'RNA')




Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'colSums': invalid character indexing
scrna-seq bug seurat

What does the following return?

all(c("gene-nad5","gene-nad1", "gene-nad2","gene-nad4", "gene-nad7","gene-cox1", "gene-cox2","gene-ccmFc2") %in% rownames(JHY_pbmc))

1 answer

I had the same error and following what jared.andrews07 suggested, I only passed present gene_ids as features and it worked fine. Here is how I did it:

data <- PercentageFeatureSet(data, features = mito_genes[mito_genes %in% rownames(data)], col.name = "percent_mito", assay = 'RNA')

Log in to answer this question.