6 Cell type annotation with singleR
6.2 Reference dataset is from this paper: https://doi.org/10.1016/j.cell.2021.08.003
mmr_atlas <- qread("./data/GSE178341_lognorm_annotated.qs")
6.3 Read in the fetal gut atlas as well https://www.gutcellatlas.org/
gut_atlas <- qread("./data/Gut_Atlas_Seurat.qs")
6.6 Add on the annotations for the MMR atlas and gut cell atlas
predictions <- SingleR(test=cropped.obj@assays$Xenium$counts,
ref=mmr_atlas@assays$RNA@counts, labels=mmr_atlas$clMidwayPr,
aggr.ref = T, num.threads = 10)
cropped.obj$MMR_atlas_midlevel_pred <- predictions$labels
predictions <- SingleR(test=cropped.obj@assays$Xenium$counts,
ref=mmr_atlas@assays$RNA@counts, labels=mmr_atlas$cl295v11SubFull,
aggr.ref = T, num.threads = 10)
cropped.obj$MMR_atlas_lowlevel_pred <- predictions$labels
# Add on the annotations for the gut cell atlas lowlevel
predictions_gut <- SingleR(test=cropped.obj@assays$Xenium$counts,
ref=gut_atlas_adult@assays$RNA$counts, labels=gut_atlas_adult$Integrated_05,
aggr.ref = T, num.threads = 10)
cropped.obj$Pred_gut_atlas <- predictions_gut$labels
# Add on the annotations for the gut cell atlas high level
predictions_gut_midlevel <- SingleR(test=cropped.obj@assays$Xenium$counts,
ref=gut_atlas_adult@assays$RNA$counts, labels=gut_atlas_adult$category,
aggr.ref = T, num.threads = 10)
cropped.obj$Pred_gut_midlevel <- predictions_gut_midlevel$labels
6.9 Plot some key marker genes of CRC and braod celltype markers
FeaturePlot(cropped.obj, features = c("PIGR", "LGR5", "OLFM4", "TGFBI", "MMP3", "REG1A", "REG3A", "BEST4", "MMP3"))
FeaturePlot(cropped.obj, features = c("CD8A", "CD3E", "SPP1", "C1QA", "CD79A", "MZB1"))
6.10 Summarise cell type annotations
cell_type_summary <- table(cropped.obj$Pred_gut_atlas, cropped.obj$Pred_gut_midlevel)%>%
data.frame()
6.11 Make the object a lot smaller by dropping the full fov
cropped.obj[['fov']] <- NULL
plot <- ImageDimPlot(cropped.obj,fov = "zoom", group.by = "Pred_gut_atlas",
size = 0.3,
dark.background = T, boundaries = "segmentation",border.size = 0.1,
molecules = c("PIGR", "LGR5", "OLFM4", "TGFBI", "MMP3", "REG1A", "REG3A"),
nmols = 20000) +
ggtitle("Cell type")
plot
plot <- ImageDimPlot(cropped.obj,fov = "zoom", group.by = "Pred_gut_midlevel",
size = 0.3,
dark.background = T, boundaries = "segmentation",border.size = 0.1,
molecules = c("PIGR", "LGR5"),
nmols = 20000) +
ggtitle("Cell type")
plot