if(!require(pacman))
install.packages("pacman")
## Loading required package: pacman
## Loading required package: pacman
library("pacman")
install.packages("dplyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library("dplyr")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
p_load("vroom",
"dplyr",
"ggplot2",
"tidyr",
"ggrepel",
"plotly")
Melting_curves <- vroom("https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Disociaci%C3%B3n_Grupo1_17022024.csv")
## Rows: 61 Columns: 7
## āā Column specification āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
## Delimiter: ","
## dbl (7): Temperature, A1, B1, C1, D1, E1, F1
##
## ā¹ 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.
Melting_curves
modificar la base de datos
Melting_curves2 <- Melting_curves %>%
mutate(Temperatura = Temperature,PPDA = A1, ZARX = B1, F2S2 = C1, LANS =D1, NEGATIVO = E1, D2MI = F1) %>%
select(-Temperature:-F1)
Melting_curves2
Agrupacion de datos
Melting_curves3 <- Melting_curves2 %>%
pivot_longer(cols = -Temperatura,
names_to = "Muestras",
values_to = "Fluorescencias")
Melting_curves3
Grafica
Grafica_melting <- ggplot(Melting_curves3,
aes(x=Temperatura,
y=Fluorescencias,
color=Muestras))+
geom_line(linewidth=1.5)+
labs(title = "Curvas de disociación",
subtitle = "Todas las muestras",
caption = "Diseñó: zulia, renata, ximena, ana gaby",
x="Temperatura(ĀŗC)",
y="Fluorescencia (u.a)")+
theme(axis.line = element_line(size = 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"))
## 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.
Grafica_melting
Derivadas de las curvas de disociacion
Derivadas <- Melting_curves2 %>%
mutate(across(PPDA:D2MI,
~-c(NA, diff(.x)/diff(Melting_curves2$Temperatura)), .names = "d_{.col}")) %>%
select(-PPDA: -D2MI) %>%
slice(-1)
Derivadas
Reordenar los datos
Derivadas2 <- Derivadas %>%
pivot_longer(cols = -Temperatura,
names_to = "Muestras",
values_to = "Derivadas")
Derivadas2
Graficas Derivadas
Grafica_derivada <- ggplot(Derivadas2,
aes(x=Temperatura,
y=Derivadas,
color=Muestras))+
geom_line(linewidth=1.5)+
theme_classic( )+
labs(title = "Curvas de la derivada de disociación",
subtitle = "Todas las muestras",
caption = "Diseñó: zulia, renata, ximena, ana gaby",
x="Temperatura(ĀŗC)",
y=expression(-Delta-F/Delta-T))+
theme(axis.line = element_line(size = 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=2.5))
Grafica_derivada
Construir una grƔfica 3D
Grafica_derivada_3D <- plot_ly(Derivadas2,
x= ~Temperatura,
y= ~Muestras,
z= ~Derivadas,
color=~factor(Muestras),
type="scatter3d",
mode="lines",
line=list(width=6)) %>%
layout(title="Curva de derivada en 3D",
scene=list(),
xaxis=list(title="Temperarura(ĀŗC)"),
yaxis=list(title="Muestras"),
zaxis=list(title="-ĪT/ĪF"))
Grafica_derivada_3D
## Warning: 'layout' objects don't have these attributes: 'zaxis'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'smith', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'
Grafica del equipo
Grafica_derivada_equipo <- ggplot(Derivadas,
aes(x=Temperatura))+
geom_line(aes(y= d_ZARX, color = "d_ZARX"), linewidth = 1.2) + # Leyenda para la lĆnea ZARX
geom_line(aes(y= d_NEGATIVO, color="d_NEGATIVO"),linewidth=1.2)+
scale_color_manual(values = c("d_ZARX" = "#ce9df2", "d_NEGATIVO" = "#49c1e1"))+
theme_classic()+
labs(title = "Derivadas de disociación",
subtitle = "Tejido:Cerebro",
caption= "Diseñó: Zulia, Renata, Ximena, Ana Gaby",
x="Temperatura",
y=expression(-Delta-F/Delta-T))+
theme(axis.line = element_line(size = 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=2.5))
Grafica_derivada_equipo
Etiquetas
Pico <- max(Derivadas$d_ZARX)
Pico
## [1] 43.78384
Temperatura
Tm <- Derivadas %>%
filter(d_ZARX==Pico) %>%
select(Temperatura, d_ZARX)
Tm
Grafica con etiqueta
Grafica_derivada_equipo2 <- Grafica_derivada_equipo+
geom_vline(xintercept = Tm$Temperatura, color="#ce9df2",
linetype="dashed",
linewidth=1)+
geom_label_repel(data=Tm,
aes(x=Temperatura,
y= d_ZARX,
label=paste("Tm=", round(Temperatura),"ĀŗC")),
nudge_x=4,
nudge_y = -0.03,
max.overlaps = 100,
color="black",
fill="#ce9df2")
Grafica_derivada_equipo2