summaryrefslogtreecommitdiff
path: root/paper/test-prediction-plot.R
blob: c43737f61bb9b0cb4729517e7c0d3873668b55bf (plain)
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
library(ggplot2)
library(grid)
library(gridExtra)

mazzatorta = read.csv("data/mazzatorta-test-predictions.csv",header=T)
swiss = read.csv("data/swiss-test-predictions.csv",header=T)
combined = read.csv("data/combined-test-predictions.csv",header=T)
test <- read.csv("data/test.csv",header=T)
n = c("SMILES","LOAEL","Source")

data = data.frame(factor(test$SMILES),test$LOAEL,factor(test$Dataset))
names(data) = n
data$Type = "experimental"
maz = data.frame(factor(mazzatorta$SMILES),mazzatorta$LOAEL_predicted,factor(mazzatorta$Dataset))
names(maz) = n
maz$Type = "predicted"
data = rbind(data,maz)
swi = data.frame(factor(swiss$SMILES),swiss$LOAEL_predicted,factor(swiss$Dataset))
names(swi) = n
swi$Type = "predicted"
data = rbind(data,swi)
comb = data.frame(factor(combined$SMILES),combined$LOAEL_predicted,factor(combined$Dataset))
names(comb) = n
comb$Type = "predicted"
data = rbind(data,comb)
data$LOAEL = -log(data$LOAEL)
data$SMILES <- reorder(data$SMILES,data$LOAEL)
img <- ggplot(data, aes(SMILES,LOAEL,ymin = min(LOAEL), ymax=max(LOAEL),shape=Source,color=Type))
img <- img + ylab('-log(LOAEL mg/kg_bw/day)') + xlab('Compound') + theme(axis.text.x = element_blank())
img <- img + geom_point()

ggsave(file='figure/test-prediction.pdf', plot=img,width=12, height=8)