Build Meta-Networks (Meta-response) via Network Embeddings (PCA / Non-Negative PCA)
build.meta.network.Rdbuild.meta.network aggregates per-cell networks into a low-dimensional set of
meta-networks by network embedding (nPCA on vectorised networks). Concatenating
network vectors yields an edge-by-cell “long-and-tall” matrix. For efficiency,
the edge dimension is first embedded by SVD/PCA, and then nPCA is applied to
the embedded matrix. It accepts either a Seurat object prepared by the
NeighbourNet workflow or a precomputed 3D network tensor. Similarly, using
build.meta.response, meta-responses representing functional gene modules can
be built by nPCA embedding on vectorised response profiles (cell*predictors-by-response).
The detailed arguments and usage of build.meta.network is documented, and that of
build.meta.response is alike.
Usage
build.meta.network(
seurat.obj = NULL,
network = NULL,
k = 100,
cutoff = NULL,
big.memory = FALSE,
scale = TRUE,
truncated = TRUE,
n.net = 20,
non.neg = TRUE,
max.iter = 1000,
tol = 1e-10,
return.p.val = TRUE
)
build.meta.response(
seurat.obj = NULL,
network = NULL,
k = 100,
cutoff = NULL,
big.memory = FALSE,
scale = TRUE,
truncated = TRUE,
n.net = 20,
non.neg = TRUE,
max.iter = 1000,
tol = 1e-10,
return.p.val = TRUE
)Arguments
- seurat.obj
A
Seuratobject with aNNet.modlist stored in themiscslot. This list is created byrun.nn.reg. If provided,assayand gene panels are taken fromNNet.mod$defaults. Ignored whennetworkis supplied.- network
Optional 3D tensor of networks with dimension order (responses x predictors x cells). If supplied,
return.p.valis forced toFALSE.- k
A integer specifying ranks to keep for the “long-and-tall” matrix of concatenated network vectors. Limited to
min(k, n.response * n.predictor, n.cell). Default:100.- cutoff
A numeric value specifying the p-value threshold (in
[0, 1]) passed toget.networkwhen pulling per-cell networks.NULLuses defaults fromNNet.mod$defaults$cutoff.- big.memory
A logical indicating whether to load the full network tensor internally to reduce repeated reads. Default:
FALSE.- scale
A logical indicating whether to scale each single-cell network by its Frobenius norm across edges before aggregation (per-cell normalization). Default:
TRUE.- truncated
A logical indicating whether to retain only significant edge embeddings (spectral-gap heuristic) before running nPCA; otherwise, use exactly
kembeddings. Default:TRUE. Ifk < 100, this is set toFALSE.- n.net
A integer specifying the number of meta-networks to output. Default:
20.- non.neg
A logical indicating whether to perform nPCA (iterative deflation with non-negativity constraints) on the edge-embedded matrix, then embeds cell networks with nPCA loadings. Otherwise, embeds with standard PCA loadings. Default:
TRUE.- max.iter
A integer specifying the maximum iterations for calculating each nPCA component. Default:
1000.- tol
A numeric value specifying the convergence tolerance for nPCA iterations. Default:
1e-10.- return.p.val
Logical; if
TRUEandassay == "effect", also returns per–meta-network p-values by embedding the p-value tensor (NNet.mod$p.val) with the nPCA loadings. Forced toFALSEwhennetworkis supplied or whennon.neg = FALSE. Default:TRUE.
Value
If Seurat object is provided, then update it with
NNet.mod$meta.network populated, which is, a list containing:
meta.network: Array of size (responses x predictors xn.net).p.val: An Array (same size) ifreturn.p.val = TRUE; elseNULL.pcs: A matrix of PC scores learnt on per-cell networks; rows = cells, columns = components.pca.loadings: A matrix of PCA loadings learnt on per-cell networks.pca.sd: A numeric vector of singular values from network covariance.npca.loadings: A matrix of PC scores learnt on per-cell networks; ifnon.neg = TRUE; elseNULL.scale,non.neg: Echo of the input flags.setting: Copy ofNNet.mod$defaultsifseurat.objwas provided.
Details
Edge embedding: If both responses and predictors have size > 1, a
cell-by-cell kernel that represents co-variation in network structure across cells is computed.
Eigen-decomposition is ran to construct a edge-embedding x cell matrix.
If one axis is size 1, perform SVD directly on the (edges × cells) matrix.
Rank selection: If truncated = TRUE, a simple spectral-gap rule over the
tail of singular-value differences selects the working rank of the edge emebdding before nPCA.
Meta-networks: Project per-cell network onto the first
n.net directions (nPCA or PCA) to obtain meta-network slices.