View source: R/cluster_enrichment.R
cluster_enrichment | R Documentation |
Cluster enrichment Run enrichment (Fisher's exact) on clusters (lists of identifier groups)
cluster_enrichment(geneset, clusters, background = NA, sigfilter = 0.05)
geneset |
is a GeneSet object for pathway annotation |
clusters |
is a list of clusters (gene lists) to calculate enrichment on, generally the result of the 'cuttree' function |
background |
is a list of genes to serve as the background for enrichment |
sigfilter |
minimum significance threshold default is .05 |
This function will calculate enrichment (Fisher's exact test for membership overlap) on
a series of lists of genes, such as from a set of clusters. The results are returned as
a list of results matrices in the order of the input clusters.
data frame with enrichment results
library(leapR)
# read in the example transcriptomic data
tdata <- download.file("https://figshare.com/ndownloader/files/55781153",method='libcurl',destfile='transData.rda')
load('transData.rda')
p <- file.remove("transData.rda")
# read in the pathways
data("ncipid")
# for the example we will limit the number of transcripts considered - arbitrarily in this case
transdata = Biobase::exprs(tset)
transdata[which(is.na(transdata),arr.ind=TRUE)]<-0.0
# perform heirarchical clustering on the data
transdata.hc = hclust(dist(transdata), method="ward.D2")
transdata.hc.clusters = cutree(transdata.hc, k=5)
clust.list <- lapply(c(1:5), function(x) return(names(which(transdata.hc.clusters==x))))
#calculates enrichment for each of the clusters individually and returns a list
# of enrichment results
transdata.hc.enrichment = leapR::cluster_enrichment(geneset=ncipid, clusters=clust.list, background=rownames(transdata))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.