Skip to contents

Calculate log2(observed/expected) enrichment ratios for phylostrata in a selected gene set compared to the background distribution.

Usage

strata_enrichment(strata, selected_gene_ids)

Arguments

strata

Named factor vector of phylostratum assignments (names are gene IDs)

selected_gene_ids

Character vector of gene IDs to test for enrichment

Value

A data frame with columns:

Stratum

Phylostratum factor levels

log_obs_exp

Log2 ratio of observed vs expected proportions

Details

This function calculates enrichment or depletion of phylostrata in a gene set by comparing the observed proportion of each stratum in the selected genes to the expected proportion based on the background distribution in all genes.

Positive values indicate enrichment (more genes than expected), while negative values indicate depletion (fewer genes than expected).

Examples

# Calculate enrichment for a gene set
# enrichment <- strata_enrichment(phyex_set@strata, my_gene_set)
# print(enrichment)