Quality control of scRNA-seq data using mitochondrial ratio (drosophila)
1
0
Entering edit mode
Chise ▴ 10
@9cb59de3
Last seen 2.4 years ago
United States

Hello, I am working on scRNA-seq analysis using Seurat. For quality control, I am trying to calculate the proportion of reads mapped to mitochondrial transcripts. Since the sample is derived from drosophila, I got the information of mitocondrial transcripts in drosophila as below.

library(AnnotationHub)
library(ensembldb)
ah <- AnnotationHub()
ahDb <- query(ah, pattern = c("Drosophila melanogaster", "EnsDb"))
id <- ahDb %>% mcols() %>% rownames() %>% tail(n = 1)
edb <- ah[[id]]
annotations <- genes(edb, return.type = "data.frame") 
annotations <- annotations %>% dplyr::select(gene_id, gene_name, gene_biotype, seq_name, description, entrezid)
View(annotations)
mt <- annotations %>% dplyr::filter(seq_name == "mitochondrion_genome") %>% dplyr::pull(gene_name)

The "mt" showed 38 mitochondrial transcripts. However, when I tried to use the following codes, there was an error message as "Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'colSums': object of type 'closure' is not subsettable".

metadata$mtUMI <- Matrix::colSums(counts[which(rownames(counts) %in% mt),], na.rm = T)

I would appreciate it if someone could inform me of how to fix it up.

Drosophila_melanogaster scRNAseq • 1.5k views
ADD COMMENT
1
Entering edit mode

You are trying to filter on a function called counts(). This object of type 'closure' is not subsettable" means that one is trying to do filtering and subsetting operation on a function while assuming it was a variable with (in your case) counts.

Here is an example:

> counts <- function() 1
> counts[1] 
> Error in counts[1] : object of type 'closure' is not subsettable

Meaning you probably think that counts was a matrix of counts, which it probably isn't. Check your code and make sure the count matrix is indeed assigned to counts.

ADD REPLY
0
Entering edit mode

The problem was solved thanks to your advice. I appreciate your help!

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

Seurat isn't a Bioconductor package, so you should direct questions to whatever support mechanism they have for their packages.

ADD COMMENT
0
Entering edit mode

I understand it!

ADD REPLY

Login before adding your answer.

Traffic: 469 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6