I have a dataset with gene Id, gene name, log2 fold change and raw p-value. How to find the BH adjusted p-value for each gene? and How can I find how many have expression was upregulated by treatment by at least 2-fold from the adjusted p-value.The p-value is in column 4 and log2 fold change is in column 3.

  • $\begingroup$ The title says the p-values are already adjusted, but the question says the dataset includes the raw p-value. Do you mean that the p-values in the dataset have already been adjusted? $\endgroup$ Apr 23, 2020 at 19:31

1 Answer 1


Assuming you are dealing with raw p-values like your question states, you can use the p.adjust function in R, which can compute adjusted p-values for a wide variety of correction measures.

I would create a new column called padj using p.adjust and then filter to only include genes with a log2FC greater than 2 and padj below your desired alpha threshold.

Using R, here is code that computes BH adjusted p-values and then filters based on your criteria. Note that df would be your dataframe

alpha <- .05

diffexp <- df %>%
   mutate(padj = p.adjust(pvalue, method="BH")) %>%
   filter(log2FC > 0, padj < alpha)
  • $\begingroup$ Can you please explain the purpose of choosing log2 fold change greater than 2? $\endgroup$
    – Lily
    Apr 23, 2020 at 20:53
  • $\begingroup$ I interpreted your question as 2 fold from log2 fold change although now I see you said from adjusted p-value. I'm not sure exactly what you mean by "at least 2-fold from the adjusted p-value". Could you elaborate? In my field it is common to filter for genes with padj < .05 and absolute value of log2FC > 2 to prioritize genes with large differential expression and significant evidence to back up the fold change $\endgroup$ Apr 23, 2020 at 21:04
  • $\begingroup$ Sorry for the confusion. I have a dataset which has the values for the log2 fold change from that dataset I want to see the genes those were upregulated due to treatment. Which I want to see after adjusting the p-values. I am not being able to figure out how to do that in R. Thank you. $\endgroup$
    – Lily
    Apr 23, 2020 at 21:33
  • $\begingroup$ I've updated my code to now include any genes that are upregulated and considered significant at padj < .05. Note this code assumes the non-treatment group was coded as the reference level so that the log2FoldChange values are for the treatment group compared to non-treatment. $\endgroup$ Apr 23, 2020 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.