scaleTOM: TOM matrix rescaling prior to computing consensus topological...

View source: R/utility_functions.R

scaleTOMR Documentation

TOM matrix rescaling prior to computing consensus topological overlap.

Description

Query TOM matrix is rescaled to match nth percentile of reference TOM matrix. Since consensus is defined as component-wise minimum of two TOMS, a bias may result without scaling. This is mitigated by scaling the matrices.

Usage

scaleTOM(query.TOM, reference.TOM, reference.percentile = 0.95)

Arguments

query.TOM

Query topological overlap matrix. This is the matrix that will be scaled. Corresponds to w.mat output from scMiko::runWGCNA() function.

reference.TOM

Reference topological overlap matrix. This is the matrix that will be used as the reference and will not be scaled. Corresponds to w.mat output from scMiko::runWGCNA() function.

reference.percentile

Numerical. Matrix is scaled so that reference.percentile is matched across both matrices. Default is 0.95.

Value

scaled query.TOM

Examples


# scale TOM matrices
w.1 <- scaleTOM(query.TOM = w.1, reference.TOM = w.mat, reference.percentile = 0.95)
w.2 <- scaleTOM(query.TOM = w.2, reference.TOM = w.mat, reference.percentile = 0.95)

# recompute the distance matrix
d.mat <- 1-w.mat
d.1 <- 1-w.1
d.2 <- 1-w.2

# compute consensus topological overlap
w.co <- pmin(w.1, w.2) # component-wise parallel minimum of TOMs
d.co <- 1-w.co


NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.