cluster_enrichment: cluster_enrichment

View source: R/cluster_enrichment.R

cluster_enrichmentR Documentation

cluster_enrichment

Description

Cluster enrichment Run enrichment (Fisher's exact) on clusters (lists of identifier groups)

Usage

cluster_enrichment(geneset, clusters, background = NA, sigfilter = 0.05)

Arguments

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

Details

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.

Value

data frame with enrichment results

Examples

        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))
        



biodataganache/leapR documentation built on July 16, 2025, 11:10 p.m.