summaryrefslogtreecommitdiff
path: root/scripts/tsne-classifications.R
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/tsne-classifications.R')
-rwxr-xr-xscripts/tsne-classifications.R19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/tsne-classifications.R b/scripts/tsne-classifications.R
new file mode 100755
index 0000000..6f37d11
--- /dev/null
+++ b/scripts/tsne-classifications.R
@@ -0,0 +1,19 @@
+#!/usr/bin/env Rscript
+library(Rtsne)
+library(ggplot2)
+args = commandArgs(trailingOnly=TRUE)
+tsne = read.csv(args[1],header=T)
+tsne[,1] = NULL
+labels = read.csv(args[2],header=F, na.strings = "-")[,1]
+labels = factor(labels,levels=c("TP","TN","FN","FP","NA","PA-mutagenic","PA-nonmutagenic","PA-NA"))
+tsne_plot = data.frame(x = tsne$x, y = tsne$y)
+blue = "#00BFC4"
+red = "#F8766D"
+green = "#7CAE00"
+grey = "#AAAAAA"
+colors = c("PA-mutagenic" = "red", "PA-nonmutagenic" = "green", "PA-NA" = grey, "TP" = red, "TN" = green, "FP" = "red", "FN" = "green", "NA" = grey)
+shapes = c("PA-mutagenic" = 22, "PA-nonmutagenic" = 22, "PA-NA" = 22,"TP" = 16, "TN" = 16, "FP" = 23, "FN" = 23, "NA" = 16)
+fills = c("PA-mutagenic" = blue, "PA-nonmutagenic" = blue, "PA-NA" = blue, "TP" = red, "TN" = green, "FP" = "green", "FN" = "red", "NA" = grey)
+plot = ggplot(tsne_plot)
+plot + geom_point(aes(x=x, y=y, color = labels, shape = labels, fill = labels)) + xlab(element_blank()) + ylab(element_blank()) + theme(axis.ticks = element_blank(), axis.text = element_blank(), legend.title=element_blank(), legend.position="bottom") + scale_shape_manual(values = shapes) + scale_color_manual(values = colors) + scale_fill_manual(values = fills)
+ggsave(args[3])