diff --git a/ic50_r.Rmd b/ic50_r.Rmd index b30a9b1..9841283 100644 --- a/ic50_r.Rmd +++ b/ic50_r.Rmd @@ -1,44 +1,75 @@ --- title: "R Notebook" output: html_notebook --- # Strat of the script The very begiining of the project should be simply, to take a file and to get the name of the coloumns and the data in the file. The file will be then stored in a data.frame (df) and the program will calculate the rest It would be nice to ask the user to select in the data.frame the coloumns tha can be used for the IC50 and efficacy calculation ```{r} #getting the data from the user, asking to select the excel csv file the file print("Now you will be promted to choose a file, please choose a valid csv file") df <- read.csv(file = file.choose(new = TRUE), sep = ";", header = TRUE) +df <- df[,-c(5:9)] ``` Plotting the drug Vs concentration ```{r} library(tidyverse) -ggplot(df, aes(x = df[,1], y = df[,2])) + +par(mfrow=c(ncol(df)/2,(df)/2)) +for (i in seq(2:ncol(df))){ + plot(x = df[,"Dose"], y = df[,i], + main = "Drug effect", + ylab = "Effect", + xlab = "Drug concentration (µM)") + ylim(0, 1) + df_a = subset(df, colnames(df[, i]) != colnames(i)) +} + +dev.off() + #geom_smooth(method = "lm", + formula = df[,1] ~ poly(df[,3], 3, raw=F), ### polynomial of order 2 + se = F) + +#to make sure the code work +for (i in seq(3:ncol(df))){ + print("pippo") +} + +``` + +# Doing it with ggplot2 + +```{r} + +for (i in seq(2:ncol(df))){ +ggplot(df, aes(x = df["Dose"], y = df[,i])) + ggtitle("Drug effect")+ geom_point(size = 3) + geom_line() + ylab("Effect") + xlab("Drug concentration (µM)")+ theme_bw() - +} ``` + + I will try to include a regression line and calculate the IC50 ```{r} #calculation of the lm -regresssion <- lm(data = df, formula = Dose ~ Drug.1) +regresssion <- lm(data = df, formula = Dose ~ Drug.3) summary(regresssion) +coefficients(regresssion) ```