computeCorrelations | R Documentation |
Compute Spearman correlations between two sets of features, using data collected for the same cells in different modalities.
computeCorrelations(x, y, ...)
## S4 method for signature 'ANY'
computeCorrelations(
x,
y,
subset.cols = NULL,
block = NULL,
equiweight = TRUE,
use.names = TRUE,
BPPARAM = SerialParam()
)
## S4 method for signature 'SummarizedExperiment'
computeCorrelations(x, y, use.names = TRUE, ..., assay.type = "logcounts")
x , y |
Normalized expression matrices containing features in the rows and cells in the columns. Each matrix should have the same set of columns but a different set of features, usually corresponding to different modes for the same cells. Alternatively, SummarizedExperiment objects containing such a matrix. Finally, |
... |
For the generic, further arguments to pass to specific methods. For the SummarizedExperiment method, further arguments to pass to the ANY method. |
subset.cols |
Vector indicating the columns of |
block |
A vector or factor of length equal to the number of cells, specifying the block of origin for each cell. |
equiweight |
Logical scalar indicating whether each block should be given equal weight, if |
use.names |
Logical scalar specifying whether row names of For the SummarizedExperiment method, this may also be a string specifying the |
BPPARAM |
A BiocParallelParam object specifying the parallelization scheme to use. |
assay.type |
String or integer scalar specifying the assay containing the matrix of interest in |
If block
is specified, correlations are computed separately for each block of cells.
For each feature pair, the reported rho
is set to the average of the correlations across all blocks.
If equiweight=FALSE
, the average is weighted by the number of cells in each block.
Similarly, the p-value corresponding to each correlation is computed separately for each block and then combined across blocks with Stouffer's method.
More specifically, combining is done using the one-sided p-values for both signs of the correlation, and the smaller p-value is taken (and multiplied by 2).
This ensures that a low p-value can only be achieved if the blocks agree in the sign.
If equiweight=FALSE
, each per-block p-value is weighted by the number of cells.
A DataFrame where each row corresponds to a pair of features in x
and y
.
(If y=NULL
, each pair corresponds to a pair of features in x
.)
This contains the following fields:
feature1
, the name (character) or row index (integer) of each feature in x
.
feature2
, the name (character) or row index (integer) of one of the top correlated features to feature1
.
This is another feature in x
if y=NULL
, otherwise it is a feature in y
.
rho
, the Spearman rank correlation for the current pair of feature1
and feature2
.
p.value
, the approximate p-value associated with rho
under the null hypothesis that the correlation is zero.
FDR
, the adjusted p-value.
The rows are sorted by feature1
and then p.value
.
Aaron Lun
findTopCorrelations
, to avoid computing correlations for all pairs of features when y
has many rows.
library(scuttle)
sce1 <- mockSCE()
sce1 <- logNormCounts(sce1)
sce2 <- mockSCE(ngenes=10) # pretend this is protein data.
sce2 <- logNormCounts(sce2)
output <- computeCorrelations(sce1, sce2)
output
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.