combat_plot_gen | R Documentation |
This function generates a variety of diagnostic plots for analyzing batch effects and their relationships with features and covariates. Depending on the specified plot type, it can create density plots, box plots, residual plots, PCA plots, T-SNE plots, and empirical Bayes diagnostic plots.
combat_plot_gen(
result,
f = NULL,
batch_control = "No",
batch_level = NULL,
plot_name,
c = NULL,
smooth_method = "lm",
alpha = 0.2,
char_plot_type = "boxplot",
text_status = "No",
color = "No",
label = "No",
angle = 0,
PC1 = NULL,
PC2 = NULL,
eb = TRUE,
eb_df = NULL
)
result |
A list derived from |
f |
A string specifying the feature of interest for visualization. |
batch_control |
A string indicating whether to include batch-specific controls. Defaults to |
batch_level |
A vector specifying the batch levels to include in the plot. Used only when |
plot_name |
A string specifying the type of plot to generate. Options include |
c |
A string specifying the covariate of interest for |
smooth_method |
A string specifying the smoothing method for trend lines. Defaults to |
alpha |
A numeric value between 0 and 1 controlling the transparency of trend lines. Defaults to |
char_plot_type |
A string specifying the type of plot for categorical covariates. Options include |
text_status |
A string indicating whether to display text annotations in the plot. Defaults to |
color |
A string indicating whether to use color coding in plots. Defaults to |
label |
A string indicating whether to include axis labels in the plot. Defaults to |
angle |
A numeric value specifying the angle of x-axis labels. Defaults to |
PC1 |
A string specifying the first principal component for PCA plots. |
PC2 |
A string specifying the second principal component for PCA plots. |
eb |
A logical value indicating whether to include empirical Bayes prior information in the plot. Defaults to |
eb_df |
A data frame containing empirical Bayes information for generating |
The function dynamically generates plots based on the plot_name
parameter:
"batch_density"
: Density plots of features by batch levels.
"cov_feature"
: Covariate vs. feature plots with optional batch adjustments.
"batch_summary"
: Bar plots summarizing batch-level distributions.
"cov_distribution"
: Covariate distributions stratified by batch.
"resid_add"
: Additive residual box plots.
"resid_mul"
: Multiplicative residual box plots.
"pca"
: Principal Component Analysis (PCA) plots.
"tsne"
: T-SNE plots for dimensionality reduction.
"eb_location"
: Empirical Bayes location parameter density plots.
"eb_scale"
: Empirical Bayes scale parameter density plots.
A ggplot object representing the specified diagnostic plot.
if(interactive()){
result <- visual_prep(type = "lm", features = "thickness.left.cuneus",
batch = "manufac", covariates = "AGE", df = adni[1:100, ], mdmr = FALSE, cores = 1)
combat_plot_gen(result, f = "thickness.left.cuneus", plot_name = "batch_density")
combat_plot_gen(result, f = "thickness.left.cuneus", c = "AGE", plot_name = "cov_feature")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.