
Helper function to calculate abundance statistics for differential analysis
Source:R/pathway_daa.R
calculate_abundance_stats.RdThis function calculates mean relative abundance, standard deviation, and log2 fold change for each feature between two groups.
Arguments
- abundance
A matrix or data frame with features as rows and samples as columns
- metadata
A data frame containing sample information
- group
Character string specifying the group column name in metadata
- features
Character vector of feature names to calculate statistics for
- group1
Character string specifying the first group name
- group2
Character string specifying the second group name
Value
A data frame with columns:
- feature
Feature identifier
- mean_rel_abundance_group1
Mean relative abundance for group1
- sd_rel_abundance_group1
Standard deviation of relative abundance for group1
- mean_rel_abundance_group2
Mean relative abundance for group2
- sd_rel_abundance_group2
Standard deviation of relative abundance for group2
- log2_fold_change
Log2 fold change (group2/group1)