View source: R/correlationTest.R
correlationTest | R Documentation |
Calculates the (pairwise) correlation statistics and associated p-values of a matrix or the correlation of each row with a vector.
correlationTest(
obj,
y = NULL,
method = "pearson",
alternative = "two.sided",
norm = TRUE,
log = TRUE,
cores = 1,
override = FALSE,
...
)
obj |
A MRexperiment object or count matrix. |
y |
Vector of length ncol(obj) to compare to. |
method |
One of 'pearson','spearman', or 'kendall'. |
alternative |
Indicates the alternative hypothesis and must be one of 'two.sided', 'greater' (positive) or 'less'(negative). You can specify just the initial letter. |
norm |
Whether to aggregate normalized counts or not - if MRexperiment object. |
log |
Whether or not to log2 transform the counts - if MRexperiment object. |
cores |
Number of cores to use. |
override |
If the number of rows to test is over a thousand the test will not commence (unless override==TRUE). |
... |
Extra parameters for mclapply. |
A matrix of size choose(number of rows, 2) by 2. The first column corresponds to the correlation value. The second column the p-value.
correctIndices
# Pairwise correlation of raw counts
data(mouseData)
cors = correlationTest(mouseData[1:10,],norm=FALSE,log=FALSE)
head(cors)
mat = MRcounts(mouseData)[1:10,]
cormat = as.matrix(dist(mat)) # Creating a matrix
cormat[cormat>0] = 0 # Creating an empty matrix
ind = correctIndices(nrow(mat))
cormat[upper.tri(cormat)][ind] = cors[,1]
table(cormat[1,-1] - cors[1:9,1])
# Correlation of raw counts with a vector (library size in this case)
data(mouseData)
cors = correlationTest(mouseData[1:10,],libSize(mouseData),norm=FALSE,log=FALSE)
head(cors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.