药物组合的等效线图

时间:2017-02-05 20:00:36

标签: r

我是新手R用户。 我试图根据Tarralidar's work使用等效线图编写分析药物协同作用的代码 我不确定我是否正确使用,所以我尝试将药物与自己的药物结合起来并应用于我的代码。

这是我的数据

Master.data <- rbind(data.frame(Drug = "T1", Dose = c(1,0.5,0.25,0.125), Effect = c(0.5987,0.2382,0.0602,-0.0027), DrugID = "A"),
                 data.frame(Drug = "T2", Dose = c(1,0.5,0.25,0.125), Effect = c(0.5987,0.2382,0.0602,-0.0027), DrugID = "B"),
                 data.frame(Drug = "Combo", Dose = c(2,1,0.5,0.25), Effect = c(0.7774,0.5987,0.2382,0.0602), DrugID = "Combo")
                 )

我使用这些来配合药物与drc包,并使用ggplot2绘制结果代码。

library("ggplot2")
library("drc")
#Divide data into drug group
A <- subset(Master.data, DrugID == "A")
B <- subset(Master.data, DrugID == "B")
Combo <- subset(Master.data, DrugID == "Combo")
##########################################
#Dose response curve of Drug A
A.model <- drm(Effect~Dose, data = A, fct = LL.4())
CA <- ED(A.model,50)[1,1]
q <- data.frame(Value = coef(A.model))
p1 <- data.frame(S = seq(0.05, max(Master.data$Dose), length.out = 100))
p1 <- rbind(p1,CA)
p1$v <- predict(A.model, newdata = p1)
p1$Drug <- A[1,'Drug']
#########################################
#Dose response curve of Drug B
B.model <- drm(Effect~Dose, data = B, fct = LL.4())
CB <- ED(B.model,50)[1,1]
p <- data.frame(Value = coef(B.model))
p2 <- data.frame(S = seq(0.05, max(Master.data$Dose), length.out = 100))
p2 <- rbind(p2, CB)
p2$v <- predict(B.model, newdata = p2)
p2$Drug <- B[1,'Drug']
#########################################
#Dose response curve of Combo
Combo.model <- drm(Effect~Dose, data = Combo, fct = LL.4())
ComboED50 <- ED(Combo.model,50)[1,1]
p3 <- data.frame(S = seq(0.05, max(Master.data$Dose), length.out = 100))
p3 <- rbind(p3,ComboED50)
p3$v <- predict(Combo.model, newdata = p3)
p3$Drug <- Combo[1,'Drug']
##########################################
#Plot dose response for p1,p2,p3 
p <- rbind(p1,p2,p3)
ggplot(p, aes(x = S, y = v, col = Drug)) + geom_line()+
labs(title = "Dose response curve") + xlab("Dose uM (log scale)") + ylab("Growth inhibition") +
scale_x_log10() +
ylim(min(p$v),1) +
geom_point(data = subset(Master.data,Dose != 0), aes(x = Dose, y = Effect))
##########################################

其中产生合理的剂量 - 反应曲线。

现在我定义进一步计算所需的值。

#######Create dose combination#########
R <- max(A$Dose)/max(B$Dose) ## Ratio of drug A and B -> R=A/B
EA <- max(A$Effect) ## Maximum effect of drug A -> EA
EB <- max(B$Effect) ## Maximum effect of drug B -> EB
CA <- ED(A.model,50)[1,1] ## Half maximum effect of drug A
CB <- ED(B.model,50)[1,1] ## Half maximum effect of drug B

创建用于绘制药物组合点的表格

Combo.table <- data.frame(Combo$Dose)
Combo.table <- rbind(Combo.table,0)
for (i in c(1:99)) {
 Combo.table <- rbind(Combo.table,ED(Combo.model,i)[1,1])
}
Combo.table$A <- (Combo.table[,1]*R)/(R+1)
Combo.table$B <- Combo.table[,1]/(1+R)
colnames(Combo.table) <- c("Combo","A","B")

使用此功能,我创建了等效线图,可以应用于药物组合,每种药物具有不同的最大效果。

Iso <- function(i) {
         Isolobe <- data.frame(seq(0,ED(A.model,i)[1,1],length.out = 100))
         Isolobe <- rbind(Isolobe,CA)
         colnames(Isolobe) <- "Dose.a"
         Isolobe$Dose.b <- ED(B.model,i)[1,1]-(CB/(((EB/EA)*(1+(CA/Isolobe$Dose.a)))-1))

         ggplot(Isolobe, aes(x = Dose.a,y = Dose.b)) +
         geom_line() +
         xlab(A[1,"Drug"]) + ylab(B[1,"Drug"]) + labs(title = "Isobologram", subtitle = "Dose in uM") +
         geom_point(data = subset(Combo.table,Combo==ED(Combo.model,i)[1,1]), aes(x = A,y = B))
}

有了这一切,我执行了这个功能。

Iso(50)

应该为组合的ED50创建Isobologram并绘制药物A,B点的分数。

问题来自这个样本,我故意使用相同的药物A,B数据和组合数据来自一层更多相同的数据。这应该指出添加剂系上的药物部分。显然,它不是。

底线是我做错了什么?

0 个答案:

没有答案