arnesmits / DEP

DEP package
27 stars 12 forks source link

Handling Technical and Biological Replicates #27

Open agave82 opened 2 years ago

agave82 commented 2 years ago

Hi, I have an experimental design as follows:

WT_1 WT_2 WT3 WT_4 KO_1 KO_2 KO_3 KO_4

_1 and _2 are biological replicates while _3 and _4 are technical replicates.

Please, can you explain how to handle technical and biological replicates in DEP? I understand that I can utilise the option type="all" to make pairwise comparisons: data_diff_all_contrasts <- test_diff(data_imp, type = "all") I hav e done that but would that be enough to take into account the replicates or do I need add the design_formula option in the code? If design_formula needs to be include please, can you explain how to do in my case of experimental design? Thank you very much

ojziff commented 2 years ago

I have this same query: How do we compare groups of biological replicates?

In the vignette, there is only an example of how to compare groups of technical replicates (Ubi4_vs_Ubi6, Ubi4_vs_Ctrl, Ubi4_vs_Ubi1, Ubi6_vs_Ctrl, Ubi6_vs_Ubi1, Ctrl_vs_Ubi1) but how do you compare all Ubi samples with Ctrl? We could treat biological replicates (Ubi1, Ubi4, Ubi6) in the same way as technical replicates by giving them a replicate number 1 to 9 and the same condition name, but this is not ideal as limma is unaware that each biological replicate is in triplicate.

label condition replicate technical_replicate
Ubi4_1 Ubi 1 1
Ubi4_2 Ubi 2 2
Ubi4_3 Ubi 3 3
Ubi6_1 Ubi 4 1
Ubi6_2 Ubi 5 2
Ubi6_3 Ubi 6 3
Ubi1_1 Ubi 7 1
Ubi1_2 Ubi 8 2
Ubi1_3 Ubi 9 3
Ctrl_1 Ctrl 1 1
Ctrl_2 Ctrl 2 2
Ctrl_3 Ctrl 3 3

I saw in a related issue https://github.com/arnesmits/DEP/issues/11#issuecomment-782045411 that you could treat the technical replicate as a batch effect and adjust for the technical replicate in the design with ~0 + technical_replicate + condition.

Is there any better solutions @arnesmits @adomingues @agave82 ?

Many thanks, Oliver

adomingues commented 2 years ago

To my knowledge I think you covered most of it @ojziff.

The only other solution I can think of, and I have seen done / suggested, is to average the technical replicates before doing the differential analysis with DEP. It's a rough approach, but it the replicates are well correlated it should be fine.