# how to calculate fold change when we have replicate

I have obtained genes with ratios. As an small example you can see my data below

Gene    Control1     Control2   Control3    Treated1    Treated2    Treated3
pps-1   324680000   211350000   356350000   269770000   258080000   292830000
R11A8.7 477490000   610780000   539550000   533590000   530810000   578290000
ugt-21  105080000   103430000   74137000    78915000    42381000    31415000
spp-18  1042800000  615030000   332720000   538340000   448280000   412310000


Now My question is that I have Three controls and Three Treated, Control has two biological replicate and Treated has two biological replicate

How can I calculate the fold change for it?

I see two ways

The first way I take the average of my control group , lets call it A (one column) I take the average of my treated group, lest call it B (one column) Then I calculate the fold change (B/A)

This way, I can check also whether the correlation between all biological replicate of control or treated are high which indicates taking the average is fine

The second way I perform multi comparison test on both group I find up regulated genes and down regulated genes I discard the rest of the genes I take the average of my control group , lets call it A (one column) I take the average of my treated group, lest call it B (one column) Then I calculate the fold change (B/A)

which one of them make more sense?

My main concern is how to calculate the fold change when I have biological replicate ,

I posted in biology group they said it is better I post it here

How then can one calculate p-values for fold change if it is based on average

• I think you mean three replicates. – SmallChess Aug 18 '16 at 13:21
• @Student T yes I mean – Nik Bernou Aug 18 '16 at 13:23
• Cross posted in Biology.SE. @NikBernou Do not cross post on two sites. If you think one site is better then delete the question in the other site. – WYSIWYG Aug 18 '16 at 13:32
• @WYSIWYG I know he cross-posted. Anyway, please review my answer. Inspired by your idea of t-test in the other post. – SmallChess Aug 18 '16 at 13:36

2:) makes no sense to me. You would only do a t-test between control/treated if you want to test for difference in the sample means, but not for calculating the fold-change.

Fold change is typically calculated by simply average of group 2/ average of group 1. I'll give you a proof, in http://seqanswers.com/forums/showthread.php?t=49101, the author of DESeq2 wrote:

(average in group2)/(average in group1)

The question is why would you want to do this? There are good Bioconductor packages that can do that for you. For example, DESeq2 applies shrinkage methods to the fold-changes. Raw fold-change is not informative in bioinformatic statistical analysis, because it doesn't address the expression level (and variance) of the gene. Highly and lowly expressed genes can give you the same fold-change, and you don't want this to happen.

• thank you so much. actually it has been hour and hour I was trying to explain what i want. this gives me the right path. I am more interested in doing it by myself than clicking on package looks a bit black box. is it possible to give me an explanation about for example how then they calculate p-value for this fold change? do you know? – Nik Bernou Aug 18 '16 at 13:42
• @NikBernou I kind of know. But can you please accept the answer if it helps and then start a new question? This will show your appreciation and people will be able to help you more. – SmallChess Aug 18 '16 at 13:43
• @NikBernou I think you will be better off using the highly developed, sophisticated packages like DESeq2, and devoting some effort to understanding what such "black boxes" actually do. Trying to re-invent such programs is fraught with difficulty and prone to error. You can also examine the code to see how the authors of the program deal with matters like p-values. – EdM Aug 18 '16 at 13:52
• @EdM I agree but it is difficult to go through a package when you did not write it. most of the documentation are lacking , so understating what is what is really pain. I agree that such packages are built for those who have no programming knowledge and that si why I am trying to make something myself which I understand it fully. For example can you tell me why DESeq2 is working on count values and not continuous ? you see, it is a black box – Nik Bernou Aug 18 '16 at 13:55
• @EdM calculating fold change is not a difficult calculation. DESeq2 is meant for a specific kind of data. It is not a general statistical tool. And, it is always good to know the underlying statistics/math instead of simply clicking some buttons. – WYSIWYG Aug 18 '16 at 14:20