Deconvolution - Answer Key

Author

Noor Sohail

Published

April 19, 2026

Exercise 1

  1. What is the sample-specific proportion for each first_type? Create a ggplot barplot showing the proportions of each cell type. Hint: Refer back to the code we used here.
# Barplot of proportion of cells in each first_type by sample
ggplot(seurat_rctd@meta.data) +
    geom_bar(aes(x = first_type, 
                 fill = orig.ident), 
             position = position_fill())  +
  theme_classic() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

  1. Create a dotplot using the known marker genes for each celltype to see if the first_type labels align with known celltype genes.
marker_list <- list(
  "B cells" = c("IGKC", "IGHM", "CD79A", "MS4A1", "MZB1"),
  "Endothelial cells" = c("PECAM1", "VWF", "PLVAP", "ENG", "KLF2"),
  "Fibroblasts" = c("COL1A1", "COL3A1", "DCN", "LUM", "COL6A2"),
  "Intestinal epithelial cells" = c("CLCA1", "FCGBP", "MUC2", "PIGR", "ZG16"),
  "Myeloid cells" = c("C1QC", "SELENOP", "SPP1", "LYZ", "CD68"),
  "Neural cells" = c("NRXN1", "L1CAM", "NCAM1", "VIP", "CALB2"),
  "Smooth muscle cells" = c("TAGLN", "ACTA2", "MYH11", "MYL9", "CNN1"),
  "T cells" = c("TRAC", "CD3E", "TRBC2", "IL7R", "CD52"),
  "Tumor cells" = c("CEACAM6", "CEACAM5", "EPCAM", "KRT8", "LCN2")
)
DotPlot(seurat_rctd,
        marker_list,
        group.by = "first_type",
        cluster.idents = TRUE) +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))

We see that the different celltype markers do correspond quite highly with each of the first_type RCTD results. This gives us more confidence in the results.


Back to Lesson >>

Back to Schedule

Reuse

CC-BY-4.0