| getExperimentCrossCorrelation {mia} | R Documentation |
Calculate cross-correlation
getExperimentCrossCorrelation(x, ...)
## S4 method for signature 'MultiAssayExperiment'
getExperimentCrossCorrelation(
x,
experiment1 = 1,
experiment2 = 2,
abund_values1 = "counts",
abund_values2 = "counts",
method = c("spearman", "categorical", "kendall", "pearson"),
mode = "table",
p_adj_method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm", "hommel",
"none"),
p_adj_threshold = 0.05,
cor_threshold = NULL,
sort = FALSE,
filter_self_correlations = FALSE,
verbose = TRUE,
...
)
## S4 method for signature 'SummarizedExperiment'
getExperimentCrossCorrelation(x, experiment2 = x, ...)
testForExperimentCrossCorrelation(x, ...)
## S4 method for signature 'ANY'
testForExperimentCrossCorrelation(x, ...)
x |
A
|
... |
Additional arguments:
|
experiment1 |
A single character or numeric value for selecting the experiment 1
from |
experiment2 |
A single character or numeric value for selecting the experiment 2
from |
abund_values1 |
A single character value for selecting the
|
abund_values2 |
A single character value for selecting the
|
method |
A single character value for selecting association method
('kendall', pearson', or 'spearman' for continuous/numeric; 'categorical' for discrete)
(By default: |
mode |
A single character value for selecting output format
Available formats are 'table' and 'matrix'. (By default: |
p_adj_method |
A single character value for selecting adjustment method of
p-values. Passed to |
p_adj_threshold |
A single numeric value (from 0 to 1) for selecting
adjusted p-value threshold. (By default: |
cor_threshold |
A single numeric absolute value (from 0 to 1]) for selecting
correlation threshold to include features. (By default: |
sort |
A single boolean value for selecting whether to sort features or not
in result matrices. Used method is hierarchical clustering.
Disabled when |
filter_self_correlations |
A single boolean value for selecting whether to
filter out correlations between identical items. Applies only when correlation
between experiment itself is tested, i.e., when assays are identical.
(By default: |
verbose |
A single boolean value for selecting whether to get messages about progress of calculation. |
These functions calculates associations between features of two experiments.
getExperimentCrossCorrelation calculates only associations by default.
testForExperimentCrossCorrelation calculates also significance of
associations.
These functions return associations in table or matrix format. In table format, returned value is a data frame that includes features and associations (and p-values) in columns. In matrix format, returned value is a one matrix when only associations are calculated. If also significances are tested, then returned value is a list of matrices.
Leo Lahti and Tuomas Borman. Contact: microbiome.github.io
mae <- microbiomeDataSets::peerj32()
# Subset so that less observations / quicker to run, just for example
mae[[1]] <- mae[[1]][1:20, 1:10]
mae[[2]] <- mae[[2]][1:20, 1:10]
# Calculate cross-correlations
result <- getExperimentCrossCorrelation(mae, method = "pearson")
# Show first 5 entries
head(result, 5)
# Same can be done with SummarizedExperiment and altExp
# Create TreeSE with altExp
tse <- mae[[1]]
altExp(tse, "exp2") <- mae[[2]]
# Whe mode = matrix, matrix is returned
result <- getExperimentCrossCorrelation(tse,
experiment2 = "exp2",
method = "pearson",
mode = "matrix")
# Show first 5 entries
head(result, 5)
# testForExperimentCorrelation returns also significances
# filter_self_correlations = TRUE filters self correlations
result <- testForExperimentCrossCorrelation(tse,
experiment2 = tse,
method = "pearson",
filter_self_correlations = TRUE)
# Show first 5 entries
head(result, 5)
# Also getExperimentCrossCorrelation returns significances when
# test_signicance = TRUE
result <- getExperimentCrossCorrelation(mae[[1]],
experiment2 = mae[[2]],
method = "pearson",
mode = "matrix",
test_significance = TRUE)
# Returned value is a list of matrices
names(result)