correlate_factors_with_covariates: Plot correlation of factors with external covariates

View source: R/correlate_covariates.R

correlate_factors_with_covariatesR Documentation

Plot correlation of factors with external covariates

Description

Function to correlate factor values with external covariates.

Usage

correlate_factors_with_covariates(
  object,
  covariates,
  factors = "all",
  groups = "all",
  abs = FALSE,
  plot = c("log_pval", "r"),
  alpha = 0.05,
  return_data = FALSE,
  transpose = FALSE,
  ...
)

Arguments

object

a trained MOFA object.

covariates
  • data.frame:a data.frame where the samples are stored in the rows and the covariates are stored in the columns. Use row names for sample names and column names for covariate names. Columns values must be numeric.

  • character vector:character vector with names of columns that are present in the sample metadata (samples_metadata(model)

factors

character vector with the factor name(s), or numeric vector with the index of the factor(s) to use. Default is 'all'.

groups

character vector with the groups names, or numeric vector with the indices of the groups of samples to use, or "all" to use samples from all groups.

abs

logical indicating whether to take the absolute value of the correlation coefficient (default is TRUE).

plot

character indicating whether to plot Pearson correlation coefficiens (plot="r") or log10 adjusted p-values (plot="log_pval").

alpha

p-value threshold

return_data

logical indicating whether to return the correlation results instead of plotting

transpose

logical indicating whether to transpose the plot

...

extra arguments passed to corrplot (if plot=="r") or pheatmap (if plot=="log_pval").

Value

A corrplot (if plot=="r") or pheatmap (if plot=="log_pval") or the underlying data.frame if return_data is TRUE


bioFAM/MOFA2 documentation built on June 12, 2024, 3:57 p.m.