# NOT RUN {
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
)
# Computing a K = 3 CANDECOMP/PARAFAC (CP) Tensor Decomposition
tdOutput <- tensorDecomposition(mnOutput, K = 3, maxError = 1e5, maxIter = 1e3)
# Verifying the number of networks
length(tdOutput)
# Veryfying the dimention of the networks
lapply(tdOutput,dim)
# Weight-averaged denoised single-cell gene regulatory networks
tdOutput[[1]][1:10,1:10]
# }
Run the code above in your browser using DataLab