R: Relabel module labels to best match the given reference...
matchLabels
R Documentation
Relabel module labels to best match the given reference labels
Description
Given a source and reference vectors of module labels, the function produces a module
labeling that is equivalent to source, but individual modules are re-labeled so that modules with
significant overlap in source and reference have the same labels.
a vector or a matrix of reference labels. The labels may be numeric or character.
reference
a vector of reference labels.
pThreshold
threshold of Fisher's exact test for considering modules to have a significant
overlap.
na.rm
logical: should missing values in either source or reference be removed? If
not, missing values may be treated as a standard label or the function may throw an error
(exact behaviour depends on whether the input labels
are numeric or not).
ignoreLabels
labels in source and reference to be considered unmatchable. These
labels are excluded from the re-labeling procedure.
extraLabels
a vector of labels for modules in source that cannot be matched to any modules
in reference. The user should ensure that this vector contains enough labels since the function
automatically removes a values that occur in either source, reference or ignoreLabels,
to avoid possible confusion.
Details
Each column of source is treated separately. Unlike in previous version of this function, source
and reference labels can be any labels, not necessarily of the same type.
The function calculates the overlap of the source and reference modules using Fisher's
exact test. It then attempts to relabel source modules such that each source module gets the
label of the reference module that it overlaps most with, subject to not renaming two source
modules to the same reference module. (If two source modules point to the same
reference module, the one with the more significant overlap is chosen.)
Those source modules that cannot be matched to a reference module are labeled using
those labels from extraLabels that do not occur in either of source, reference or
ignoreLabels.
Value
A vector (if the input source labels are a vector) or a matrix (if the input source
labels are a matrix) of the new labels.
Author(s)
Peter Langfelder
See Also
overlapTable for calculation of overlap counts and p-values;
standardColors for standard non-numeric WGCNA labels.