Ejercicio R de PCR
Los chunks los obtengo con: Cmd + Opt+ I
PaqueterÃa
#install.packages("pacman")
library("pacman")
#pacman llama a otros paquetes y si no estan los instala
p_load("vroom", #llamar bases de datos
"dplyr", #facilita el manejo de datos
"ggplot2") #graficar
Llamar base de datos
Datos_PCR <- #correr datos
vroom(file = "https://raw.githubusercontent.com/ManuelLaraMVZ/resultados_PCR_practica/refs/heads/main/Genes.csv")
## `curl` package not installed, falling back to using `url()`
## 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.
Datos_PCR
## # A tibble: 7 × 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
## 7 BRCA 21 20.5 20.4 19.1 19.2 19.5
Aislar gen de referencia
Gen_ref <- Datos_PCR %>% # a la base de datos PCR le haras lo siguiuente
filter(Gen == "B-actina")#seleccionar filas; == exactamente igual/identico
Gen_ref
## # 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
Gen de intéres
Gen_int <- Datos_PCR %>%
filter(Gen !="B-actina") # !: todos excepto
Gen_int
## # A tibble: 6 × 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
## 4 PCNA 20 20.3 20.2 24 24.2 NA
## 5 CCNB2 33 NA 33.1 24 25 26
## 6 BRCA 21 20.5 20.4 19.1 19.2 19.5
Analisis
DCT <- Gen_int %>%
mutate(DCTC1= C1- Gen_ref$C1,
DCTC2= C2 - Gen_ref$C2,
DCTC3= C3 - Gen_ref$C3,
DCTT1= T1 - Gen_ref$T1,
DCTT2= T2 - Gen_ref$T2,
DCTT3= T3 - Gen_ref$T3) %>%
mutate(DosDCT_C1=2^-DCTC1,
DosDCT_C2=2^-DCTC2,
DosDCT_C3=2^-DCTC3,
DosDCT_T1=2^-DCTT1,
DosDCT_T2=2^-DCTT2,
DosDCT_T3=2^-DCTT3) %>%
mutate(DosDCT_Cx_prom = (DosDCT_C1+DosDCT_C2+DosDCT_C3)/3,
DosDCT_Tx_prom = (DosDCT_T1+DosDCT_T2+DosDCT_T3)/3)%>%
mutate (DosDDCT= DosDCT_Tx_prom/DosDCT_Cx_prom)
DCT
## # A tibble: 6 × 22
## Gen C1 C2 C3 T1 T2 T3 DCTC1 DCTC2 DCTC3 DCTT1 DCTT2 DCTT3
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 PIF1 22.4 22 21 28 28.2 27.9 3.4 2.5 2.08 9.5 9.45 9.7
## 2 PLK1 22 21.8 21.6 21.7 21 21.5 3 2.3 2.68 3.2 2.25 3.3
## 3 CCNB1 30.1 31.2 30.8 25.2 25.2 25.3 11.1 11.7 11.9 6.7 6.45 7.1
## 4 PCNA 20 20.3 20.2 24 24.2 NA 1 0.800 1.28 5.5 5.45 NA
## 5 CCNB2 33 NA 33.1 24 25 26 14 NA 14.2 5.5 6.25 7.8
## 6 BRCA 21 20.5 20.4 19.1 19.2 19.5 2 1 1.48 0.600 0.450 1.3
## # ℹ 9 more variables: DosDCT_C1 <dbl>, DosDCT_C2 <dbl>, DosDCT_C3 <dbl>,
## # DosDCT_T1 <dbl>, DosDCT_T2 <dbl>, DosDCT_T3 <dbl>, DosDCT_Cx_prom <dbl>,
## # DosDCT_Tx_prom <dbl>, DosDDCT <dbl>
Seleccion de datos para graficar
Datos_grafica <- DCT %>%
select("Gen","DosDDCT")
Datos_grafica
## # A tibble: 6 × 2
## Gen DosDDCT
## <chr> <dbl>
## 1 PIF1 0.00790
## 2 PLK1 0.869
## 3 CCNB1 27.7
## 4 PCNA NA
## 5 CCNB2 NA
## 6 BRCA 1.62
Gráfica
Grafica_PCR <- ggplot(Datos_grafica,
aes(x = Gen, y = DosDDCT, fill = Gen)) +
geom_col() +
labs(
title = "Expresión génica por PCR",
subtitle = "Promedio de ΔΔCT por gen",
caption = "Fuente: Datos experimentales"
) +
theme_minimal(base_size = 14) + # fondo blanco y estilo limpio
theme(
plot.title = element_text(face = "bold", size = 16),
plot.subtitle = element_text(size = 12),
plot.caption = element_text(size = 10, hjust = 0)
) +
scale_fill_manual(values = c("#FFC0CB", "#FF1493","#FFB6E9", "#FF69B4", "#DB7093", "#C71585"))
Grafica_PCR
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_col()`).