ahmohamed / lipidr

Data Mining and Analysis of Lipidomics datasets in R
https://www.lipidr.org/
Other
27 stars 13 forks source link

Two factor analysis with interaction #43

Closed marcora closed 1 year ago

marcora commented 1 year ago

In my lipidomic study, I have treated cells with siRNA to reduce the expression of gene A and gene B. Some cells were untreated, some cells were treated with siRNA for gene A, some cells were treated with siRNA for gene B, and some cells were treated with siRNA for gene A + siRNA for gene B.

Does lipidr allow for two-factor analysis (with interaction) by coding the treatment group as two columns (A and B) containing 0 and 0, 1 and 0, 0 and 1, or 1 and 1 for each sample depending on which of the treatments above was applied?

Is it possible to look at interaction between gene A and gene siRNA knockdown?

I understand I can just have one treatment group with 4 levels (untreated,a,b,a+b) but this would remove valuable information from the model, which is likely to hurt power.

ahmohamed commented 1 year ago

You should be able to model the interaction variations using interacting <- de_design(d, ~ a*b, coef="a:b"). The interaction term will give you a design matrix similar to this one:

image

The last column represents the interaction.

marcora commented 1 year ago

Super! Thank you very much. In general, it would be great to have more flexibility for model specification (e.g., include random effects). It would also be great to have functions to plot model diagnostics (or return residuals), and to calculate marginal effects. All of which could solved by being able to obtain the model fit calculated behind the scene.

ahmohamed commented 1 year ago

Thanks for the suggestions. duplicateCorrelations and the like are definitely on my todo list. It's just hard to make sure they work in all cases and are not misused. I also feel users who are after sophisticated models are likely to know how to use limma directly and won't need lipidr wrappers anyway. But definitely something to consider.

I'll close the issue now, but feel free to reopen if you have any more questions.