# check if you have these under packages
# you probably don't have it so you have to install it before. Everytime I start R studio
# I have to run these librarys.
################
#packages & functions
################
library(drc)
library(ggplot2)
library(staplr)
#first create individual .csv files based on .csv containing data of all strains
all = read.csv2("Doseresponse_all.csv")
for (name in levels(all$Running.ID)){
#Subset data based on Running.ID
tmp=subset(all,Running.ID==name)
#Create a new filename for each strain - the folder 'Files' should already exist
fn=paste("Files/Doseresponse_",gsub(' ','',name), ".csv", sep='')
#Save the CSV file containing separate expenses data for each strain
write.table(tmp,fn,row.names=FALSE, sep=",")
}
#1. Response prediction
f<- 1:32
f
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
# define name of Input and Output
input=paste("Files/Doseresponse_",i,".csv", sep="")
output=paste("PR/PR_12.5?M_",i,".csv", sep="")
output1=paste("PR/PR_12.05?M_",i,".csv", sep="")
output2=paste("PR/PR_11.55?M_",i,".csv", sep="")
myData= read.csv(input, header=TRUE)
myData
#First look at the imported data
#drm = dose-response model for error plots (change model as needed)
fitData= subset(myData, myData$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
# predict response at specific concentration c(x)
Response= PR(bestDoseresponse.WB, c(12.5))
Response1= PR(bestDoseresponse.WB, c(12.05))
Response2= PR(bestDoseresponse.WB, c(11.55))
write.table(Response, file = output, sep=",",  col.names=FALSE, row.names = i)
write.table(Response1, file = output1, sep=",",  col.names=FALSE, row.names = i)
write.table(Response2, file = output2, sep=",",  col.names=FALSE, row.names = i)
}
# to get all predicted responses in one file go to terminal enter: copy PR_* PR_all.csv to combine to one csv file
# or: cd /Users/xanbjg/Documents/R/EC followed by cat *.csv > ECvalues_t0.csv
#2. EC-values
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
#i="RO5"
#i="MM"
# define name of Input and Output
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
output50=paste("EC/EC50_GP",i,".csv", sep="")
output5=paste("EC/EC5_GP",i,".csv", sep="")
output95=paste("EC/EC95_GP",i,".csv", sep="")
#Then make the GP-strain analysis
#Import data, note that ofloxacin2.csv uses "C" instead of 0 as a marker for the controls
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
#report the EC50
EC50=ED(bestDoseresponse.WB, respLev = 0.5, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC05
EC5=ED(bestDoseresponse.WB, respLev = 0.05, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC95
EC95=ED(bestDoseresponse.WB, respLev = 0.95, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
name50= paste(i,"0.5")
name5= paste(i,"0.05")
name95= paste(i,"0.95")
write.table(EC50, file= output50, col.names = FALSE, row.names = name50)
write.table(EC5, file= output5, col.names = FALSE, row.names = name5)
write.table(EC95, file= output95, col.names = FALSE, row.names = name95)
}
# to get all EC values in one file go to terminal enter: copy EC* EC_all_Cu_T0.csv to combine to one csv file
#3. Plot RO5 and GP_x
for (i in f) {
#If you want to compare only one strain with RO5:
# i=x  (x=Number of strain and run without "for (i in a) {" )
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
Run_ID=paste(i, sep="")
output=paste("Plots/Fig_",i,".pdf", sep="")
#First make the RO5 analysis
myData3= read.csv("Files/Doseresponse_RO5.csv", header=TRUE)
myData3
#First look at the imported data
plot(myData3$Concentration, myData3$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData3= subset(myData3, myData3$Concentration >=0)
bestDoseresponse_RO5.WB = drm(Inhibition~Concentration, data = fitData3, fct = W2.2())
bestDoseresponse_RO5.WB #give you the intercepts
a = coef(bestDoseresponse_RO5.WB)[1]
b = coef(bestDoseresponse_RO5.WB)[2]
#Then make the GP-strain analysis
#Import data
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse_GP.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse_GP.WB #give you the intercepts
a = coef(bestDoseresponse_GP.WB)[1]
b = coef(bestDoseresponse_GP.WB)[2]
myData4= read.csv(input, header=TRUE, sep=",")
myData4
myData3
myData=merge(myData3,myData4, all= TRUE)
#Make doubble analysis: Works!
myData
#First look at the imported data
plot(myData$Concentration, myData$Inhibition) #$says which speific columns you will use
#Fit the data using the Weibull1 model, fix the lower and upper limits
fitData= subset(myData, myData$Concentration >=0)
multi.m1 <- drm(Inhibition~Concentration, data = fitData, strain, fct = W2.2())
#Choose colors to doubble plots
#Check ot this link for col funktion https://www.statmethods.net/advgraphs/parameters.html
#And http://research.stowers.org/mcm/efg/R/Color/Chart/
#generate RGB code for Green=SM
rgb(0, 128, 0, maxColorValue=255)
#RGB Blue=TB
rgb(40, 70, 255, maxColorValue=255)
#Now i am working on a script to make nice looking plots with aid of:
#https://www.rdocumentation.org/packages/drc/versions/3.0-1/topics/plot.drc
#YES it makes a new window for each graph but whatever
dev.off()
dev.new(width=2.5, height=2.5)
par(mar=c(7,7,5,5))
plot(multi.m1,
type = "all",
col=c("#008000", "#2846FF", "#800000"),
broken = TRUE, bp = 6,   #this controls where the axis is cut
bcontrol = list(factor = 1.2), #= "defult", style = "gap", width = "0.02"), #this controls how the cut is made but not working yet
conName = "Control",
cex =  2, cex.axis=2, lty=c(1, 2), lwd=1, #size of: symbols, axis numbers, lines type, line thickness,  stuff
xlim = c(0,18), #Changes,  must be the same in the row below
ylim =c(-0.2,1.2),
xt = c(0, 8, 10, 12, 15, 18), #Specify x numbers
yt = c(-0.2, 0.2, 0.6, 1), #Specify y number
xlab = expression("Cu concentration (" *mu ~ "M)"), line = 5, cex.lab =2,
ylab = "Inhibition of growth rate",
legend = TRUE, legendPos = c(12, 1), legendText=c("RO5",Run_ID), cex.legend = 1.75, lwd.legend = 2,
#legend = FALSE, legendPos = c(1.75, 1), legendText=c("1.5h", "3h", "5h"), cex.legend = 2, lwd.legend = 2,
main = title(main = "T0", adj = 0.05, line = -2.5, cex.main = 2))
plot(bestDoseresponse_RO5.WB, col = "#008000", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
plot(bestDoseresponse_GP.WB, col = "#2846FF", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
dev.copy(pdf, output)
dev.off()
}
staple_pdf(input_directory = "./Plots" , input_files = NULL, output_filepath = "Plots/Fig_all.pdf")
## Houskeeping
rm(list=ls()) #remove ALL objects
Sys.setenv(LANG = "en") #Let's keep stuff in English
Sys.setlocale("LC_ALL","English")
graphics.off()
cat("\014") # clear console window prior to new runekeeping
# loading packages containing functions. Access the functions that these contain.
# check if you have these under packages
# you probably don't have it so you have to install it before. Everytime I start R studio
# I have to run these librarys.
################
#packages & functions
################
library(drc)
library(ggplot2)
library(staplr)
#first create individual .csv files based on .csv containing data of all strains
all = read.csv2("Doseresponse_all.csv")
for (name in levels(all$Running.ID)){
#Subset data based on Running.ID
tmp=subset(all,Running.ID==name)
#Create a new filename for each strain - the folder 'Files' should already exist
fn=paste("Files/Doseresponse_",gsub(' ','',name), ".csv", sep='')
#Save the CSV file containing separate expenses data for each strain
write.table(tmp,fn,row.names=FALSE, sep=",")
}
#1. Response prediction
f<- 1:32
f
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
# define name of Input and Output
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
output=paste("PR/PR_12.5?M_",i,".csv", sep="")
output1=paste("PR/PR_12.05?M_",i,".csv", sep="")
output2=paste("PR/PR_11.55?M_",i,".csv", sep="")
myData= read.csv(input, header=TRUE)
myData
#First look at the imported data
#drm = dose-response model for error plots (change model as needed)
fitData= subset(myData, myData$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
# predict response at specific concentration c(x)
Response= PR(bestDoseresponse.WB, c(12.5))
Response1= PR(bestDoseresponse.WB, c(12.05))
Response2= PR(bestDoseresponse.WB, c(11.55))
write.table(Response, file = output, sep=",",  col.names=FALSE, row.names = i)
write.table(Response1, file = output1, sep=",",  col.names=FALSE, row.names = i)
write.table(Response2, file = output2, sep=",",  col.names=FALSE, row.names = i)
}
# to get all predicted responses in one file go to terminal enter: copy PR_* PR_all.csv to combine to one csv file
# or: cd /Users/xanbjg/Documents/R/EC followed by cat *.csv > ECvalues_t0.csv
#2. EC-values
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
#i="RO5"
#i="MM"
# define name of Input and Output
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
output50=paste("EC/EC50_GP",i,".csv", sep="")
output5=paste("EC/EC5_GP",i,".csv", sep="")
output95=paste("EC/EC95_GP",i,".csv", sep="")
#Then make the GP-strain analysis
#Import data, note that ofloxacin2.csv uses "C" instead of 0 as a marker for the controls
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
#report the EC50
EC50=ED(bestDoseresponse.WB, respLev = 0.5, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC05
EC5=ED(bestDoseresponse.WB, respLev = 0.05, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC95
EC95=ED(bestDoseresponse.WB, respLev = 0.95, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
name50= paste(i,"0.5")
name5= paste(i,"0.05")
name95= paste(i,"0.95")
write.table(EC50, file= output50, col.names = FALSE, row.names = name50)
write.table(EC5, file= output5, col.names = FALSE, row.names = name5)
write.table(EC95, file= output95, col.names = FALSE, row.names = name95)
}
# to get all EC values in one file go to terminal enter: copy EC* EC_all_Cu_T0.csv to combine to one csv file
#3. Plot RO5 and GP_x
for (i in f) {
#If you want to compare only one strain with RO5:
# i=x  (x=Number of strain and run without "for (i in a) {" )
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
Run_ID=paste(i, sep="")
output=paste("Plots/Fig_",i,".pdf", sep="")
#First make the RO5 analysis
myData3= read.csv("Files/Doseresponse_RO5.csv", header=TRUE)
myData3
#First look at the imported data
plot(myData3$Concentration, myData3$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData3= subset(myData3, myData3$Concentration >=0)
bestDoseresponse_RO5.WB = drm(Inhibition~Concentration, data = fitData3, fct = W2.2())
bestDoseresponse_RO5.WB #give you the intercepts
a = coef(bestDoseresponse_RO5.WB)[1]
b = coef(bestDoseresponse_RO5.WB)[2]
#Then make the GP-strain analysis
#Import data
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse_GP.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse_GP.WB #give you the intercepts
a = coef(bestDoseresponse_GP.WB)[1]
b = coef(bestDoseresponse_GP.WB)[2]
myData4= read.csv(input, header=TRUE, sep=",")
myData4
myData3
myData=merge(myData3,myData4, all= TRUE)
#Make doubble analysis: Works!
myData
#First look at the imported data
plot(myData$Concentration, myData$Inhibition) #$says which speific columns you will use
#Fit the data using the Weibull1 model, fix the lower and upper limits
fitData= subset(myData, myData$Concentration >=0)
multi.m1 <- drm(Inhibition~Concentration, data = fitData, strain, fct = W2.2())
#Choose colors to doubble plots
#Check ot this link for col funktion https://www.statmethods.net/advgraphs/parameters.html
#And http://research.stowers.org/mcm/efg/R/Color/Chart/
#generate RGB code for Green=SM
rgb(0, 128, 0, maxColorValue=255)
#RGB Blue=TB
rgb(40, 70, 255, maxColorValue=255)
#Now i am working on a script to make nice looking plots with aid of:
#https://www.rdocumentation.org/packages/drc/versions/3.0-1/topics/plot.drc
#YES it makes a new window for each graph but whatever
dev.off()
dev.new(width=2.5, height=2.5)
par(mar=c(7,7,5,5))
plot(multi.m1,
type = "all",
col=c("#008000", "#2846FF", "#800000"),
broken = TRUE, bp = 6,   #this controls where the axis is cut
bcontrol = list(factor = 1.2), #= "defult", style = "gap", width = "0.02"), #this controls how the cut is made but not working yet
conName = "Control",
cex =  2, cex.axis=2, lty=c(1, 2), lwd=1, #size of: symbols, axis numbers, lines type, line thickness,  stuff
xlim = c(0,18), #Changes,  must be the same in the row below
ylim =c(-0.2,1.2),
xt = c(0, 8, 10, 12, 15, 18), #Specify x numbers
yt = c(-0.2, 0.2, 0.6, 1), #Specify y number
xlab = expression("Cu concentration (" *mu ~ "M)"), line = 5, cex.lab =2,
ylab = "Inhibition of growth rate",
legend = TRUE, legendPos = c(12, 1), legendText=c("RO5",Run_ID), cex.legend = 1.75, lwd.legend = 2,
#legend = FALSE, legendPos = c(1.75, 1), legendText=c("1.5h", "3h", "5h"), cex.legend = 2, lwd.legend = 2,
main = title(main = "T0", adj = 0.05, line = -2.5, cex.main = 2))
plot(bestDoseresponse_RO5.WB, col = "#008000", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
plot(bestDoseresponse_GP.WB, col = "#2846FF", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
dev.copy(pdf, output)
dev.off()
}
staple_pdf(input_directory = "./Plots" , input_files = NULL, output_filepath = "Plots/Fig_all.pdf")
## Houskeeping
rm(list=ls()) #remove ALL objects
Sys.setenv(LANG = "en") #Let's keep stuff in English
Sys.setlocale("LC_ALL","English")
graphics.off()
cat("\014") # clear console window prior to new runekeeping
# loading packages containing functions. Access the functions that these contain.
# check if you have these under packages
# you probably don't have it so you have to install it before. Everytime I start R studio
# I have to run these librarys.
################
#packages & functions
################
library(drc)
library(ggplot2)
library(staplr)
#first create individual .csv files based on .csv containing data of all strains
all = read.csv2("Doseresponse_all.csv")
for (name in levels(all$Running.ID)){
#Subset data based on Running.ID
tmp=subset(all,Running.ID==name)
#Create a new filename for each strain - the folder 'Files' should already exist
fn=paste("Files/Doseresponse_",gsub(' ','',name), ".csv", sep='')
#Save the CSV file containing separate expenses data for each strain
write.table(tmp,fn,row.names=FALSE, sep=",")
}
#1. Response prediction
f<- 1:32
f
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
# define name of Input and Output
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
output=paste("PR/PR_12.5?M_",i,".csv", sep="")
output1=paste("PR/PR_12.05?M_",i,".csv", sep="")
output2=paste("PR/PR_11.55?M_",i,".csv", sep="")
myData= read.csv(input, header=TRUE)
myData
#First look at the imported data
#drm = dose-response model for error plots (change model as needed)
fitData= subset(myData, myData$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
# predict response at specific concentration c(x)
Response= PR(bestDoseresponse.WB, c(12.5))
Response1= PR(bestDoseresponse.WB, c(12.05))
Response2= PR(bestDoseresponse.WB, c(11.55))
write.table(Response, file = output, sep=",",  col.names=FALSE, row.names = i)
write.table(Response1, file = output1, sep=",",  col.names=FALSE, row.names = i)
write.table(Response2, file = output2, sep=",",  col.names=FALSE, row.names = i)
}
# to get all predicted responses in one file go to terminal enter: copy PR_* PR_all.csv to combine to one csv file
# or: cd /Users/xanbjg/Documents/R/EC followed by cat *.csv > ECvalues_t0.csv
#2. EC-values
for (i in f) {
#loop goes through script putting 1-30 for i to run over every strain file
#i="RO5"
#i="MM"
# define name of Input and Output
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
output50=paste("EC/EC50_GP",i,".csv", sep="")
output5=paste("EC/EC5_GP",i,".csv", sep="")
output95=paste("EC/EC95_GP",i,".csv", sep="")
#Then make the GP-strain analysis
#Import data, note that ofloxacin2.csv uses "C" instead of 0 as a marker for the controls
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse.WB #give you the intercepts
a = coef(bestDoseresponse.WB)[1]
b = coef(bestDoseresponse.WB)[2]
#report the EC50
EC50=ED(bestDoseresponse.WB, respLev = 0.5, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC05
EC5=ED(bestDoseresponse.WB, respLev = 0.05, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
#report the EC95
EC95=ED(bestDoseresponse.WB, respLev = 0.95, type="absolute", interval="delta") #to get ED help file put ? in front of ED and run.
PLay = c(0.1, 0.5, 0.7, 0.9)
PLay
name50= paste(i,"0.5")
name5= paste(i,"0.05")
name95= paste(i,"0.95")
write.table(EC50, file= output50, col.names = FALSE, row.names = name50)
write.table(EC5, file= output5, col.names = FALSE, row.names = name5)
write.table(EC95, file= output95, col.names = FALSE, row.names = name95)
}
# to get all EC values in one file go to terminal enter: copy EC* EC_all_Cu_T0.csv to combine to one csv file
#3. Plot RO5 and GP_x
for (i in f) {
#If you want to compare only one strain with RO5:
# i=x  (x=Number of strain and run without "for (i in a) {" )
input=paste("Files/Doseresponse_GP_",i,".csv", sep="")
Run_ID=paste(i, sep="")
output=paste("Plots/Fig_",i,".pdf", sep="")
#First make the RO5 analysis
myData3= read.csv("Files/Doseresponse_RO5.csv", header=TRUE)
myData3
#First look at the imported data
plot(myData3$Concentration, myData3$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData3= subset(myData3, myData3$Concentration >=0)
bestDoseresponse_RO5.WB = drm(Inhibition~Concentration, data = fitData3, fct = W2.2())
bestDoseresponse_RO5.WB #give you the intercepts
a = coef(bestDoseresponse_RO5.WB)[1]
b = coef(bestDoseresponse_RO5.WB)[2]
#Then make the GP-strain analysis
#Import data
myData2= read.csv(input, header=TRUE)
myData2
#First look at the imported data
plot(myData2$Concentration, myData2$Inhibition) #$says which speific columns you will use
#drm = dose-response model for error plots (change model as needed)
fitData2= subset(myData2, myData2$Concentration >=0)
bestDoseresponse_GP.WB = drm(Inhibition~Concentration, data = fitData2, fct = W2.2())
bestDoseresponse_GP.WB #give you the intercepts
a = coef(bestDoseresponse_GP.WB)[1]
b = coef(bestDoseresponse_GP.WB)[2]
myData4= read.csv(input, header=TRUE, sep=",")
myData4
myData3
myData=merge(myData3,myData4, all= TRUE)
#Make doubble analysis: Works!
myData
#First look at the imported data
plot(myData$Concentration, myData$Inhibition) #$says which speific columns you will use
#Fit the data using the Weibull1 model, fix the lower and upper limits
fitData= subset(myData, myData$Concentration >=0)
multi.m1 <- drm(Inhibition~Concentration, data = fitData, strain, fct = W2.2())
#Choose colors to doubble plots
#Check ot this link for col funktion https://www.statmethods.net/advgraphs/parameters.html
#And http://research.stowers.org/mcm/efg/R/Color/Chart/
#generate RGB code for Green=SM
rgb(0, 128, 0, maxColorValue=255)
#RGB Blue=TB
rgb(40, 70, 255, maxColorValue=255)
#Now i am working on a script to make nice looking plots with aid of:
#https://www.rdocumentation.org/packages/drc/versions/3.0-1/topics/plot.drc
#YES it makes a new window for each graph but whatever
dev.off()
dev.new(width=2.5, height=2.5)
par(mar=c(7,7,5,5))
plot(multi.m1,
type = "all",
col=c("#008000", "#2846FF", "#800000"),
broken = TRUE, bp = 6,   #this controls where the axis is cut
bcontrol = list(factor = 1.2), #= "defult", style = "gap", width = "0.02"), #this controls how the cut is made but not working yet
conName = "Control",
cex =  2, cex.axis=2, lty=c(1, 2), lwd=1, #size of: symbols, axis numbers, lines type, line thickness,  stuff
xlim = c(0,18), #Changes,  must be the same in the row below
ylim =c(-0.2,1.2),
xt = c(0, 8, 10, 12, 15, 18), #Specify x numbers
yt = c(-0.2, 0.2, 0.6, 1), #Specify y number
xlab = expression("Cu concentration (" *mu ~ "M)"), line = 5, cex.lab =2,
ylab = "Inhibition of growth rate",
legend = TRUE, legendPos = c(12, 1), legendText=c("RO5",Run_ID), cex.legend = 1.75, lwd.legend = 2,
#legend = FALSE, legendPos = c(1.75, 1), legendText=c("1.5h", "3h", "5h"), cex.legend = 2, lwd.legend = 2,
main = title(main = "T0", adj = 0.05, line = -2.5, cex.main = 2))
plot(bestDoseresponse_RO5.WB, col = "#008000", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
plot(bestDoseresponse_GP.WB, col = "#2846FF", type = "confidence", xlim = c(7,18), lty=c(0), add = TRUE)
dev.copy(pdf, output)
dev.off()
}
staple_pdf(input_directory = "./Plots" , input_files = NULL, output_filepath = "Plots/Fig_all.pdf")
