% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/run_topGO.R
\name{run.topGO}
\alias{run.topGO}
\title{Function to run GO term enrichment analysis using the 'topGO' package.}
\usage{
run.topGO(
  background,
  foreground,
  ontologies = c("BP"),
  organism,
  ID_type = "ENSEMBL",
  pAdjustMethod = "BH"
)
}
\arguments{
\item{background}{path to the background set of genes}

\item{foreground}{path to the foreground set of genes}

\item{ontologies}{character string specifying the ontology of interest (BP,MF,CC), default = "BP"}

\item{organism}{the organism database used, eg. for Human: "org.Hs.eg.db"}

\item{ID_type}{character; the type of gene ID used in the input data, default = "ENSEMBL"}

\item{pAdjustMethod}{character; the method used for p-value adjustment, default = "BH"}
}
\value{
A data frame with enriched terms and p-values from Fisher's exact test, using different algorithms: elim, classic, weight01.
}
\description{
Function to run GO term enrichment analysis using the 'topGO' package.
}
\details{
The columns in the final table produced by topGO (their description is fetched from topGo documentation):
  - Annotated : number of genes in org.Hs.eg.db which are annotated with the GO-term.
  - Significant : number of genes belonging to your input which are annotated with the GO-term.
  - Expected : show an estimate of the number of genes a node of size Annotated would have if the significant genes were to be randomly selected from the gene universe.
  - pvalues : pvalue obtained after the test

Column 'p.adj.weight01' represents the adjusted p-value for the weight01 algorithm.
}
\examples{
\donttest{
# needs org.Hs.eg.db; builds a genome-wide GO universe, so it is slow
if (requireNamespace("topGO", quietly = TRUE) &&
    requireNamespace("org.Hs.eg.db", quietly = TRUE) &&
    requireNamespace("AnnotationDbi", quietly = TRUE)) {
  fg <- c("ENSG00000141510", "ENSG00000012048", "ENSG00000139618")
  # a small background keeps the example quick; a real analysis uses the full gene universe,
  # e.g. AnnotationDbi::keys(org.Hs.eg.db::org.Hs.eg.db, keytype = "ENSEMBL")
  bg <- unique(c(fg, utils::head(
    AnnotationDbi::keys(org.Hs.eg.db::org.Hs.eg.db, keytype = "ENSEMBL"), 2000)))
  go <- tryCatch(run.topGO(background = bg, foreground = fg, ontologies = "BP",
                           organism = "org.Hs.eg.db", ID_type = "ENSEMBL"),
                 error = function(e) {
                   message("topGO enrichment could not be run: ", conditionMessage(e))
                   NULL
                 })
}
}
}
\author{
Bogdan Iancu - Genevia Technologies Oy
}
