summaryrefslogtreecommitdiff
path: root/scripts/tsne-mp2d.R
blob: 0877622892f7800d64b34fc875c9be5929bd3106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env Rscript
library(Rtsne)
library(ggplot2)
data <- read.csv("figures/tsne-mp2d.csv")
labels <- data$Mutagenicity
data$Mutagenicity <- NULL
m <- as.matrix(data)
dist <- as.dist(m)
tsne <- Rtsne(dist,is_distance=T)
#write.csv(tsne,"tsne.csv")
write.csv(data.frame(x = tsne$Y[,1], y = tsne$Y[,2]),"tsne.csv")
#tsne_plot <- data.frame(x = tsne$Y[,1], y = tsne$Y[,2])
#colors <- c("PA" = "#00BFC4", "mutagen" = "#F8766D", "non-mutagen" = "#7CAE00")
#plot <- ggplot(tsne_plot)
#plot + geom_point(aes(x=x, y=y, color = labels)) + xlab(element_blank()) + ylab(element_blank()) + theme(axis.ticks = element_blank(), axis.text = element_blank(), legend.title=element_blank()) + scale_color_manual(values = colors)
#ggsave("figures/tsne-mp2d.png")