analyze_component_scores: Analyze Differences in Component Scores Across Groups

View source: R/Visualizations_SDA.R

analyze_component_scoresR Documentation

Analyze Differences in Component Scores Across Groups

Description

This function performs statistical comparisons between groups for a given component in the scores matrix, using parametric (ANOVA/t-test) or non-parametric (Kruskal-Wallis/Wilcoxon) tests.

Usage

analyze_component_scores(
  scores_matrix,
  meta_df,
  component,
  meta_feature,
  verbose = TRUE
)

Arguments

scores_matrix

A numeric matrix where rows are samples and columns are components.

meta_df

A data frame with rownames matching 'scores_matrix', containing metadata.

component

Character. The component column (e.g., '"Component_1"') to analyze.

meta_feature

Character. The metadata column to group by (e.g., '"seqrun"').

verbose

Logical. Whether to print test results (default: TRUE).

Value

A list containing:

summary_stats

A summary table with mean, median, variance per group.

test_result

Results of ANOVA/Kruskal-Wallis or t-test/Wilcoxon.

Examples

## Not run: 
analyze_component_scores(scores_matrix = results$scores, 
                         meta_df = MetaDF, 
                         component = "Component_1", 
                         meta_feature = "seqrun")

## End(Not run)

eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.