pcNet: Computes a gene regulatory network based on principal...

View source: R/pcNet.R

pcNetR Documentation

Computes a gene regulatory network based on principal component regression

Description

This function computes a gene regulatory network 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

pcNet(
  X,
  nComp = 3,
  scaleScores = TRUE,
  symmetric = FALSE,
  q = 0,
  verbose = TRUE,
  nCores = parallel::detectCores()
)

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. Should be greater than 2 and lower than the total number of genes.

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% relationships to be returned.

verbose

A boolean value (TRUE/FALSE), if TRUE, a progress bar is shown.

nCores

An integer value. Defines the number of cores to be used.

Details

Principal component regression may be broadly divided into three major steps:

  1. Perform PCA on the observed covariates data matrix to obtain nComp number of the principal components.

  2. 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

  3. 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 gene regulatory network in dgCMatrix format.

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 a single-cell gene regulatory network using principal component regression
# Non-symmetric
pcnetOutput <- pcNet(X = qcOutput, nComp = 3, scaleScores = TRUE, symmetric = FALSE, q = 0)
pcnetOutput[1:10,1:10]

# Symmetric
pcnetOutput <- pcNet(X = qcOutput, nComp = 3, scaleScores = TRUE, symmetric = TRUE, q = 0)
pcnetOutput[1:5,1:5]

cailab-tamu/PCrTdMa documentation built on Aug. 6, 2022, 8:11 p.m.