% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ORA_hypergeometric.R
\name{ORA_hypergeometric}
\alias{ORA_hypergeometric}
\title{OverRepresentationAnalysis with a hypergeometric model}
\usage{
ORA_hypergeometric(
  background,
  annotations,
  data,
  tested_column = "middle_hierarchy"
)
}
\arguments{
\item{background}{dataframe that contains
KEGG IDs of metabolites that are assigned to functional modules, is incorporated
in the package \link{modules_compounds}}

\item{annotations}{dataframe tha contains information to which functional
modules our experimental metabolites are annotated in KEGG, can be constructed
by filtering the provided KEGG background \link{modules_compounds} for the experimental
metabolites}

\item{data}{dataframe containing columns "KEGG" specifying the KEGG
identifiers of metabolites, "cluster" specifying the cluster ID of metabolites and a
column specifying the experimental condition called "condition" or if data
is a SummarizedExperiment or a \link[SummarizedExperiment]{SummarizedExperiment} clustering
solution must be stored in metadata(data)
under "cluster"}

\item{tested_column}{column that is in background and annotations and on
which the hypergeometric model will be executed}
}
\value{
a dataframe containing the ORA results or if data is SummarizedExperiment \link[SummarizedExperiment]{SummarizedExperiment}
object the output is stored in metadata(data) under "ORA_tested_column"
}
\description{
Testing the hypothesis that certain KEGG modules are over-represented in
clusters of metabolites.
A module is considered over-represented in a cluster the number of
metabolites in a cluster being annotated to a functional module (n_obs)
is higher than the expected number of metabolites in a cluster of this size
being annotated to a functional module (n_theo).
We can calculate the OvE (Observed versus Expected = n_obs/n_theo) and show the
probabilities of these ratios.
log(p(OvE))>0 indicates an over-representation of the functional module in
the cluster, log(p(OvE))<0 an under-representation.
}
\examples{
data("longitudinalMetabolomics")
data("modules_compounds")
head(modules_compounds)
data("metabolite_modules")
head(metabolite_modules)
# middly hierachy
longitudinalMetabolomics <- ORA_hypergeometric(
  data = longitudinalMetabolomics,
  annotations = metabolite_modules,
  background = modules_compounds,
  tested_column = "middle_hierarchy"
)
S4Vectors::metadata(longitudinalMetabolomics)[["ORA_middle_hierarchy"]]

}
\seealso{
Function to visualize ORA results \code{\link[=plot_ORA]{plot_ORA()}}
}
