neurorestore / Libra

MIT License
151 stars 25 forks source link

DEseq2 cell_type not found #6

Open nihalasalem opened 3 years ago

nihalasalem commented 3 years ago

Thank you so much for developing a very comprehensive tool. I was able to run edgeR with LRT and Limma. However when I try to run DEseq2 I get this error. Error: Must group by variables found in .data.

the colnames in pfc_meta_deseq are "replicate" "label" "cell_type" and the colnames in expr are the cell barcodes

nihalasalem commented 3 years ago

update: I got the same issue as well while running "MAST" Column cell_type is not found.

jordansquair commented 2 years ago

DE method should be "DESeq2" not "DEseq2". Can you fix that and see if it works?

KammannT commented 2 years ago

I encountered the same issue and can confirm it persists after correct spelling of "DESeq2" or 'MAST'.

nihalasalem commented 2 years ago

It only worked when I used on Seurat object , but not through providing count matrix and metadata separately

jordansquair commented 2 years ago

Pushed a fix - hopefully this works. Or else maybe you can send me a small sample of your data to figure out what is going on. Let me know!

Xnnq commented 2 years ago

Have this issue got fixed? I encountered this error no matter which types of input data and DE methods I use. The error hints me there might be something wrong with the final dplyr::arrange() part of run_de().

jordansquair commented 2 years ago

Please provide a reproducible example and/or a subset of your data that is causing the issue.

Xnnq commented 2 years ago

I have sent you a e-mail through your gmail address. Many thanks for your help!

jordansquair commented 2 years ago

Libra does binary comparisons. You have 3 labels so that is why you have an error. You just need to loop over your comparisons. For example:

` library(Libra) library(Seurat)

sc = readRDS("~/Downloads/test.rds")

DefaultAssay(sc) = 'RNA' groups = unique(sc$label) comparisons = tidyr::crossing( group1 = groups, group2 = groups ) %>% filter(group1 > group2)

results = c() for (i in 1:nrow(comparisons)) { Idents(sc) = sc$label group1 = comparisons[i,]$group1 group2 = comparisons[i,]$group2 sc0 = subset(sc, idents = c(group1, group2)) de = run_de(sc0) %>% mutate(group1 = group1, group2 = group2) results %<>% bind_rows(de) } `

liangxs7015 commented 1 year ago

Libra does binary comparisons. You have 3 labels so that is why you have an error. You just need to loop over your comparisons. For example:

` library(Libra) library(Seurat)

sc = readRDS("~/Downloads/test.rds")

DefaultAssay(sc) = 'RNA' groups = unique(sc$label) comparisons = tidyr::crossing( group1 = groups, group2 = groups ) %>% filter(group1 > group2)

results = c() for (i in 1:nrow(comparisons)) { Idents(sc) = sc$label group1 = comparisons[i,]$group1 group2 = comparisons[i,]$group2 sc0 = subset(sc, idents = c(group1, group2)) de = run_de(sc0) %>% mutate(group1 = group1, group2 = group2) results %<>% bind_rows(de) } `

Does it mean that I have to compare C1, C2, C3 labels by C1--(C2+C3), C2--(C1+C3), and C3--(C1+C2)?

jordansquair commented 1 year ago

You can do it however you see fit. Either pairwise or as you proposed. This does not seem like a Libra problem anymore so much as an experimental design question.