
Calculate fold change
gly_fold_change.Rd
Calculate fold change for a given expression matrix and group information. It could only be used for 2-group analysis. When you run this function, you will see message about "Group 1" and "Group 2". "Group 1" is the reference group, and "Group 2" is the test group.
Arguments
- exp
A
glyexp::experiment()
object.- group_col
The column name of the group information in the sample information.
- add_info
A logical value. If TRUE (default), variable information from the experiment will be added to the result tibble. If FALSE, only the fold change results are returned. Only applicable to
gly_fold_change()
.- expr_mat
A numeric matrix with variables as rows and samples as columns.
- groups
A factor or character vector specifying group membership for each sample. Must have exactly 2 levels. Character vectors will be automatically converted to factors.
Value
A tibble with fold change results containing the following columns:
variable
: Variable namelog2fc
: Log2 fold change (log2(group2_mean / group1_mean))
Details
gly_fold_change()
is the top-level API that works with glyexp::experiment()
objects and supports
the add_info
parameter for joining experiment metadata.
gly_fold_change_()
is the underlying API that works with matrices and factor vectors directly,
providing more flexibility for users who don't use the glyexp package.