% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/functions_single_cell.R
\name{component_enrichment}
\alias{component_enrichment}
\title{Calculate enrichment for a set of genes for each component}
\usage{
component_enrichment(genes, threshold = 500,
  loadings_matrix = SDAresults$loadings[[1]], orderSDA = T,
  bg_genes = NULL, test = "fisher")
}
\arguments{
\item{genes}{character vector of gene set to look for enrichment for}

\item{threshold}{numeric; how many genes should be included in the top genes list used to calculate enrichment}

\item{bg_genes}{which genes to use as the 'background' default uses all genes in the SDAresults object from SDA}

\item{test}{string, either binomial (from Exact::exact.test, slow) or fisher (R's fisher.test)}

\item{factorisation}{SDA factorisation object, output of SDAtools::load_results()}
}
\value{
A data.table with a row for each component (+ve & -ve seperately) with columns giving the p.value of enrichment,
Odds Ratio, Component number and name, component type (Somatic or Meiotic), and component order
}
\description{
Calculate enrichment for a set of genes for each component
}
\details{
for each component (P&N seperately), calculate p value enrichemnt (fishers test) for a set of genes
This is a multi-component wrapper to AZ_pvalue
requires the SDAresults object from SDA to be loaded as well as the component_order_all object from 'R/functions_ordering.R'
}
