https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Disoci_ejemplo1.csv
if(!require("pacman"))
install.packages("pacman")
## Cargando paquete requerido: pacman
## Warning: package 'pacman' was built under R version 4.5.2
if(!require("tidyr"))
install.packages("tidyr")
## Cargando paquete requerido: tidyr
library("pacman")
p_load("ggplot2",
"dplyr",
"vroom",
"ggrepel",
"plotly")
Datos_PCR4 <- vroom(file="https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Disoci_ejemplo1.csv")
## Rows: 55 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (6): Temperature, A1, B1, C1, D1, E1
##
## ℹ 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.
Curvar_PCR <- Datos_PCR4 %>%
mutate(Temperatura = Temperature, DDR = A1, JRWF = B1, PPDF = C1, MLL = D1, H2O = E1) %>%
select(-Temperature:-E1) %>%
filter(Temperatura >= 17)
Curvar_PCR
## # A tibble: 55 × 6
## Temperatura DDR JRWF PPDF MLL H2O
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 65 1.96 1.98 2.11 2.11 0.0869
## 2 65.5 1.94 1.99 2.06 2.08 0.0834
## 3 66 1.89 1.93 2.03 2.07 0.0932
## 4 66.5 1.86 1.89 1.98 2.02 0.0676
## 5 67 1.82 1.89 1.94 1.98 0.0738
## 6 67.5 1.77 1.83 1.90 1.93 0.0766
## 7 68 1.74 1.78 1.86 1.87 0.0686
## 8 68.5 1.70 1.76 1.79 1.84 0.0689
## 9 69 1.65 1.71 1.79 1.80 0.0665
## 10 69.5 1.60 1.64 1.75 1.76 0.0744
## # ℹ 45 more rows
Curvar_PCR2 <- Curvar_PCR %>%
pivot_longer(cols=-Temperatura,
names_to="muestras",
values_to="Fluorescencias")
Curvar_PCR2
## # A tibble: 275 × 3
## Temperatura muestras Fluorescencias
## <dbl> <chr> <dbl>
## 1 65 DDR 1.96
## 2 65 JRWF 1.98
## 3 65 PPDF 2.11
## 4 65 MLL 2.11
## 5 65 H2O 0.0869
## 6 65.5 DDR 1.94
## 7 65.5 JRWF 1.99
## 8 65.5 PPDF 2.06
## 9 65.5 MLL 2.08
## 10 65.5 H2O 0.0834
## # ℹ 265 more rows
Graficar_PCR <- ggplot(Curvar_PCR2,
mapping = aes(x = Temperatura,
y = Fluorescencias,
color = muestras)) +
geom_line(linewidth = 1.5)+
theme_classic()+
labs(title="Curvas de disociacion",
subtitle="Todas las muestras",
caption="Diseño: Juana Rosetti",
x="Temperatura (°C)",
y="Fluorescencia (u.a.)")+
theme(axis.line = element_line(size = 1.2, color="#c0b5e3"),
axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
legend.text = element_text(face = "bold"))
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Graficar_PCR

Derivarr_PCR <- Curvar_PCR %>%
mutate(across(DDR:H2O,
~-c(NA, diff(.x)/diff(Curvar_PCR$Temperatura)), .names="d.{.col}")) %>%
select(-DDR:-H2O) %>%
slice(-1)
Derivarr_PCR
## # A tibble: 54 × 6
## Temperatura d.DDR d.JRWF d.PPDF d.MLL d.H2O
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 65.5 0.0365 -0.0147 0.0940 0.0711 0.00703
## 2 66 0.102 0.108 0.0614 0.0146 -0.0197
## 3 66.5 0.0695 0.0883 0.112 0.108 0.0512
## 4 67 0.0652 0.00898 0.0646 0.0772 -0.0123
## 5 67.5 0.109 0.114 0.0903 0.0923 -0.00567
## 6 68 0.0666 0.0994 0.0707 0.122 0.0162
## 7 68.5 0.0774 0.0335 0.139 0.0558 -0.000754
## 8 69 0.0860 0.0979 -0.00165 0.0850 0.00488
## 9 69.5 0.111 0.146 0.0908 0.0844 -0.0159
## 10 70 0.0582 0.0279 0.130 0.0864 0.00967
## # ℹ 44 more rows
Derivarr_PCR2 <- Derivarr_PCR %>%
pivot_longer(cols=-Temperatura,
names_to="Muestras",
values_to="Derivadas")
Derivarr_PCR2
## # A tibble: 270 × 3
## Temperatura Muestras Derivadas
## <dbl> <chr> <dbl>
## 1 65.5 d.DDR 0.0365
## 2 65.5 d.JRWF -0.0147
## 3 65.5 d.PPDF 0.0940
## 4 65.5 d.MLL 0.0711
## 5 65.5 d.H2O 0.00703
## 6 66 d.DDR 0.102
## 7 66 d.JRWF 0.108
## 8 66 d.PPDF 0.0614
## 9 66 d.MLL 0.0146
## 10 66 d.H2O -0.0197
## # ℹ 260 more rows
Graficar_PCR <- ggplot(Derivarr_PCR2,
aes(x=Temperatura,
y=Derivadas,
color=Muestras))+
geom_line(linewidth = 1.5)+
theme_classic()+
labs(title="Curvas de la derivada de disociacion",
subtitle="Todas las muestras",
caption="Diseño: Juana Rosetti",
x="Temperatura (°C)",
y=expression(-Delta~F/Delta~T))+
theme(axis.line = element_line(size = 1.2, color="#c0b5e3"),
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(Derivarr_PCR2$Temperatura),
max(Derivarr_PCR2$Temperatura),
by = 2))
Graficar_PCR

Graficar_PCR_3D <- plot_ly(Derivarr_PCR2,
x=~Temperatura,
y=~Muestras,
z=~Derivadas,
color=~factor(Muestras),
type="scatter3d",
mode="lines",
line=list(width=6)) %>%
layout(title = "Curvas de derivada en 3D",
scene=list(
xaxis=list(title="Temperatura (C°)"),
yaxis=list(title="Muestras"),
zaxis=list(title="-DeltaT/DeltaF")
))
Graficar_PCR_3D