我有一个数据集如下。我想使用
drc
包绘制剂量反应曲线以显示 IC50 值。
df <- structure(list(conc = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L), levels = c("0", "0.1", "1", "10", "100", "1000",
"10000", "30000", "60000", "90000", "100000", "DMSO"), class = "factor"),
fl = c(100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 63.21225779,
101.8706211, 126.2780865, 111.5314588, 96.09426602, 78.24238472,
96.09755918, 100.5283698, 91.27381472, 97.37499067, 115.0726428,
122.5959865, 85.41762336, 179.9769368, 98.35492747, 100.5908253,
84.26773394, 101.4552505, 125.1702075, 95.88848656, 82.24099899,
110.2141294, 79.66828574, 90.02040403, 94.98167177, 99.46936453,
119.7006765, 130.5157993, 78.18920918, 96.01585941, 102.5847831,
108.9026336, 101.5528383, 79.31066707, 115.2681603, 89.6393365,
117.9085333, 96.37725618, 91.7460037, 102.0326665, 91.31663206,
90.26150215, 97.92890336, 114.4366954, 96.87187883, 109.927939,
107.3011341, 102.2116202, 96.90044379, 100.2864878, 92.65414961,
96.18469623, 93.8303407, 140.0548471, 98.65695034, 92.83672632,
106.3178975, 103.0082607, 99.91031153, 116.7370842, 100.0813435,
101.2193641, 114.7206302, 100.5724823, 129.0270352, 101.4296353,
78.85143217, 116.4561314, 110.9225058, 95.51300981, 95.82320759,
112.0002344, 153.6020867, 88.55315754, 62.40109088, 77.81809955,
82.93065795, 92.28863559, 68.89955766, 98.32670152, 100.4676841,
51.65315094, 92.33042129, 115.9890869, 83.31973839, 53.25314434,
168.4599862, 49.95222165, 76.48054079, 0.887138442, -0.584344871,
0.416501996, 45.54363915, 23.61298376, 23.16807216, 4.571463311,
3.184265707, 0.919448776, 0.451929132, -1.014153522, -1.039708501,
1.397715644, 0.051578618, 0.790341673, 5.248865072, 46.02295576,
44.89215709, 25.50864995, 51.47704304, 39.381729, 22.5317588,
14.1313762, -0.42971322, 26.95053851, 36.55531489, 21.38622522,
7.384904715, 1.105835897, 1.913830946, -0.168468303, -0.320132148,
23.98090175, 8.798552887, 5.042674912, 2.967859167, -1.471078129,
0.163655876, -0.326592551)), class = "data.frame", row.names = c(NA,
-148L))
这个
df
数据框我想从中计算 IC50。我一直在使用以下代码:
library(drc)
model <- drm(fl ~ as.numeric(conc), data=df, fct=LL.4(names=c("Slope", "Lower Limit", "Upper Limit", "IC50")))
model
#note the IC50 value of 7.577
现在当我绘制模型时
plot(model, type="all", xlab="Concentration", ylab="Normalised Fluorescence", log="x")
这给出了对数 x 轴。当我试图通过将 log = "x" 更改为 log = "" 来回到我的原始轴时,我得到了这个:
但是回顾一下我最初的浓度,我的值是 0-90,000,而不是图表显示的 0-12。如何将 x 轴更改为我的实际浓度值?我的 IC50 是 7.577,这对于图中给出的比例来说是有意义的,但在我的实际浓度单位中却不是。那么我该如何将 IC50 值也转换回正确的比例呢?
要转换为
"numeric"
,您需要先转换"factor"
s as.character
,请参阅这些答案。
df$conc_num <- as.numeric(as.character(df$conc))
library(drc)
model <- drm(fl ~ conc_num, data=df, fct=LL.4(names=c("Slope", "Lower Limit", "Upper Limit", "IC50")))
plot(model, type="all", xlab="Concentration", ylab="Normalised Fluorescence", log='x')