makeNetworks {scTenifoldNet} | R Documentation |
Computes gene regulatory networks for subsamples of cells based on principal component regression.
Description
This function computes nNet
gene regulatory networks for a randomly selected subsample of nCells
cells based on principal component regression (PCR), a technique based on principal component analysis. In PCR, the outcome variable is regressed over a nComp
number of for principal components computed from a set of covariates to estimate the unknown regression coefficients in the model. pcNet
function computes the PCR coefficients for each gene one at a time using all the others as covariates, to construct an all by all gene regulatory network.
Usage
makeNetworks(
X,
nNet = 10,
nCells = 500,
nComp = 3,
scaleScores = TRUE,
symmetric = FALSE,
q = 0.95,
nCores = parallel::detectCores()
)
Arguments
X |
A filtered and normlized gene expression matrix with cells as columns and genes as rows. |
nNet |
An integer value. The number of networks based on principal components regression to generate. |
nCells |
An integer value. The number of cells to subsample each time to generate a network. |
nComp |
An integer value. The number of principal components in PCA to generate the networks. Should be greater than 2 and lower than the total number of genes. |
scaleScores |
A boolean value ( |
symmetric |
A boolean value ( |
q |
A decimal value between 0 and 1. Represent the cut-off threshold of top q% relationships to be returned. |
nCores |
An integer value. Defines the number of cores to be used. |
Details
Principal component regression may be broadly divided into three major steps:
Perform PCA on the observed covariates data matrix to obtain
nComp
number of the principal components.Regress the observed vector of outcomes on the selected principal components as covariates, using ordinary least squares regression to get a vector of estimated regression coefficients
Transform this vector back to the scale of the actual covariates, using the eigenvectors corresponding to the selected principal components to get the final PCR estimator for estimating the regression coefficients characterizing the original model.
Value
A list with nNet
gene regulatory networks in dgCMatrix format. Each one computed from a randomly selected subsample of nCells
cells.
References
Gill, Ryan, Somnath Datta, and Susmita Datta. "dna: An R package for differential network analysis." Bioinformation 10.4 (2014): 233.
Jolliffe, Ian T. "A note on the use of principal components in regression." Journal of the Royal Statistical Society: Series C (Applied Statistics) 31.3 (1982): 300-303.
Massy, William F. "Principal components regression in exploratory statistical research." Journal of the American Statistical Association 60.309 (1965): 234-256.
Examples
library(scTenifoldNet)
# Simulating of a dataset following a negative binomial distribution with high sparcity (~67%)
nCells = 2000
nGenes = 100
set.seed(1)
X <- rnbinom(n = nGenes * nCells, size = 20, prob = 0.98)
X <- round(X)
X <- matrix(X, ncol = nCells)
rownames(X) <- c(paste0('ng', 1:90), paste0('mt-', 1:10))
# Performing Single cell quality control
qcOutput <- scQC(
X = X,
minLibSize = 30,
removeOutlierCells = TRUE,
minPCT = 0.05,
maxMTratio = 0.1
)
# Computing 3 single-cell gene regulatory networks each one from a subsample of 500 cells
mnOutput <- makeNetworks(X = X,
nNet = 3,
nCells = 500,
nComp = 3,
scaleScores = TRUE,
symmetric = FALSE,
q = 0.95
)
# Verifying the class
class(mnOutput)
# Verifying the number of networks
length(mnOutput)
# Veryfying the dimention of the networks
lapply(mnOutput,dim)
# Single-cell gene regulatory networks
mnOutput[[1]][1:10,1:10]
mnOutput[[2]][1:10,1:10]
mnOutput[[3]][1:10,1:10]