-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGeneral_QC_plots.R
69 lines (56 loc) · 2.97 KB
/
General_QC_plots.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#args <- commandArgs(trailingOnly=TRUE)
# seurat object RDS file.
# plot file name prefix
require("Seurat")
#seur_obj <- readRDS(as.character(args[1]));
#prefix <- as.character(args[2]);
png(paste(prefix, "perMT.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::FeaturePlot(seur_obj, "percent.mt", reduction="umap")
dev.off()
png(paste(prefix, "nFeature.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::FeaturePlot(seur_obj, "nFeature_RNA", reduction="umap")
dev.off()
png(paste(prefix, "CCphase.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::DimPlot(seur_obj, group.by="Phase", reduction="umap")
dev.off()
png(paste(prefix, "sample.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::DimPlot(seur_obj, group.by="sample", reduction="umap")
dev.off()
png(paste(prefix, "assay.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::DimPlot(seur_obj, group.by="assay_type", reduction="umap")
dev.off()
# More Complex Plots
source("/cluster/home/tandrews/scripts/LiverMap2.0/Colour_Scheme.R")
source("/cluster/home/tandrews/scripts/LiverMap2.0/My_R_Scripts.R")
#cluster_col = "seurat_clusters"
png(paste(prefix, "marker_anno.png", sep="_"), width=6, height=6, units="in", res=150)
Type_DimPlot(seur_obj, type_col="marker_labs", reduction="umap", cluster_col="marker_labs")
dev.off()
png(paste(prefix, "scmap_anno.png", sep="_"), width=6, height=6, units="in", res=150)
Type_DimPlot(seur_obj, type_col="consistent_labs", reduction="umap", cluster_col="consistent_labs")
dev.off()
png(paste(prefix, "Seurclusters.png", sep="_"), width=6, height=6, units="in", res=150)
Seurat::DimPlot(seur_obj, group.by=cluster_col)
dev.off()
png(paste(prefix, "Sample_by_cluster.png", sep="_"), width=6, height=6, units="in", res=150)
perc <- table([email protected]$sample, [email protected][,cluster_col])
perc <- t(t(perc)/colSums(perc))
barplot(perc, col=get_seurat_colours(seur_obj, "sample"), main="Sample by Cluster")
dev.off()
png(paste(prefix, "CCphase_by_cluster.png", sep="_"), width=6, height=6, units="in", res=150)
perc <- table([email protected]$Phase, [email protected][, cluster_col])
perc <- t(t(perc)/colSums(perc))
barplot(perc, col=get_seurat_colours(seur_obj, "Phase"), main="CC by Cluster")
dev.off()
png(paste(prefix, "scmap_by_cluster.png", sep="_"), width=6, height=6, units="in", res=150)
perc <- table(map_cell_types([email protected]$consistent_labs), [email protected][,cluster_col])
perc <- t(t(perc)/colSums(perc))
type_cols <- Cell_type_colours[match(rownames(perc),Cell_type_colours[,1]),2]
barplot(perc, col=type_cols, main="Scmap AutoAnno by Cluster")
dev.off()
png(paste(prefix, "marker_by_cluster.png", sep="_"), width=6, height=6, units="in", res=150)
perc <- table(map_cell_types([email protected]$marker_labs), [email protected][,cluster_col])
perc <- t(t(perc)/colSums(perc))
type_cols <- Cell_type_colours[match(rownames(perc),Cell_type_colours[,1]),2]
barplot(perc, col=type_cols, main="Marker AutoAnno by Cluster")
dev.off()