MarioniLab / miloR

R package implementation of Milo for testing for differential abundance in KNN graphs
https://bioconductor.org/packages/release/bioc/html/miloR.html
GNU General Public License v3.0
334 stars 22 forks source link

support for time points from same donor #268

Open zia1138 opened 1 year ago

zia1138 commented 1 year ago

Really great work with milo! We have a study where we have two time points across from the same donor which we are interested in comparing across treatments. In limma, we can take advantage of the blocking variable in voomLmfit (or duplicateCorrelation) for differential gene expression analysis to increase power to detect differential effects. From my rough understanding this is not possible with milo since glmQLFit is used from edgeR. Is this correct? Can testNhoods use voomLMfit with a blocking variable instead or another test that allows designs with multiple measurements from the same donor? Thanks! Zia

MikeDMorgan commented 1 year ago

Hi @zia1138 If you are familiar with the limmaVoom syntax then you can dispense with testNhoods and use the nhoodCount matrix as input, though you will need to setup the design matrix, etc yourself. Our current approach for repeated measures designs is under development and uses a different framework entirely.

zia1138 commented 1 year ago

Thank you @MikeDMorgan! Great. Looking forward to seeing the new framework. Any tips on how we can extract the nhoodCount matrix? Is it best to refactor the testNhoods function?

MikeDMorgan commented 1 year ago

nhoodCounts(milo_obj) will give you the nhoods X sample counts matrix.

graciegordon commented 1 year ago

Hi @MikeDMorgan. I tried your suggestion using the nhoodCounts with Limma to leverage blocking variables, however I am running into some issues.

I just ran voomLmFit() on the counts without the blocking variable to compare with the glmQfit results from MIlo, but we do not see signal as we did when we fit an equivalent model with Milo. Is it possible that singe Milo uses a NB distribution it can handle the sparser counts better than voomLmFit? Voom also uses a slightly different normalization scheme (logCPM) which might also contribute to this issue.

Any advice/suggestions would be greatly appreciated.

MikeDMorgan commented 1 year ago

Hi @graciegordon - in the Milo and limma-voom results were the DA nhoods very close to the FDR threshold level? If so then this might explain the differences.

graciegordon commented 1 year ago

They were not very close at all to the FDR threshold actually. Using the same milo nhoodCount matrix the p values are not even well correlated

MikeDMorgan commented 10 months ago

Hi @graciegordon @zia1138 In the updated Milo (2.0.0) we have introduced a mixed effect model that allows you to model multiple observations from donors as random effects. If you'd like to try this out it is available on the master branch of the repository: devtools::install_github("MarioniLab/miloR"). There is also a vignette linked to on the repo landing page to give you an idea of how to perform these analyses: https://raw.githack.com/MarioniLab/miloR/devel/vignettes/milo_glmm.html

zia1138 commented 10 months ago

Sweet. Thank you @MikeDMorgan!

flde commented 6 months ago

Hello Mike, many thanks! I tried to get Milo v2.0 to model patient id as random effect in a time course experiments. I tried installing Milo v2.0 but the master is v1.99.9 and devel is v1.99.12. I am not very experienced with GitHub but is it the case that v2.0 is currently not merged with master? Many thanks for your help.

MikeDMorgan commented 6 months ago

The github main 1.99.9 contains all the Milo2.0 code - the version will tick over with the new Bioconductor release in April.

flde commented 6 months ago

Many thanks for the confirmation, it works!