dge_PlotGOHeatmap: Plot all significant genes in a heatmap, with GO-annotated...

View source: R/dge_PlotGOHeatmap.R

dge_PlotGOHeatmapR Documentation

Plot all significant genes in a heatmap, with GO-annotated clusters

Description

This function takes the output from dge_OneFactor, finds all significant genes in all comparisons, and then runs GO term enrichment and annotates a heatmap with cluster-specific GO enrichments.

Usage

dge_PlotGOHeatmap(
  dgeRes,
  genePVal,
  geneID,
  nClusters,
  convertMatrix = FALSE,
  returnFullGO = FALSE,
  ...
)

Arguments

dgeRes

List, output of dge_OneFactor. Note that this must contain a DGEList object!

genePVal

PValue cutoff for identifying a gene as significant. Advise 0.1 since the GO term enrichment is robust to false positives in this approach, and works better with a larger pool of genes to draw on.

geneID

The column in dgeRes that contains the gene IDs. Usually Newid if name conversion was done and GeneID if not.

nClusters

Number of clusters to use for unsupervised k-medoid clustering. Needs to be data-driven, so try something in the 5-10 range and then re-run if necessary to get the number that best fits your data. Can also map this if you like but the k-medoids algorithm is slow so it'll take a while.

convertMatrix

Boolean, should the matrix gene IDs be converted? See dge_GetMatrix for more.

returnFullGO

Boolean. If FALSE (default), only plots the heatmap. If true, returns a list containing the ggplot (which you can plot yourself), plus the intermediate data that shows the clusters and the genes contributing to the enriched GO terms.

...

Additional arguments to pass to convertBiomart (i.e. convert_from and convert_to). See convertBiomart for more.

Details

This strategy is designed to reduce the implicit bias GO analysis has if you use "the whole genome" as your gene universe. Since the cells you are comparing come from the same tissue, any false positive genes (i.e. 5-10% of your significant list) are likely to be cell type/tissue relevant, and so are likely to enrich for "relevant" looking GO terms. This approach instead uses GO terms only to annotate clusters of similarly-expressed genes, using only all significant genes as the gene universe.

Value

A ggplot heatmap of all significant genes, clustered, and annotated with cluster-specific GO enrichments.

Examples

dgeRes_full<- system.file("extdata", "dgeRes_full.Rds",
                      package = "seqHelpers") |>
    readRDS()

## Not run: 
dge_PlotGOHeatmap(dgeRes_full, genePVal = 0.1, geneID = Newid, nClusters = 2, convertMatrix = TRUE)

## End(Not run)


NKInstinct/seqHelpers documentation built on Aug. 20, 2022, 4:30 a.m.