Last updated: 2025-03-10
Checks: 6 1
Knit directory: CX5461_Project/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20250129)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version cf95313. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .RData
Ignored: .Rhistory
Ignored: .Rproj.user/
Unstaged changes:
Modified: analysis/DRC.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/DRC.Rmd
) and HTML
(docs/DRC.html
) files. If you’ve configured a remote Git
repository (see ?wflow_git_remote
), click on the hyperlinks
in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | df69a87 | sayanpaul01 | 2025-03-07 | Commit |
html | df69a87 | sayanpaul01 | 2025-03-07 | Commit |
library(drc)
Warning: package 'drc' was built under R version 4.3.2
Warning: package 'MASS' was built under R version 4.3.1
# Load Data
DRC <- read.csv("data/CX-5461.csv")
DRC2 <- read.csv("data/DOX.csv")
# Fit dose-response models (including 0 concentration for curve fitting)
curved_fit <- drm(Ratio ~ Conc, data = DRC, fct = LL.4(c(NA, NA, 1, NA),
names = c("hill", "min_value", "max_value", "EC_50")))
curved_fit2 <- drm(Ratio ~ Conc, data = DRC2, fct = LL.4(c(NA, NA, 1, NA),
names = c("hill", "min_value", "max_value", "EC_50")))
# **Extract EC50 (LD50) Values**
EC50_CX <- summary(curved_fit)$coefficients["EC_50:(Intercept)", "Estimate"]
EC50_DOX <- summary(curved_fit2)$coefficients["EC_50:(Intercept)", "Estimate"]
# Define X-axis range (ensuring it starts from 0)
x_min <- min(c(DRC$Conc, DRC2$Conc)) # Keep 0 for the curves
x_max <- max(c(DRC$Conc, DRC2$Conc)) # Maximum concentration
x_range <- seq(x_min, x_max, length.out = 100) # Generate smooth curve range
# **Create Base Plot with CX-5461 Curve (Thicker Line)**
plot(curved_fit, col = "blue", xlab = "Concentration (µM)", ylab = "Proportion of Viable Cells",
confidence.level = 0.95, type = "all", main = "Dose-Response Curves with LD50",
xlim = c(x_min, x_max), lwd = 3.5)
# **Add DOX Curve (Thicker Line)**
plot(curved_fit2, col = "red", confidence.level = 0.95, type = "all", add = TRUE, lwd = 3.5)
# **Ensure we exclude 0 concentration points before plotting**
DRC_no_zero <- subset(DRC, Conc > 0)
DRC2_no_zero <- subset(DRC2, Conc > 0)
# **Function to Add Individual Points**
add_points <- function(data, color) {
data <- subset(data, Conc > 0) # Remove 0 concentration points
data$Ind <- as.numeric(data$Ind)
# Assign shapes for each individual
shape_mapping <- c(15, 16, 17) # Square, Circle, Triangle
for (i in seq_along(shape_mapping)) {
ind_subset <- subset(data, Ind == i)
if (nrow(ind_subset) > 0) {
points(ind_subset$Conc, ind_subset$Ratio,
pch = shape_mapping[i], col = color, cex = 2, lwd = 2)
}
}
}
# **Now call add_points() with the filtered datasets (without 0 concentration points)**
add_points(DRC_no_zero, "blue")
add_points(DRC2_no_zero, "red")
# **Add Vertical LD50 (EC50) Lines**
abline(v = EC50_CX, col = "blue", lty = 2, lwd = 2) # CX-5461 LD50 Line (Dashed)
abline(v = EC50_DOX, col = "red", lty = 2, lwd = 2) # DOX LD50 Line (Dashed)
# **Add Labels for LD50**
text(EC50_CX, 0.5, labels = paste("LD50 CX:", round(EC50_CX, 2)), col = "blue", pos = 4, cex = 0.5, font = 2)
text(EC50_DOX, 0.5, labels = paste("LD50 DOX:", round(EC50_DOX, 2)), col = "red", pos = 4, cex = 0.5, font = 2)
# **Add Legends**
legend("topright", legend = c("CX-5461", "DOX"), col = c("blue", "red"), lty = 1, lwd = 3.5)
legend("bottomleft", title = "Individuals", legend = c("1", "2", "3"),
col = "black", pch = c(15, 16, 17), cex = 1.2)
Version | Author | Date |
---|---|---|
df69a87 | sayanpaul01 | 2025-03-07 |
# Load necessary libraries
library(drc)
# Fit dose-response models
curved_fit_CX <- drm(Ratio ~ Conc, data = DRC, fct = LL.4())
curved_fit_DOX <- drm(Ratio ~ Conc, data = DRC2, fct = LL.4())
# Extract EC50 values with confidence intervals
EC50_CX <- ED(curved_fit_CX, 50, interval = "delta")
Estimated effective doses
Estimate Std. Error Lower Upper
e:1:50 8.9057 3.6539 1.1966 16.6147
EC50_DOX <- ED(curved_fit_DOX, 50, interval = "delta")
Estimated effective doses
Estimate Std. Error Lower Upper
e:1:50 0.57065 0.43538 -0.36315 1.50444
# Extract EC50 estimates and standard errors (Corrected)
EC50_CX_value <- EC50_CX[1,1] # First row, first column
EC50_CX_SE <- EC50_CX[1,2] # First row, second column (Standard Error)
EC50_DOX_value <- EC50_DOX[1,1] # First row, first column
EC50_DOX_SE <- EC50_DOX[1,2] # First row, second column (Standard Error)
# Perform a z-test to compare EC50 values
z_score <- abs(EC50_CX_value - EC50_DOX_value) / sqrt(EC50_CX_SE^2 + EC50_DOX_SE^2)
p_value <- 2 * (1 - pnorm(z_score)) # Two-tailed test
# Print results
print(paste("EC50 for CX-5461:", round(EC50_CX_value, 2)))
[1] "EC50 for CX-5461: 8.91"
print(paste("EC50 for DOX:", round(EC50_DOX_value, 2)))
[1] "EC50 for DOX: 0.57"
print(paste("P-value:", p_value))
[1] "P-value: 0.0235055023198667"
# Interpretation
if (p_value < 0.05) {
print("The EC50 values are significantly different (p < 0.05).")
} else {
print("The EC50 values are NOT significantly different (p ≥ 0.05).")
}
[1] "The EC50 values are significantly different (p < 0.05)."
sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] drc_3.0-1 MASS_7.3-60
loaded via a namespace (and not attached):
[1] sandwich_3.1-1 sass_0.4.9 gtools_3.9.5 stringi_1.8.3
[5] lattice_0.22-5 digest_0.6.34 magrittr_2.0.3 evaluate_1.0.3
[9] grid_4.3.0 mvtnorm_1.3-2 fastmap_1.1.1 rprojroot_2.0.4
[13] workflowr_1.7.1 jsonlite_1.8.9 Matrix_1.6-1.1 whisker_0.4.1
[17] Formula_1.2-5 survival_3.7-0 multcomp_1.4-26 promises_1.3.0
[21] scales_1.3.0 TH.data_1.1-2 codetools_0.2-20 jquerylib_0.1.4
[25] abind_1.4-8 cli_3.6.1 rlang_1.1.3 munsell_0.5.1
[29] splines_4.3.0 plotrix_3.8-4 cachem_1.0.8 yaml_2.3.10
[33] tools_4.3.0 colorspace_2.1-0 httpuv_1.6.15 vctrs_0.6.5
[37] R6_2.5.1 zoo_1.8-12 lifecycle_1.0.4 git2r_0.35.0
[41] stringr_1.5.1 fs_1.6.3 car_3.1-3 pkgconfig_2.0.3
[45] pillar_1.10.1 bslib_0.8.0 later_1.3.2 glue_1.7.0
[49] Rcpp_1.0.12 xfun_0.50 tibble_3.2.1 rstudioapi_0.17.1
[53] knitr_1.49 htmltools_0.5.8.1 rmarkdown_2.29 carData_3.0-5
[57] compiler_4.3.0