Make.adjacencyPVal: Computing an adjacency table with Pvalues associated to a...

Description Usage Arguments Value Examples

View source: R/CoExpression.R

Description

This function is similar to Cor.square.matrix() and TOM.square.matrix() as it converts the square matrix into a 4 columns dataframe with no repeated pair of variables and Pvalue associated with a correlation coefficient.

Usage

1
Make.adjacencyPVal(data, Fast = FALSE, method)

Arguments

data

Dataset of gene expression levels with genes in row and samples in columns

Fast

Logical value. if Fast = TRUE, only the pearson correlation coefficients will be measured with a fast one-step method. It uses the corAndPvalue() function from the WGCNA package. if Fast = FALSE, the pvalue of the correlation of the gene pairs will be computed. Careful, if Fast = F, it may take a while depending on the number of genes in the dataset.

method

Methods to compute the correlation coefficients. "spearman" computes the Spearman's rho, "kendall" uses the Kendall's tau and "pearson" the Pearson's product moment correlation coefficient. These functions are called via the cor() function in the stats package.

Value

Dataframe with 4 columns. the two first are the pairs of genes, the other two are the correlation coefficients and the associated pvalue.

Examples

1
2
3
4
5
6
7
8
9
# Creating a dataset
df = matrix(runif(500, 10, 100), ncol=20)
group = paste0(rep(c("control", "case"), each = 10),rep(c(1:10),each = 1))
genes <- paste0(rep(LETTERS[1:25], each=1))
colnames(df) = group
row.names(df) = genes

# computing fast correlation and pvalues 
Adj = Make.adjacencyPVal(df,Fast = FALSE ,method = "spearman")

jtcasemajor/CPRD documentation built on Dec. 21, 2021, 3:22 a.m.