run_corr: Wrapper for correlation co-expression

View source: R/methods.R

run_corrR Documentation

Wrapper for correlation co-expression


Conducts co-expression analysis using correlation for association measure. Can be used for the network_inference argument in dnapath.


  weights = NULL,
  threshold = NULL,
  method = c("pearson", "spearman"),



A n by p matrix of gene expression data (n samples and p genes).


An optional vector of weights. This is used by dnapath() to apply the probabilistic group labels to each observation when estimating the group-specific network.


Cutoff for significant associations. If NULL, all correlations are returned. Otherwise, correlations of magnitude at or below this threshold are set to zero.


Argument is passed into cor. Should be one of "pearson" or "spearman".


Additional arguments are ignored.


A p by p matrix of association scores.

See Also

run_aracne, run_bc3net, run_c3net, run_clr, run_dwlasso, run_genie3, run_glasso, run_mrnet, run_pcor, and run_silencer



# To create a short example, we subset on two pathways from the p53 pathway list,
# and will only run 5 permutations for significance testing.
pathway_list <- p53_pathways[c(8, 13)]
n_perm <- 5

# Use this method to perform differential network analysis.
# The parameters in run_corr() can be adjusted using the ... argument.
# For example, the 'method' parameter can be specified as shown here.
results <- dnapath(x = meso$gene_expression,
                   pathway_list = pathway_list,
                   group_labels = meso$groups,
                   n_perm = n_perm,
                   network_inference = run_corr,
                   method = "spearman")

# The group-specific association matrices can be extracted using get_networks().
nw_list <- get_networks(results[[1]]) # Get networks for pathway 1.

# nw_list has length 2 and contains the inferred networks for the two groups.
# The gene names are the Entrezgene IDs from the original expression dataset.
# Renaming the genes in the dnapath results to rename those in the networks.
# NOTE: The temporary directory, tempdir(), is used in this example. In practice,
#       this argument can be removed or changed to an existing directory
results <- rename_genes(results, to = "symbol", species = "human",
                        dir_save = tempdir())
nw_list <- get_networks(results[[1]]) # The genes (columns) will have new names.

# (Optional) Plot the network using SeqNet package (based on igraph plotting).
# First rename entrezgene IDs into gene symbols.

dnapath documentation built on May 9, 2022, 9:05 a.m.