| cyt_volc | R Documentation |
This function subsets the numeric columns from the input data and compares them based on a selected grouping column. It computes the fold changes (as the ratio of means) and associated p-values for each numeric variable between two groups. The results are log2-transformed (for fold change) and -log10-transformed (for p-values) to generate a volcano plot. Additionally, there is a choice between t‑tests and Wilcoxon rank‑sum tests and adjusting p‑values for multiple comparisons.
cyt_volc(
data,
group_col,
cond1 = NULL,
cond2 = NULL,
fold_change_thresh = 2,
p_value_thresh = 0.05,
top_labels = 10,
method = c("ttest", "wilcox"),
p_adjust_method = NULL,
add_effect = FALSE,
verbose = FALSE
)
data |
A data frame containing numeric variables and a grouping column. |
group_col |
Character. Name of the grouping column. |
cond1 |
Character string specifying the level of |
cond2 |
Character strings specifying the second level of
|
fold_change_thresh |
Numeric. Threshold for absolute fold change (in original scale). Default is 2. |
p_value_thresh |
Numeric. Threshold for the p‑value (raw or adjusted). Default is 0.05. |
top_labels |
Integer. Number of top points to label in each plot. Default is 10. |
method |
Character. Statistical test to use. "ttest" (default) uses two‑sample t‑tests; "wilcox" uses Wilcoxon rank‑sum tests. |
p_adjust_method |
Character or |
add_effect |
Logical. If |
verbose |
Logical. If |
A list of ggplot objects (one per comparison). Each plot
visualizes log2 fold change on the x‑axis and –log10 of the
(adjusted) p‑value on the y‑axis. The underlying data used to
construct the final plot are printed when verbose = TRUE.
If cond1 and cond2 are not provided, the function
automatically generates all possible pairwise combinations of groups from
the specified group_col for comparisons.
Xiaohua Douglas Zhang and Shubh Saraswat
# Loading data
data_df <- ExampleData1[,-c(2:3)]
cyt_volc(data_df, "Group", cond1 = "T2D", cond2 = "ND", fold_change_thresh = 2.0, top_labels= 15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.