Last active
April 19, 2025 15:10
-
-
Save grenkoca/fb801c16fa0fedfbe650cd08a9064fc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyr) | |
| library(dplyr) | |
| library(ggplot2) | |
| data <- data.frame( | |
| total_ligand_cpm = c(0, 12500, 25000, 50000, 100000, 175000, 250000, 400000, 900000), | |
| bound_cpm_total = c(0, 480, 850, 1550, 2850, 4750, 5760, 7190, 9980), | |
| bound_cpm_nonspecific = c(0, 50, 100, 200, 350, 650, 1200, 1900, 3600) | |
| ) | |
| data <- data %>% | |
| mutate(bound_cpm_specific = bound_cpm_total - bound_cpm_nonspecific) | |
| data <- data %>% | |
| mutate(free_cpm = total_ligand_cpm - bound_cpm_specific) | |
| # Need a conversion from CPM --> umole | |
| counter_efficiency = 0.55 | |
| conversion_factor = 2.2e12 | |
| specific_activity = 1.45 #Ci/µmole | |
| volume_factor = 1000/1 | |
| cpm_to_umole_factor <- 1 / (specific_activity * conversion_factor * counter_efficiency) # µmoles per CPM | |
| data <- data %>% | |
| mutate( | |
| total_ligand_uM = total_ligand_cpm * cpm_to_umole_factor * volume_factor, # Convert to µM | |
| bound_specific_uM = bound_cpm_specific * cpm_to_umole_factor * volume_factor, | |
| free_ligand_uM = free_cpm * cpm_to_umole_factor * volume_factor | |
| ) %>% | |
| mutate(bound_over_free_uM = bound_specific_uM / free_ligand_uM) | |
| # Remove the first row (0 values) | |
| data_scatchard <- data[-1, ] | |
| scatchard_plot <- ggplot(data_scatchard, | |
| aes(x = bound_specific_uM, | |
| y = bound_over_free_uM)) + | |
| geom_point() + | |
| geom_smooth(method = "lm", formula = y ~ x, se = FALSE, color = "blue") + | |
| labs( | |
| title = "Scatchard Plot", | |
| x = "Bound (µM)", | |
| y = "Bound/Free", | |
| caption = "Data in µM" | |
| ) + | |
| theme_minimal() | |
| scatchard_model <- lm(bound_over_free_uM ~ bound_specific_uM, data = data_scatchard) | |
| slope <- coef(scatchard_model)[2] | |
| intercept <- coef(scatchard_model)[1] | |
| Kd_uM <- -1/slope | |
| Bmax_uM <- intercept/(-slope) # This is how the algebra shakes out for y=mx+b when y=0, solving for x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment