Learn R Programming

WGCNA (version 0.92-3)

collapseRows: Collapse Rows in Numeric Matrix

Description

This function collapses the rows of a numeric matrix from one set of variables into a less specific set. For example, it will take as input expression data with rows as probes and output expression data with rows as genes, collapsing all probes for a given gene into one set of expression values.

Usage

collapseRows(datET, symbolVector, probeVector, method = max, connectivityPower=NULL)

Arguments

datET
Matrix (or data frame) of numeric values (typically expression data) where rows are probes and columns are samples.
symbolVector
A character vector of gene symbols which correspond to the probes in "probeVector"
probeVector
A character vector of probes. This should include all the probes from rownames(datET), but can include other probes.
method
Must be a function that takes a vector of numbers as input and outputs a single number (ie, min, max, mean, median). For genes with 2 probes (also 3+ if connectivityPower=NULL), this is the method used for collapsing values for multiple probes into a sin
connectivityPower
If a value is inputted, genes with 3+ corresponding probes will be collapsed such that values corresponding to the probe with the highest connectivity (unsigned adjacency raised to a power of connectivityPower) will be used. Value must be a number > 0.

Value

  • The output is an expression matrix with the same columns as datET, but with rows corresponding to genes rather than probes.

Details

The function is robust to missing data, in that NAs are only outputted if expression values for ALL probes for a given gene are missing. Also, if probe names are missing, they are inferred where possible.