Open agriswold76 opened 2 months ago
AFAIK there is no build-in option to do this.
Yet, since the output of dotplot
is a ggplot2
-object, it is relatively easy to tweak the resulting plot.
For example, if you would like to have: a) the color ranging from 0 to 0.5, b) with a break at 0.25, c) and using a color-gradient from green-white-red, d) together with a new label ("adjusted p-values") for the legend,
you could do/add this to p1
(= the 'original' output from dotplot
):
p2 <- p1 + scale_fill_gradientn(name = "adjusted p-values",
colours = c("green", "white", "red"),
limits= c(0, 0.5),
breaks=c(0, 0.25, 0.5) )
Full code chunk:
> library(clusterProfiler)
> library(enrichplot)
> library(ggplot2)
> library(org.Hs.eg.db)
>
> data(geneList, package="DOSE")
> genes <- names(geneList)[abs(geneList) > 2]
>
>
> ego <- enrichGO(gene = genes,
+ universe = names(geneList),
+ OrgDb = org.Hs.eg.db,
+ ont = "ALL",
+ pAdjustMethod = "BH",
+ pvalueCutoff = 0.01,
+ qvalueCutoff = 0.05,
+ readable = TRUE)
>
> p1 <- dotplot(ego)
> print(p1)
>
> ## customize plot
> p2 <- p1 + scale_fill_gradientn(name = "adjusted p-values",
+ colours = c("green", "white", "red"),
+ limits= c(0, 0.5),
+ breaks=c(0, 0.25, 0.5) )
Scale for fill is already present.
Adding another scale for fill, which will replace the existing scale.
> print(p2)
>
I think p-values colour scale should be discrete by default (significant or not). In statistics, a p-value is used to reject a null hypothesis or not. If a p-value is smaller than the threshold value, the test is significant because the null hypothesis is rejected. If it is bigger than the threshold, it is not significant. There should not be a colour scale ranging from blue to red with a numeric range such as 0.001 to 0.01 because it encourages people to say "significant" and "very significant", which is not right.
color: variable that used to color enriched terms, e.g. 'pvalue', 'p.adjust' or 'qvalue'
This should have a value isSignif
and be the default to be more statistically rigorous.
Running simple dotplot on enrichGO object. Plot is generally fine, but want to range the p.adjust from 0 to 1 (at present it seems to only scale from the highest and lowest p.adjust of the categories being used). Is there a parameter or option to make the range go from 0 to 1? Thanks for any help