YosefLab / ImpulseDE2

37 stars 10 forks source link

ImpulseDE2 with paired case/control #9

Closed jchariker closed 4 years ago

jchariker commented 4 years ago

Hi David,

I am using ImpulseDE2 to analyze a case-control data set with four time points. At each time point, the case and control are paired (same animal). Is it possible to include the paired aspect of the data in the analysis?

Thanks, Julia

davidsebfischer commented 4 years ago

Hi @jchariker! Thanks for your interest! Do you have one animal per time point or multiple? How many time points to you have? Best, David

jchariker commented 4 years ago

Hi David,

I pasted my sample table below. I have 24 samples and 12 animals. I added notation to the right of the table indicating the individual animals. There are four time points, and each time point has three replicates for case and control. Each case and control is the same animal.

ImpulseDE2 is running beautifully and giving interesting results, but the researchers I am working with would like to take the paired aspect of the data into account (if possible). I can do this with DESeq2 in the design formula, but I much prefer getting the results of your fit to the four trajectories!

Thank you for your thoughts on this matter.

Julia Sample Condition Time MH.01.S21.RT.naive.IN_S1 MH.01.S21.RT.naive.IN_S1 control 1 (animal 1) MH.02.S21.RT.naive.IP_S2 MH.02.S21.RT.naive.IP_S2 case 1 (animal 1) MH.03.S22.RT.naive.IN_S3 MH.03.S22.RT.naive.IN_S3 control 1 (animal 2) MH.04.S22.RT.naive.IP_S4 MH.04.S22.RT.naive.IP_S4 case 1 (animal 2) MH.05.S23.RT.naive.IN_S5 MH.05.S23.RT.naive.IN_S5 control 1 (animal 3) MH.06.S23.RT.naive.IP_S6 MH.06.S23.RT.naive.IP_S6 case 1 (animal 3) MH.07.S12.RT.2DPI.IN_S7 MH.07.S12.RT.2DPI.IN_S7 control 2 (animal 4) MH.08.S12.RT.2DPI.IP_S8 MH.08.S12.RT.2DPI.IP_S8 case 2 (animal 4) MH.09.S13.RT.2DPI.IN_S9 MH.09.S13.RT.2DPI.IN_S9 control 2 (animal 5) MH.10.S13.RT.2DPI.IP_S10 MH.10.S13.RT.2DPI.IP_S10 case 2 (animal 5) MH.11.S14.RT.2DPI.IN_S11 MH.11.S14.RT.2DPI.IN_S11 control 2 (animal 6) MH.12.S14.RT.2DPI.IP_S12 MH.12.S14.RT.2DPI.IP_S12 case 2 (animal 6) MH.13.S15.RT.10DPI.IN_S13 MH.13.S15.RT.10DPI.IN_S13 control 3 (animal 7) MH.14.S15.RT.10DPI.IP_S14 MH.14.S15.RT.10DPI.IP_S14 case 3 (animal 7) MH.15.S16.RT.10DPI.IN_S15 MH.15.S16.RT.10DPI.IN_S15 control 3 (animal 8) MH.16.S16.RT.10DPI.IP_S16 MH.16.S16.RT.10DPI.IP_S16 case 3 (animal 8) MH.17.S17.RT.10DPI.IN_S17 MH.17.S17.RT.10DPI.IN_S17 control 3 (animal 9) MH.18.S17.RT.10DPI.IP_S18 MH.18.S17.RT.10DPI.IP_S18 case 3 (animal 9) MH.19.S18.RT.42DPI.IN_S19 MH.19.S18.RT.42DPI.IN_S19 control 4 (animal 10) MH.20.S18.RT.42DPI.IP_S20 MH.20.S18.RT.42DPI.IP_S20 case 4 (animal 10) MH.21.S19.RT.42DPI.IN_S21 MH.21.S19.RT.42DPI.IN_S21 control 4 (animal 11) MH.22.S19.RT.42DPI.IP_S22 MH.22.S19.RT.42DPI.IP_S22 case 4 (animal 11) MH.23.S20.RT.42DPI.IN_S23 MH.23.S20.RT.42DPI.IN_S23 control 4 (animal 12) MH.24.S20.RT.42DPI.IP_S24 MH.24.S20.RT.42DPI.IP_S24 case 4 (animal 12)

davidsebfischer commented 4 years ago

Hi Julia, so I guess you design formula in DESeq2 is similar to ~1+time+condition+condition:time+animal. Something like that is actually not trivially possible in ImpulseDE2 as we optimise the model for the case and control condition in the full model separately, thereby excluding such shared batch effects (+animal). I don't think that we can support this in the near future as we would have to validate that this new optimisation across both model is stable, which is not so trivial. Sorry for that; but using DESeq2 here with this design formula definitely makes sense, too!

jchariker commented 4 years ago

Hi David, My apologies for taking so long to respond! I read your response immediately, and then got distracted by projects and holidays. I have been using the following design model in DESeq2:

animal+condition+timepoints+condition:timepoints

...but I really prefer using ImpulseDE2. I can imagine it is not a simple problem to include the paired aspect of the data in the analysis. I appreciate you taking the time to think about it! Julia

davidsebfischer commented 4 years ago

Hi @jchariker! Thanks, I appreciate the enthusiasm very much! The way that you are using DESeq2 is correct, this is definitely a good alternative to ImpulseDE2 for this special case! One note - I do not know how you nest both case and control in a single individual; depending on how strongly they are coupled it may be that the animal covariate is not actually contributing a lot of variance. You could check that by looking that the fitted coefficients in DESeq2 relative to for example the covariate coefficients. If this effect was small you could ignore it to infer up- and down-regulated genes or similar with ImpulseDE2, but I would definitely always complement such an analysis with the above analysis with a GLM such as in DESeq2. Good luck with that!