This function calculates Pearson/Spearman correlations between all pairs of features in a matrix/dataframe much faster than the base R cor function. It is also possible to simultaneously calculate mutual rank (MR) of correlations as well as their p-values and adjusted p-values. Additionally, this function can automatically combine and flatten the result matrices. Selecting correlated features using an MR-based threshold rather than based on their correlation coefficients or an arbitrary p-value is more efficient and accurate in inferring functional associations in systems, for example in gene regulatory networks.
fcor(
data,
use = "everything",
method = "spearman",
mutualRank = TRUE,
mutualRank_mode = "unsigned",
pvalue = FALSE,
adjust = "BH",
flat = TRUE
)
a numeric dataframe/matrix (features on columns and samples on rows).
The NA handler, as in R's cov() and cor() functions. Options are "everything", "all.obs", and "complete.obs".
a character string indicating which correlation coefficient is to be computed. One of "pearson" or "spearman" (default).
logical, whether to calculate mutual ranks of correlations or not.
a character string indicating whether to rank based on "signed" or "unsigned" (default) correlation values. In the "unsigned" mode, only the level of a correlation value is important and not its sign (the function ranks the absolutes of correlations). Options are "unsigned", and "signed".
logical, whether to calculate p-values of correlations or not.
p-value correction method (when pvalue = TRUE), a character string including any of "BH" (default), "bonferroni", "holm", "hochberg", "hommel", or "none".
logical, whether to combine and flatten the result matrices or not.
Depending on the input data, a dataframe or list including cor (correlation coefficients), mr (mutual ranks of correlation coefficients), p (p-values of correlation coefficients), and p.adj (adjusted p-values).