Cargar paquetes y base de datos
library("pacman") #esta función llama al paquete instalado
p_load("ggplot2", #para graficar
"dplyr", #para facilitar el manejo de datos
"vroom", "tidyr","plotly") #llamar repositorios
# Importar datos
Curvas_disoc <- vroom(file="https://raw.githubusercontent.com/ManuelLaraMVZ/Metabolomica_2026_1/refs/heads/main/Metabolo%CC%81mica%20curvas%20de%20disociacio%CC%81n_ambos%20grupos.csv")
## New names:
## Rows: 61 Columns: 10
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," dbl
## (9): Temperature, 50 ng, 10 ng, 5 ng, 1 ng, 0.5 ng, 0.01 ng, G1-M, G2-M lgl
## (1): ...8
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...8`
Curvas_disoc
## # A tibble: 61 × 10
## Temperature `50 ng` `10 ng` `5 ng` `1 ng` `0.5 ng` `0.01 ng` ...8 `G1-M`
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl> <dbl>
## 1 65 9.19 7.45 27.2 33.5 48.5 -9.81 NA 23.0
## 2 65.5 19.9 16.1 37.9 42.1 57.1 0.920 NA 49.8
## 3 66 18.4 14.9 36.4 40.9 55.9 -0.612 NA 45.9
## 4 66.5 18.4 14.9 36.4 40.9 55.9 -0.612 NA 45.9
## 5 67 18.4 14.9 36.4 40.9 55.9 -0.612 NA 45.9
## 6 67.5 18.3 14.7 36.3 40.7 55.7 -0.732 NA 45.5
## 7 68 19.0 15.7 37.0 41.7 56.7 0.0162 NA 48.3
## 8 68.5 20.4 17.8 38.4 43.8 58.8 1.39 NA 53.4
## 9 69 21.5 19.1 39.5 45.1 60.1 2.46 NA 56.6
## 10 69.5 23.0 19.9 41.0 45.9 60.9 4.01 NA 58.9
## # ℹ 51 more rows
## # ℹ 1 more variable: `G2-M` <dbl>
Modificar datos
Curvas_disoc2 <- Curvas_disoc %>%
mutate(
Temperatura = Temperature,
) %>%
select(-...8, -`G1-M`,-Temperature)
Curvas_disoc2
## # A tibble: 61 × 8
## `50 ng` `10 ng` `5 ng` `1 ng` `0.5 ng` `0.01 ng` `G2-M` Temperatura
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 9.19 7.45 27.2 33.5 48.5 -9.81 37.0 65
## 2 19.9 16.1 37.9 42.1 57.1 0.920 63.8 65.5
## 3 18.4 14.9 36.4 40.9 55.9 -0.612 59.9 66
## 4 18.4 14.9 36.4 40.9 55.9 -0.612 59.9 66.5
## 5 18.4 14.9 36.4 40.9 55.9 -0.612 59.9 67
## 6 18.3 14.7 36.3 40.7 55.7 -0.732 59.5 67.5
## 7 19.0 15.7 37.0 41.7 56.7 0.0162 62.3 68
## 8 20.4 17.8 38.4 43.8 58.8 1.39 67.4 68.5
## 9 21.5 19.1 39.5 45.1 60.1 2.46 70.6 69
## 10 23.0 19.9 41.0 45.9 60.9 4.01 72.9 69.5
## # ℹ 51 more rows
Graficar
Curvas_disoc3 <- Curvas_disoc2 %>%
pivot_longer(cols = -Temperatura,
names_to = "Muestras",
values_to = "Fluorescencias")
Curvas_disoc3
## # A tibble: 427 × 3
## Temperatura Muestras Fluorescencias
## <dbl> <chr> <dbl>
## 1 65 50 ng 9.19
## 2 65 10 ng 7.45
## 3 65 5 ng 27.2
## 4 65 1 ng 33.5
## 5 65 0.5 ng 48.5
## 6 65 0.01 ng -9.81
## 7 65 G2-M 37.0
## 8 65.5 50 ng 19.9
## 9 65.5 10 ng 16.1
## 10 65.5 5 ng 37.9
## # ℹ 417 more rows
Derivadas
Derivadas <- Curvas_disoc2 %>%
mutate(
across(
c(`50 ng`,`10 ng`, `5 ng`, `1 ng`, `0.5 ng`, `0.01 ng`),
~ -c(NA, diff(.x) / diff(Temperatura)),
.names = "d_{.col}"
)
) %>%
select(Temperatura, starts_with("d_")) %>%
slice(-1)
Derivadas
## # A tibble: 60 × 7
## Temperatura `d_50 ng` `d_10 ng` `d_5 ng` `d_1 ng` `d_0.5 ng` `d_0.01 ng`
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 65.5 -21.5 -17.4 -21.5 -17.4 -17.4 -21.5
## 2 66 3.06 2.48 3.06 2.48 2.48 3.06
## 3 66.5 0 0 0 0 0 0
## 4 67 0 0 0 0 0 0
## 5 67.5 0.240 0.325 0.240 0.325 0.325 0.240
## 6 68 -1.50 -1.99 -1.50 -1.99 -1.99 -1.50
## 7 68.5 -2.74 -4.14 -2.74 -4.14 -4.14 -2.74
## 8 69 -2.14 -2.51 -2.14 -2.51 -2.51 -2.14
## 9 69.5 -3.11 -1.62 -3.11 -1.62 -1.62 -3.11
## 10 70 -4.20 -4.74 -4.20 -4.74 -4.74 -4.20
## # ℹ 50 more rows
Reordenar datos
Derivadas2 <- Derivadas %>%
pivot_longer(cols = -Temperatura,
names_to = "Muestras",
values_to = "Derivadas")
Derivadas2
## # A tibble: 360 × 3
## Temperatura Muestras Derivadas
## <dbl> <chr> <dbl>
## 1 65.5 d_50 ng -21.5
## 2 65.5 d_10 ng -17.4
## 3 65.5 d_5 ng -21.5
## 4 65.5 d_1 ng -17.4
## 5 65.5 d_0.5 ng -17.4
## 6 65.5 d_0.01 ng -21.5
## 7 66 d_50 ng 3.06
## 8 66 d_10 ng 2.48
## 9 66 d_5 ng 3.06
## 10 66 d_1 ng 2.48
## # ℹ 350 more rows
Graficar
Grafica_disoc <- ggplot(Curvas_disoc3,
aes(x = Temperatura,
y = Fluorescencias,
color = Muestras)) +
geom_line(linewidth = 0.8) +
theme_classic() +
labs(title = "Práctica 3: Curvas de disociación",
caption = "Diseño: Yaniv Bar Yosef, Abril Nava y Valeria Plata",
x = "Temperatura (°C)",
y = "Fluorescencia (u.a.)")
Grafica_disoc
Gráfica de disociación derivada
Grafica_derivada <- ggplot(Derivadas2,
aes(x = Temperatura,
y = Derivadas,
color = Muestras)) +
geom_line(linewidth = 0.5) +
theme_classic() +
labs(title = "Curvas de la derivada de disociación",
subtitle = "Todas las muestras",
caption = "Diseño: Yaniv Bar Yosef, Abril Nava y Valeria Plata",
x = "Temperatura (°C)",
y = expression(-Delta~F / Delta~T)) +
theme(axis.line = element_line(linewidth = 1.2, color = "black"),
axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
legend.text = element_text(face = "bold")) +
scale_x_continuous(breaks = seq(min(Derivadas2$Temperatura),
max(Derivadas2$Temperatura),
by = 1.5))
Grafica_derivada