This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate LogFC? [gene expression matrix]?

Hi! I need to calculate LogFC for gene expression matrix (for two condition). First I calculated fold change:

FC = mean(experiment) / mean(control) 

Taking into consideration that I firstly standardized gene expression matrix, so I have mean values less than 0. So how can I calculate log2? To be sure, LogFC is calculated in this way:

log2FC = log2(experiment.mean()) - math.log2(control.mean())

I can not take log2 form number less than 0. Kindly help.

gene expression logfc

2 answers

As pointed out by ATpoint it is best to use a tool that can handle these cases.

But even those can run into trouble.

Usually what needs to be done is to remove data where there is reason to believe that the ratios do not make sense, for example dividing a tiny number with another tinier number can create huge fold changes that may not valid - perhaps both of those tiny numbers are random noise. So a minimal expression level should be needed before you proceed to compute a fold change.

You can also run into trouble when dividing with zero (or close to zero) (the control does not change).

filter out data that does not make sense, in some cases people choose to add 1 to both numerator and denominator as a correction but that too can lead to other problems. It is more of a correction against runaway division where at least one side has a valid count.

Is this RNA-seq? Load it into DESeq2 to get proper fold changes. Manual is over at Bioconductor. It is not the naive quotient of the counts or means.

Log in to answer this question.