# 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
)
# Performing Counts per million Normalization (CPM)
normalizationOutput <- cpmNormalization(qcOutput)
# Visualizing the differences
oldPar <- par(no.readonly = TRUE)
par(
mfrow = c(1, 2),
mar = c(3, 3, 1, 1),
mgp = c(1.5, 0.5, 0)
)
plot(
Matrix::colSums(qcOutput),
ylab = 'Library Size',
xlab = 'Cell',
main = 'Before CPM Normalization'
)
plot(
Matrix::colSums(normalizationOutput),
ylab = 'Library Size',
xlab = 'Cell',
main = 'After CPM Normalization'
)
par(oldPar)
# }
Run the code above in your browser using DataLab