Make.df.graph: Computing a dataframe of usable format for Network plotting...

Description Usage Arguments Value Examples

View source: R/CoExpression.R

Description

Remove all the pairs that has a correlation coefficient below the cor.threshold, or the Pvalue.threshold given in argument. Only the pairs that are sufficiently correlated or similar enough will be kept to produce an object of igraph class.

Usage

1
Make.df.graph(data, cor.threshold, Pvalue.threshold = FALSE, method)

Arguments

data

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

cor.threshold

Threshold to apply for minimal correlation or similarity to keep the pair of gene.

Pvalue.threshold

Logical value. If TRUE, all the pairs not significantly correlated will be removed. Could take a while since all the pvalues needs to be computed. If FALSE, only a thresholding through the correlation coefficient will be applied.

method

Methods to compute the correlation coefficients and the p-values (if Pvalue.threshold = T) "spearman" computes the Spearman's rho, "kendall" uses the Kendall's tau and These functions are called via the cor() function in the stats package. "TOM" uses the TOMsimilarityFromExpr() function from the WGCNA package.

Value

igraph class object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#' # 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
# Compute the graph in an usable format for igraph
Graph = Make.df.graph(df, cor.threshold = 0.5, Pvalue.threshold = FALSE, method = "spearman")
# Plotting it with igraph
plot(Graph)

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