Optimized gene regulatory network construction using principal component regression
Source:R/pcNetFast.R
pcNetFast.RdUsage
pcNetFast(
X,
nComp = 3,
scaleScores = TRUE,
symmetric = FALSE,
q = 0,
verbose = TRUE,
nCores = 1,
use_approximate = FALSE
)Arguments
- X
A filtered and normalized gene expression matrix with cells as columns and genes as rows.
- nComp
An integer value. The number of principal components in PCA to generate the networks.
- scaleScores
A boolean value (TRUE/FALSE), if TRUE, the weights will be normalized such that the maximum absolute value is 1.
- symmetric
A boolean value (TRUE/FALSE), if TRUE, the weights matrix returned will be symmetric.
- q
A decimal value between 0 and 1. Defines the cut-off threshold of top q
verboseA boolean value (TRUE/FALSE), if TRUE, progress information is shown.
nCoresAn integer value. Defines the number of cores for BLAS operations (not for parallelization).
use_approximateLogical. If TRUE, uses approximate method (faster but less accurate). Default FALSE.
A gene regulatory network in dgCMatrix format. This is an optimized version of pcNet that maintains scientific accuracy while improving performance through efficient matrix operations, caching, and vectorization. Unlike naive batch approaches, this version uses smart caching of SVD results to avoid redundant computations while maintaining leave-one-out accuracy. This optimized implementation uses several strategies:
Pre-standardization of the data matrix
Vectorized operations where possible
Efficient sparse matrix operations
Smart memory management