Skip to contents

Calculate the TOM from an expression matrix

Usage

calculate_tom_from_exp(x, signed, version, cor_method)

Arguments

x

Numerical matrix. The expression matrix. Assumes that columns are the genes, and rows the samples.

signed

Boolean. Do you want to calculate the signed version. If set to FALSE, the absolute correlation coefficients will be used.

version

String. One of c("v1", "v2"). Defaults to "v1"

cor_method

String. One of c("pearson", spearman). Defaults to "pearson".

Value

The topological overlap matrix.

Details

Calculates the topological overlap matrix from an expression matrix. It will first calculate the specified correlation matrix and then generate the TOM. The TOM is defined as:

Unsigned, v1:

$$TOM_{ij} = \frac{a_{ij} + \sum_{k \neq i,j} a_{ik} a_{kj}}{\min(k_i, k_j) + 1 - a_{ij}}$$

Signed, v1:

$$TOM_{ij} = \frac{a_{ij} + \sum_{k \neq i,j} a_{ik} a_{kj}}{\min(k_i, k_j) + 1 - \left|a_{ij}\right|}$$

Unsigned, v2:

$$TOM_{ij} = 0.5 \left( a_{ij} + \frac{\sum_{k \neq i,j} a_{ik} a_{kj}}{\min(k_i, k_j) + a_{ij}} \right)$$

Signed, v2:

$$TOM_{ij} = 0.5 \left( a_{ij} + \frac{\sum_{k \neq i,j} a_{ik} a_{kj}}{\min(k_i, k_j) + \left|a_{ij}\right|} \right)$$

where \(a_{ij}\) is the affinity between nodes \(i\) and \(j\), and \(k_i = \sum_j a_{ij}\) is the connectivity of node \(i\). For signed networks, connectivity is calculated as \(k_i = \sum_j \left|a_{ij}\right|\).

Version 2 uses a different normalization approach that scales the shared neighbor contribution separately before combining it with the direct connection strength.