Shamoun was interested in finding coexpressed genes in specific cell types. Here is some code to do that. You have to enter in each cell type of interest individually.
# Create a variable called 'sce' that contains our Large SingleCellExperiment object from a file using R function readRDS()
sce <- readRDS(file = "~/workspace/Storage/C_MOOR/c_moor_ccc_su22/gastrulation_sce.RDS")
# Find top variable genes
sce <- logNormCounts(sce)
colLabels(sce) <- factor(sce$celltype)
dec <- modelGeneVar(sce)
top.hvgs <- getTopHVGs(dec, n=2000)
# Create a variable with your favorite gene
my_favorite_genes <- c("ENSMUSG00000038192","ENSMUSG00000047139")
# Create a variable with your favorite genes included together with the top HVGs
of.interest <- c(top.hvgs[1:200], my_favorite_genes)
# Subset dataset to just the celltypes you are interested in
sce_subset <- sce[,sce$celltype %in% c("Def. endoderm")]
cor.pairs <- correlatePairs(x = sce_subset, subset.row = of.interest)
cor.pairs