module_trait_cor: Correlate module eigengenes to trait

View source: R/gcn_inference.R

module_trait_corR Documentation

Correlate module eigengenes to trait

Description

Correlate module eigengenes to trait

Usage

module_trait_cor(
  exp,
  metadata,
  MEs,
  metadata_cols = NULL,
  cor_method = "pearson"
)

Arguments

exp

A gene expression data frame with genes in row names and samples in column names or a 'SummarizedExperiment' object.

metadata

A data frame containing sample names in row names and sample annotation in the first column. Ignored if 'exp' is a 'SummarizedExperiment' object, since the function will extract colData.

MEs

Module eigengenes. It is the 2nd element of the result list generated by the function exp2gcn.

metadata_cols

A vector (either numeric or character) indicating which columns should be extracted from column metadata if exp is a 'SummarizedExperiment' object. The vector can contain column indices (numeric) or column names (character). By default, all columns are used.

cor_method

Method to calculate correlation. One of 'pearson', 'spearman' or 'kendall'. Default is 'spearman'.

Value

A data frame with correlation and correlation p-values for each pair of ME and trait, with the following variables:

ME

Factor, module eigengene.

trait

Factor, trait name. Each trait corresponds to a variable of the sample metadata (if numeric) or levels of a variable (if categorical).

cor

Numeric, correlation.

pvalue

Numeric, correlation P-values.

group

Character, name of the metadata variable.

Author(s)

Fabricio Almeida-Silva

Examples

data(filt.se)
gcn <- exp2gcn(filt.se, SFTpower = 18, cor_method = "pearson")
module_trait_cor(filt.se, MEs = gcn$MEs)

almeidasilvaf/BioNERO documentation built on Oct. 9, 2024, 1:49 a.m.