screen_components_by_metadata: Screen All Components for Differences by Metadata Feature

View source: R/Visualizations_SDA.R

screen_components_by_metadataR Documentation

Screen All Components for Differences by Metadata Feature

Description

This function systematically analyzes all components in a score matrix, testing their differences across a specified metadata feature. Components are ranked by statistical significance.

Usage

screen_components_by_metadata(
  scores_matrix,
  meta_df,
  meta_feature,
  top_n = 5,
  method = "auto"
)

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.

meta_feature

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

top_n

Integer. Number of top components to visualize (default: 5).

method

Character. Statistical test to use ('"anova"' for normal data, '"kruskal"' for non-parametric, default: '"auto"').

Value

A list with:

ranked_results

A dataframe ranking components by significance (p-values & effect sizes).

plots

A list of ggplot objects for top components.

Examples

## Not run: 
screen_results <- screen_components_by_metadata(scores_matrix = results$scores, 
                                                meta_df = MetaDF, 
                                                meta_feature = "seqrun")
print(screen_results$ranked_results) # Ranked table of components
screen_results$plots[[1]]  # View first plot

## End(Not run)

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