Skip to contents

Visualize GO enrichment test result in dot plot

Usage

plotGODot(
  result,
  group = NULL,
  query = c("Up", "Down"),
  pvalThresh = 0.05,
  n = 20,
  termIDMatch = "^GO",
  colorPalette = "E",
  colorDirection = 1,
  xlab = "-log10(P-value)",
  ylab = "Term name",
  ...
)

Arguments

result

Returned list object from runGOEnrich.

group

Character vector of group names, must be available in names(result). Default NULL make plots for all groups.

query

A single string selecting from which query to show the result. Choose from "Up" for results using up-regulated genes, "Down" for down-regulated genes. Default "Up".

pvalThresh

Numeric scalar, cutoff for p-value where smaller values are considered as significant. Default 0.05.

n

Number of top terms to be shown, ranked by p-value. Default 20.

termIDMatch

Regular expression pattern to match the term ID. Default "^GO" for only using GO terms from returned results.

colorPalette, colorDirection

Viridis palette options. Default "E" and 1.

xlab, ylab

Axis title for x and y axis. Default "-log10(P-value)" and "Term name", respectively.

...

Arguments passed on to .ggplotLigerTheme

legendColorTitle

Legend title text for color aesthetics, often used for categorical or continuous coloring of dots. Default NULL shows the original variable name.

legendSizeTitle

Legend title text for size aesthetics, often used for sizing dots by continuous variable. Default NULL shows the original variable name.

showLegend

Whether to show the legend. Default TRUE.

legendPosition

Text indicating where to place the legend. Choose from "top", "bottom", "left" or "right". Default "right".

baseSize

One-parameter control of all text sizes. Individual text element sizes can be controlled by other size arguments. "Title" sizes are 2 points larger than "text" sizes when being controlled by this.

titleSize,xTitleSize,yTitleSize,legendTitleSize

Size of main title, axis titles and legend title. Default NULL controls by baseSize + 2.

subtitleSize,xTextSize,yTextSize,legendTextSize

Size of subtitle text, axis texts and legend text. Default NULL controls by baseSize.

plotly

Whether to use plotly to enable web based interactive browsing for the plot. Requires installation of package "plotly". Default FALSE.

Value

A ggplot object if only one group or a list of ggplot objects.

Examples

# \donttest{
defaultCluster(pbmc) <- pbmcPlot$leiden_cluster
#>  Storing given cluster labels to `cellMeta(x)` field: "defaultCluster".
# Test the DEG between "stim" and "ctrl", within each cluster
result <- runPairwiseDEG(
    pbmc,
    groupTest = "stim",
    groupCtrl = "ctrl",
    variable1 = "dataset",
    splitBy = "defaultCluster"
)
#>  Running DEG within: "0"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "1"
#>  Calling pairwise DESeq2 Wald test
#> -- note: fitType='parametric', but the dispersion trend was not well captured by the
#>    function: y = a/x + b, and a local regression fit was automatically substituted.
#>    specify fitType='local' or 'mean' to avoid this message next time.
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "2"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "3"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "4"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "5"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "6"
#>  Calling pairwise DESeq2 Wald test
#>  Calling pairwise DESeq2 Wald test ... done
#> 
#>  Running DEG within: "7"
#>  Calling pairwise DESeq2 Wald test
#> ! Ignoring replicates (size in bracket) with too few cells: "others.ctrl.rep1 (2)"
#>  Calling pairwise DESeq2 Wald test

#>  Consider decrease minCellPerRep to exclude less replicates or/and lower nPsdRep to generate larger pseudo-replicates.
#>  Calling pairwise DESeq2 Wald test

#>  Error when computing on "7.stim": Too few replicates with more than 3 cells (`minCellPerRep`) for condition "others".
#>  Calling pairwise DESeq2 Wald test

#> ! Empty result returned for this test.
#>  Calling pairwise DESeq2 Wald test

#>  Calling pairwise DESeq2 Wald test ... failed
#> 
# Setting `significant = FALSE` because it's hard for a gene list obtained
# from small test dataset to represent real-life biology.
if (requireNamespace("gprofiler2", quietly = TRUE)) {
    go <- runGOEnrich(result, group = "0.stim", splitReg = TRUE, significant = FALSE)
    # The toy example won't have significant result.
    plotGODot(go)
}
#> ! No enough matching terms (termIDMatch) nor significant terms (p-value <= 0.05) for group "0.stim".
#> list()
# }