neurorestore / Libra

MIT License
150 stars 24 forks source link

A quick question about application of liner mixed model method to detect degs #41

Open HelloWorldLTY opened 1 year ago

HelloWorldLTY commented 1 year ago

Hi, I intend to detect differential expressed genes for female people with diseases, so I change cell type into male/female and choose to assign conditions as diseases/health. Is it correct? I found that my current genes are in large divergence comparing with genes from Wilcoxon. Thanks a lot.

jordansquair commented 1 year ago

It's hard to know exactly what you mean? Is there an actual bug in Libra for this?

HelloWorldLTY commented 1 year ago

Hi, I am not sure if it is a bug or the problem of my user case.

I intend to identify differential expressed genes for diseases, and I plan to use mixed model. But the result is very strange.

My codes are like:

` expr = GetAssayData(data, slot = 'counts', assay = 'RNA') meta = data@meta.data

meta$cell_type = "Female"

meta[meta$gender == "HC_Female",]$cell_type = "Female" meta[meta$gender == "AD_Female",]$cell_type = "Female" meta[meta$gender == "HC_Male",]$cell_type = "Male" meta[meta$gender == "AD_Male",]$cell_type = "Male"

de = run_de(expr, meta = meta, de_family = 'mixedmodel', de_method = 'negbinom')

head(de) ` Is it correct? Thanks.

jordansquair commented 1 year ago

I don't understand why you would make cell type gender. Do you not have cell types?

HelloWorldLTY commented 1 year ago

I have cell types but I intend to find gender-specific differental expressed genes for diseases. Is it clear? So I think the cell type here represents my gender labels. Thanks.

jordansquair commented 1 year ago

This would require a more complex design, but does not sound like a bug in libra.

HelloWorldLTY commented 1 year ago

Emm I think my current idea fits my target well. Besides, I think there is a bug in mixed model like:

A tibble: 6 × 8

cell_type gene avg_logFC p_val p_val_adj de_family de_method de_type

1 Female A1BG 0.0433 0.206 0.894 pseudobulk negbinom LRT 2 Female A1BG-AS1 0.0523 0.0665 0.721 pseudobulk negbinom LRT 3 Female A1CF 0.00689 NA NA pseudobulk negbinom LRT 4 Female A2M -0.366 0.379 0.963 pseudobulk negbinom LRT 5 Female A2M-AS1 0.00708 0.380 0.963 pseudobulk negbinom LRT 6 Female A2ML1 0.00139 NA NA pseudobulk negbinom LRT This is the output of mixedmodel method. Even if I have selected de_family as mixedmodel, its output still contained pseudobulk. I think it is abnormal.
jordansquair commented 1 year ago

This bug has been fixed.