Open sevdarafatov opened 1 year ago
plotDimensionsWithTitle <- function(SO, scenario) { Idents(SO) <- SO$seurat_clusters
# Create the UMAP plot
umap_plot <- DimPlot(SO)
# Add a title to the plot
umap_plot <- umap_plot + ggtitle(paste("UMAP Plot - Scenario", scenario))
# Print the plot
print(umap_plot)
if (goodQ & scenario != "1") {
# Load cell cycle scores and phase table
phaseTable <- read.table(paste0("../05_additionalControls/cellCycleScoresAssignation_", DATASET, "_scenario_", scenario, ".csv"), sep = ",", header = TRUE)
phaseTable <- column_to_rownames(phaseTable, var = "cellIDs")
# merge phase column of cell cycle scores to the SO metadata table according to the cellnames
SO@meta.data <- merge(SO@meta.data, phaseTable["Phase"], by = "row.names", all.y = FALSE)
SO@meta.data <- column_to_rownames(SO@meta.data, var = "Row.names")
Idents(SO) <- SO@meta.data$Phase
# Create the UMAP plot with a title
umap_plot_with_title <- DimPlot(SO, shuffle = TRUE) + ggtitle(paste("UMAP Plot (Cell Cycle) - Scenario", scenario))
# Print the plot with the title
print(umap_plot_with_title)
}
}
invisible(mapply(plotDimensionsWithTitle, SO.list, names(SO.list)))