summaryrefslogtreecommitdiff
path: root/scripts/tsne-classifications.R
blob: 6f37d11137c6f2f9780a184fa1e194686f8eb475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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])