This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error when adjusting p-values in R

Hello. I'm trying to ajust the pvalues from the file I've got from Deseq2. But I keep getting error mesages:

p.adjust(dds, method = "bonferroni") Error in as.vector(x, mode = "numeric") : no method to coerce this S4 class to vector

Then I tried to leave only the gene ids and the pvalue. But I got another error mesage:

p.adjust(pvalue, method = "bonferroni") Error in p.adjust(pvalue, method = "bonferroni") : 'list' object cannot be coerced to type 'double'

Is there something wrong with my data? What can I do to solve this?

Thanks in advance.

pvalue deseq2 bonferroni

2 answers

You need just a vector of p-values. Note that DESeq2 will use a much better adjustment method than Bonferroni by default.

DESeq2 output, so the output of results() or lfcShrink()) should contain a column pvalue which is the nominal/raw/"uncorrected" pvalues, and padj which contains the FDR-corrected (Benjamini-Holm method) pvalues, so yes, padj is already corrected and there is nothing you need (and should) to do manually. In fact, the independent filtering procedure (see paper and manual/vignette) will do a good job at removing genes with low power to maximize the number of significant genes so the multiple testing burden for the surviving genes gets smaller. In other words, it is a smart method that will do some good magic under the hood, much better than doing this yourself without experts knowledge. That is not a pun against you, rather always advisable for any analyst to follow the workflow of expert software such as DESeq2 rather than coming up with custom approaches unless you really know what you're doing.

Please see https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html

It contains all code for a differential analysis.

See also StatQuest for further (excellent) information:

Log in to answer this question.