Loading the data you need

sce <- readRDS("~/Course_Materials/scRNAseq/Robjects/caron_postDeconv_5hCellPerSpl.Rds")

Challenge 1

Select top 2000 highly variable genes, calculate PCs and identify PCs linked to biological variation (using denoisePCA command). How many PCs remain after denoising?

dec.sce <- modelGeneVar(sce)
hvgs <- getTopHVGs(dec.sce, n=2000)

sce <- runPCA(sce,subset_row=hvgs)

var.fit <- metadata(dec.sce)
sce <- denoisePCA(sce, technical=var.fit$trend, subset.row=hvgs, assay.type="logcounts")
ncol(reducedDim(sce))
## [1] 6

Challenge 2

Can you plot t-SNE and UMAP with your chosen PCs.

sce <- runTSNE(sce, dimred="PCA",perplexity=50, n_dimred=6, rand_seed=123)

plotTSNE(sce, colour_by="SampleName",size_by="sum") 

set.seed(123)
sce <- runUMAP(sce, dimred="PCA",n_dimred=6)
plotUMAP(sce,colour_by="SampleName")