countEnrichedDepletedGenes: Count Enriched and Depleted Genes

View source: R/Seurat.Utils.Visualization.R

countEnrichedDepletedGenesR Documentation

Count Enriched and Depleted Genes

Description

This function counts the number of significantly enriched and depleted genes based on the provided criteria. It filters the genes based on adjusted p-value and logarithm of fold change.

Usage

countEnrichedDepletedGenes(
  df,
  min_padj = 0.01,
  min_logFC = 0.5,
  colname.p = "p_val_adj",
  colname.lFC = "avg_log2FC"
)

Arguments

df

A dataframe containing the result of the differential gene expression analysis.

min_padj

A numeric value specifying the minimum adjusted p-value. Default: 0.01.

min_logFC

A numeric value specifying the minimum logarithm to fold change. Default: 0.5. This value should be positive and will be used as a negative value for depleted genes.

colname.p

A string specifying the column name for the adjusted p-value in the dataframe. Default: 'p_val_adj'.

colname.lFC

A string specifying the column name for the logarithm to fold change in the dataframe. Default: 'avg_log2FC'.

Value

A list of two elements:

GeneCounts

A named numeric vector containing the numbers of enriched and depleted genes.

Parameters

A named numeric vector containing the parameter names and their values.

Examples

df <- data.frame(
  p_val = c(5.580902e-14, 4.607790e-12, 1.643436e-11),
  avg_log2FC = c(0.4985875, 0.4983416, 0.4977825),
  pct.1 = c(0.429, 0.575, 0.387),
  pct.2 = c(0.251, 0.396, 0.232),
  p_val_adj = c(1.091513e-09, 9.011916e-08, 3.214233e-07)
)
result <- countEnrichedDepletedGenes(df)
print(result)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.