Skip to contents

Perform a generic conservation test by comparing observed TXI patterns against a null distribution generated by permutation.

Usage

stat_generic_conservation_test(
  phyex_set,
  test_name,
  scoring_function,
  fitting_dist,
  alternative = c("two-sided", "greater", "less"),
  p_label = p_label,
  custom_null_txis = NULL,
  plot_result = TRUE
)

Arguments

phyex_set

A PhyloExpressionSet object

test_name

Character string naming the test

scoring_function

Function to compute test statistic from TXI profile

fitting_dist

Distribution object for fitting the null distribution

alternative

Character string specifying alternative hypothesis: "two-sided", "greater", or "less" (default: "two-sided")

p_label

Label for p-value in results (default: p_label)

custom_null_txis

Optional custom null TXI distribution (default: NULL)

plot_result

Logical indicating whether to plot results (default: TRUE)

Value

A ConservationTestResult object containing test statistics and p-values

Details

This function provides a generic framework for conservation testing by: 1. Generating null TXI distributions via permutation 2. Computing test statistics using the provided scoring function 3. Fitting the specified distribution to the null sample 4. Computing p-values based on the alternative hypothesis

Examples

# Perform a custom conservation test
# result <- stat_generic_conservation_test(phyex_set, 
#                                    test_name = "Custom Test",
#                                    scoring_function = var,
#                                    fitting_dist = distributions$gamma)