4C. Annotate the initially identified cell clusters
Export cluster markers
dir.create(file.path(getwd(), "annotations"))
Idents(obj_merged) <- obj_merged$clusters.mnn
features <- Features(obj_merged)
filtered_features <- features[!grepl("^Rp[sl][[:digit:]]|^Rplp[[:digit:]]|^Rprl[[:digit:]]|^Rpsa", features)]
filtered_features <- sort(filtered_features[!grepl("^mt-(.*)", filtered_features)])
filtered_features <- sort(filtered_features[!grepl("^H2-(.*)", filtered_features)])
filtered_features <- sort(filtered_features[!grepl("^Hb[a-b](.*)", filtered_features)])
filtered_features <- filtered_features[!grepl("^[0-9]", filtered_features)]
cluster_markers <- FindAllMarkers(obj_merged, only.pos = TRUE,
test.use="wilcox", features=filtered_features,
min.pct = 0.10, logfc.threshold = 1.00) %>%
Add_Pct_Diff()
top25_markers <- Extract_Top_Markers(marker_dataframe = cluster_markers,
num_genes = 25, named_vector = F, group_by = "cluster", make_unique = T)
top25_pos <- data.table(cluster_markers %>% group_by(cluster) %>%
slice_max(n = 25, order_by = avg_log2FC))
fwrite(top25_pos,
paste0("annotations/", sample_name, "_Top25PositiveMarkers_",
Sys.Date(), ".csv"),
sep=",")
obj_meta <- obj_merged@meta.data
fwrite(obj_meta, "obj_merged_metadata.csv", sep=",")
Export subcluster markers
obj_merged <- FindSubCluster(obj_merged, cluster = "1",
algorithm = 3, graph.name = "RNA_snn",
subcluster.name = "sub.clusters.mnn",
resolution = 0.25)
Idents(obj_merged) <- "sub.clusters.mnn"
obj_merged <- FindSubCluster(obj_merged, cluster = "11",
algorithm = 3, graph.name = "RNA_snn",
subcluster.name = "sub.clusters.mnn",
resolution = 0.5)
Idents(obj_merged) <- "sub.clusters.mnn"
obj_merged <- FindSubCluster(obj_merged, cluster = "16",
algorithm = 3, graph.name = "RNA_snn",
subcluster.name = "sub.clusters.mnn",
resolution = 0.15)
Idents(obj_merged) <- "sub.clusters.mnn"
cluster_markers <- FindAllMarkers(obj_merged, only.pos = TRUE,
test.use="wilcox", features=filtered_features,
min.pct = 0.10, logfc.threshold = 1.00) %>%
Add_Pct_Diff()
top25_pos <- data.table(cluster_markers %>% group_by(cluster) %>%
slice_max(n = 25, order_by = avg_log2FC))
top25_sub <- top25_pos[top25_pos$cluster %in% c("1_0", "1_1", "1_2", "11_0",
"11_1", "11_2", "16_0", "16_1", "16_2"),]
fwrite(top25_sub,
paste0("annotations/", sample_name,
"_Top25PositiveMarkers_sub.clusters.mnn_", Sys.Date(), ".csv"),
sep=",")
obj_meta <- obj_merged@meta.data
stk_plt <- Stacked_VlnPlot(seurat_object = obj_merged,
features = c("Ren1", "Akr1b7", "Acta2", "Myh11"), x_lab_rotate = TRUE)
ggsave(paste0("figures/", "renin_markers_vlnplt.png"),
plot = stk_plt, width = 270, height = 90,
units = "mm", dpi = 300, create.dir=TRUE)
ggsave(paste0("figures/", "renin_markers_vlnplt.svg"),
plot = stk_plt, width = 270, height = 90,
units = "mm", dpi = 300, create.dir=TRUE)
Add cell annotations
Here, we utilize a combination of the cellKb database, literature-derived markers, and internally validated markers to annotate individual cell clusters.
new_cluster_ids <- c('POD_Plasma', 'SMC_RPC', 'SMC_MC', 'glomEnC', 'POD',
'CDPC', 'CNT', 'bIC', 'tSMC', 'PTs1', 'EnC', 'arterialEnC', 'fEnC', 'JG',
'RPC_MC', 'JG', 'aIC', 'cDC', 'aLoH', 'KRM', 'IC', 'IC', 'POD', 'mCDPC',
'glomEnC', 'PEC', 'Tcell', 'dLoH', 'DCT', 'MD', 'CNT_CDPC', 'FB',
'POD_EnC', 'URO')
names(new_cluster_ids) <- c('0', '1_0', '1_1', '1_2', '2', '3', '4', '5', '6',
'7', '8', '9', '10', '11_0', '11_1', '11_2', '12', '13', '14', '15', '16_0',
'16_1', '16_2', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26',
'27')
obj_named <- copy(obj_merged)
obj_named <- RenameIdents(obj_named, new_cluster_ids)
obj_named[["cell_type"]] <- Idents(obj_named)
table(obj_named$cell_type)
pal <- get_random_grid_colors(length(unique(obj_named$sub.clusters.mnn)))
names(pal) <- c(unique(obj_named$sub.clusters.mnn))
pal_named <- copy(pal)
names(pal_named) <- unname(new_cluster_ids)
pal_named <- pal_named[!duplicated(names(pal_named))]
pal_named[["captopril-ctrl_1mo"]] <- uva_orange
pal_named[["captopril-ctrl_3mo"]] <- uva_cyan
pal_named[["captopril-ctrl_6mo"]] <- uva_yellow
pal_named[["captopril-trt_1mo"]] <- uva_blue
pal_named[["captopril-trt_3mo"]] <- uva_teal
pal_named[["captopril-trt_6mo"]] <- uva_magenta
labeled_dimplot <- DimPlot(obj_named, reduction = "umap.mnn", label=T,
pt.size=0.5, group.by = "cell_type", cols = pal_named)
source_dimplot <- DimPlot(obj_named, reduction = "umap.mnn", label=T,
pt.size=0.5, group.by = "orig.ident", cols = pal_named)
ggsave(paste0("figures/", sample_name, "_sample-labeled_UMAP.png"),
plot = source_dimplot | labeled_dimplot, width = 360, height = 135,
units = "mm", dpi = 300)
ggsave(paste0("figures/", sample_name, "_sample-labeled_UMAP.svg"),
plot = source_dimplot | labeled_dimplot, width = 360, height = 135,
units = "mm", dpi = 300)
saveRDS(obj_named, paste0("obj_named_", Sys.Date(), ".rds"))
annotate_table <- table(obj_named$cell_type, obj_named$orig.ident)
fwrite(annotate_table, "cell_type-x-source_annotations.csv", sep=",")
Visualize renin lineage populations
celltype_names <- levels(obj_named)
renin_lineage_names <- grep("JG|tSMC|SMC_MC|SMC_RPC|RPC_MC",
celltype_names, value = TRUE)
renincells <- subset(obj_named, idents = renin_lineage_names)
idents_plot <- c("JG", "tSMC", "SMC_MC", "SMC_RPC", "RPC_MC")
obj_named <- SortIdents(obj_named)
ren1_cov_plt <- CoveragePlot(obj_named, region = 'Ren1', features = 'Ren1',
assay = 'ATAC', expression.assay = 'SCT', peaks = TRUE,
show.bulk=TRUE, annotation = "gene", idents = idents_plot,
links = TRUE, extend.upstream = 25000, extend.downstream = 15000)
ggsave(paste0("figures/", sample_name, "_Ren1-CoveragePlot_",
Sys.Date(), ".png"),
create.dir = TRUE,
plot = ren1_cov_plt, width = 180, height = 180, units = "mm", dpi = 300)
ggsave(paste0("figures/", sample_name, "_Ren1-CoveragePlot_",
Sys.Date(), ".svg"),
create.dir = TRUE,
plot = ren1_cov_plt, width = 180, height = 180, units = "mm", dpi = 300)