Some cells in meta.data not present in provided counts matrix.
1
1
Entering edit mode
2.3 years ago
Chise ▴ 10

Hello, I am using Seurat for single cell RNA-seq analysis of drosophila data. After I did cell level filtering, I tried gene level filtering as below. However, there was an error message "Some cells in meta.data not present in provided counts matrix" and there were a lot of "N/A" in the meta.data of filtered_fly9. I would appreciate it if someone could let me know how to fix this.

#Cell level filtering
filtered_fly9 <- subset(x = fly9, subset= log10GenesPerUMI > 0.80)

I confirmed that the metadata of the filtered_fly9 after the cell level filtering was filled in numbers.

#Gene level filtering
counts9 <- GetAssayData(object = filtered_fly9, slot = "counts")
nonzero9 <- counts9 > 0
keep_genes9 <- Matrix::rowSums(nonzero9) >= 10
filtered_counts9 <- counts[keep_genes9, ]
filtered_fly9 <- CreateSeuratObject(filtered_counts9, meta.data = filtered_fly9@meta.data)

There were a lot of "N/A" in the meta.data of the filtered_fly9.

seurat scRNA-seq CreateSeuratObject • 2.8k views
ADD COMMENT
0
Entering edit mode

Hello Dr. tomas4482, thank you so much for your message. Now I understand why there were a lot of N/A... I appreciate your taking time.

ADD REPLY
0
Entering edit mode

Why did you delete your posts? Who's Dr. tomas4482?

ADD REPLY
0
Entering edit mode

I think my original answer should be something like:

filtered_fly9 is the original matrix, but filtered_counts9 is a filtered matrix. The meta.data will be definitely less in filtered_counts9. That's why you gets so many NA.

But later I found that the count assay seems to subset genes only. The answer may be incorrect. Without an test sample, I'm not able to find out the reason. Therefore, I deleted the original answer.

ADD REPLY
0
Entering edit mode

I see. I think it was done pretty quickly, as moderators such as myself are able to view deleted posts for a while. I'll delete this thread in a bit.

ADD REPLY
0
Entering edit mode
2.3 years ago
LChart 4.4k

You can check that colnames(counts) match rownames(filtered_fly9@meta.data) -- but more generally you do not need to create an entirely new Seurat object to do this. You can go with:

filtered_fly9 <- subset(fly9, ...)
filtered_fly9 <- filtered_fly9[rowSums(GetAssayData(filtered_fly9, 'counts') > 0) > 10,]

which should eliminate the error.

ADD COMMENT

Login before adding your answer.

Traffic: 889 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