R/visualization-functions.R
correlate_and_plot.Rd
Identify covariates that significantly, as defined by a false discovery rate (FDR) threshold, correlate with PCs computed from gene counts. This function wraps `plot_pcs_with_covariates()` to return a heatmap to visualize this relationship.
correlate_and_plot(
principal_components,
clean_metadata,
correlation_type,
weights = NULL,
to_plot = FALSE,
exclude_missing_data = NULL,
maximum_fdr = 0.1
)
Center, scaled and rotated principal components matrix.
A data frame with sample identifiers as rownames and variables as
factors or numeric as determined by "sageseqr::clean_covariates()"
.
Allowed values are "pearson", "spearman" and
"kendall". See "psych::corr.test(method)"
.
A numeric vector of the proportion of variance explained (PVE). Defaults to NULL.
Logical indicating whether correlation values should be plotted. Defaults to FALSE.
A vector with column names to exclude from `clean_metadata`.
Maximum allowable false discovery rate (FDR). Defaults to 0.1.
A list.
plot - A customized heatmap of significant covariates and PCs correlated.
significant_covariates - A vector of covariates where correlation p-value meets the FDR threshold.
effects_significant_vars - A vector correlation values.