Para hacer Chunks se pone Comd+Opt+I /Cntr+Alt+I
Instalación y carga de la paquetería
if (!require("pacman")) {
install.packages("pacman")
}
## Loading required package: pacman
Llamar a la paquetería
p_load("vroom", "dplyr", "ggplot2")
Llamar a la base de datos
Datos <- vroom(file="https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Amplif_grupo1_17022025.csv")
## Rows: 40 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (7): Cycle, 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.
head(Datos)
## # A tibble: 6 × 7
## Cycle A1 B1 C1 D1 E1 F1
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 -102. -96.3 -30.2 -57.5 -60.7 -100.0
## 2 2 -46.9 -39.8 -0.971 -16.8 -12.0 -34.5
## 3 3 -25.6 -31.8 -3.10 -2.28 -4.90 -3.92
## 4 4 -9.65 -18.3 -0.329 -2.69 2.27 6.58
## 5 5 0.218 -7.14 -2.26 -1.22 -4.61 2.03
## 6 6 -4.12 5.18 2.76 2.04 1.99 2.53
Seleccioar solo un pozo (una muestra) A1:Abril B1:Sofi C1: D1: E1: F1:Manuel
Datos_filtrados <- Datos |>
select("Cycle", "A1")
head(Datos_filtrados)
## # A tibble: 6 × 2
## Cycle A1
## <dbl> <dbl>
## 1 1 -102.
## 2 2 -46.9
## 3 3 -25.6
## 4 4 -9.65
## 5 5 0.218
## 6 6 -4.12
Construir gráfica
amplificacion <- ggplot(Datos_filtrados,
aes(x= Cycle,
y= A1)) +
geom_line()+
geom_point()
amplificacion
Mejora la gráfica con Copilot
amplificacion2 <- ggplot(Datos_filtrados,
aes(x = Cycle,
y = A1)) +
geom_line(color = "#6527F5", linewidth = 1.5) +
#geom_point(color = "#F527BE", size = 3.5) +
labs(
title = "Gráfica de amplificación",
subtitle = "Cerebro",
caption = "Manuel Lara",
x = "Ciclos",
y = "Fluorescencia"
) +
theme_classic() +
theme(
plot.title = element_text(
hjust = 0.5,
face = "bold",
size = 18
),
plot.subtitle = element_text(
hjust = 0.5,
size = 13
),
axis.title = element_text(
face = "bold",
size = 12
),
axis.text = element_text(
size = 11
),
plot.caption = element_text(
hjust = 1,
face = "italic"
)
)
amplificacion2
Analisis de 2DDCT
Cargar la base de datos:
Datos_analisis <- vroom(file="https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Genes.csv")
## Rows: 7 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Gen
## dbl (6): C1, C2, C3, T1, T2, T3
##
## ℹ 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.
head(Datos_analisis)
## # A tibble: 6 × 7
## Gen C1 C2 C3 T1 T2 T3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 B-actina 19 19.5 18.9 18.5 18.8 18.2
## 2 PIF1 22.4 22 21 28 28.2 27.9
## 3 PLK1 22 21.8 21.6 21.7 21 21.5
## 4 CCNB1 30.1 31.2 30.8 25.2 25.2 25.3
## 5 PCNA 20 20.3 20.2 24 24.2 NA
## 6 CCNB2 33 NA 33.1 24 25 26
Separar los datos de actina
Actina <- Datos_analisis |>
filter(Gen == "B-actina")
Actina
## # A tibble: 1 × 7
## Gen C1 C2 C3 T1 T2 T3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 B-actina 19 19.5 18.9 18.5 18.8 18.2
Seleccionar los genes de interés
GI <- Datos_analisis |>
filter(Gen %in% c("PIF1", "PLK1", "CCNB1"))
GI
## # A tibble: 3 × 7
## Gen C1 C2 C3 T1 T2 T3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PIF1 22.4 22 21 28 28.2 27.9
## 2 PLK1 22 21.8 21.6 21.7 21 21.5
## 3 CCNB1 30.1 31.2 30.8 25.2 25.2 25.3
Analisis de DCT
Analisis <- GI |>
mutate(DCT_C1 = C1 - Actina$C1,
DCT_C2 = C2 - Actina$C2,
DCT_C3 = C3 - Actina$C3,
DCT_T1 = T1 - Actina$T1,
DCT_T2 = T2 - Actina$T2,
DCT_T3 = T3 - Actina$T3) |>
select(-2:-7) |>
mutate(DosDCT_C1 = 2^-DCT_C1,
DosDCT_C2 = 2^-DCT_C2,
DosDCT_C3 = 2^-DCT_C3,
DosDCT_T1 = 2^-DCT_T1,
DosDCT_T2 = 2^-DCT_T2,
DosDCT_T3 = 2^-DCT_T3 )
Analisis
## # A tibble: 3 × 13
## Gen DCT_C1 DCT_C2 DCT_C3 DCT_T1 DCT_T2 DCT_T3 DosDCT_C1 DosDCT_C2 DosDCT_C3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PIF1 3.4 2.5 2.08 9.5 9.45 9.7 0.0947 0.177 0.237
## 2 PLK1 3 2.3 2.68 3.2 2.25 3.3 0.125 0.203 0.156
## 3 CCNB1 11.1 11.7 11.9 6.7 6.45 7.1 0.000456 0.000301 0.000265
## # ℹ 3 more variables: DosDCT_T1 <dbl>, DosDCT_T2 <dbl>, DosDCT_T3 <dbl>
DosDDCT que sería sacar el promedio de los datos, y después realizar el análisis para Dos DDCT
Analisis2 <- Analisis |>
mutate(Mean_2DCT_Cx=(DosDCT_C1+DosDCT_C2+DosDCT_C3)/3,
Mean_2DCT_Tx=(DosDCT_T1+DosDCT_T2+DosDCT_T3)/3,
DosDDCT = Mean_2DCT_Tx/Mean_2DCT_Cx)
Analisis2
## # A tibble: 3 × 16
## Gen DCT_C1 DCT_C2 DCT_C3 DCT_T1 DCT_T2 DCT_T3 DosDCT_C1 DosDCT_C2 DosDCT_C3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PIF1 3.4 2.5 2.08 9.5 9.45 9.7 0.0947 0.177 0.237
## 2 PLK1 3 2.3 2.68 3.2 2.25 3.3 0.125 0.203 0.156
## 3 CCNB1 11.1 11.7 11.9 6.7 6.45 7.1 0.000456 0.000301 0.000265
## # ℹ 6 more variables: DosDCT_T1 <dbl>, DosDCT_T2 <dbl>, DosDCT_T3 <dbl>,
## # Mean_2DCT_Cx <dbl>, Mean_2DCT_Tx <dbl>, DosDDCT <dbl>
Gráfica
Grafica_analisis <- ggplot(Analisis2,
aes(x = Gen,
y = DosDDCT))+
geom_bar(stat = "identity")
Grafica_analisis
Grafica_analisis <- ggplot(Analisis2,
aes(x = Gen,
y = DosDDCT)) +
geom_col(fill = "#6527F5") +
geom_text(aes(label = round(DosDDCT, 2)),
vjust = -0.5,
size = 4) +
labs(
title = "Expresión relativa de genes",
x = "Gen",
y = "2^-ΔΔCt"
) +
theme_classic() +
theme(
plot.title = element_text(
hjust = 0.5,
face = "bold",
size = 16
),
axis.title = element_text(
face = "bold"
)
)
Grafica_analisis