Commit ecdd68b1 authored by Lena Hersemann's avatar Lena Hersemann

subsetting of countMatrix is now only applied for the PCA

parent 094e386f
......@@ -44,10 +44,10 @@ countMatrix <- countData %>%
as.matrix()
countMatrix <- countMatrix[rowSums(countMatrix)>0, ]
# select 2000 cells only if more than 2000 cells were provided as input
if (ncol(countMatrix) > 2000) {
countMatrix <- countMatrix[, sample(ncol(countMatrix), 2000)]
}
# # select 2000 cells only if more than 2000 cells were provided as input
# if (ncol(countMatrix) > 2000) {
# countMatrix <- countMatrix[, sample(ncol(countMatrix), 2000)]
# }
countMatrix <- countMatrix[rowSums(countMatrix) > 0, ]
......@@ -72,6 +72,15 @@ if(exists("dpt")) { saveRDS(dpt, "dpt.rds") }
#additionally calculate PCA
# select 2000 cells only if more than 2000 cells were provided as input
set.seed(20032019)
if (ncol(normCountMatrix) > 2000) {
normCountMatrix <- normCountMatrix[, sample(ncol(normCountMatrix), 2000)]
}
normCountMatrix <- normCountMatrix[rowSums(normCountMatrix) > 0, ]
data.pca = prcomp(t(normCountMatrix), retx = TRUE, center = TRUE, scale. = TRUE)
data.percent <- round((((data.pca$sdev) ^ 2 / sum(data.pca$sdev ^ 2)) * 100)[1 : 2])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment