InstalaciĂ³n de paqueteria

if (!requireNamespace("pacman",quietly=F))
  install.packages("pacman")
## Loading required namespace: pacman
library("pacman")

p_load("vroom",
       "dplyr",
       "ggplot2")

llamar base de datos

Datos_PCR <- vroom(file = "https://raw.githubusercontent.com/ManuelLaraMVZ/Metabolomica_2026_1/refs/heads/main/Cts")
## Rows: 20 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Well, Grupo, Practica, Fluor
## dbl (1): Cq
## 
## ℹ 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: 20 Ă— 5
##    Well       Grupo      Practica Fluor    Cq
##    <chr>      <chr>      <chr>    <chr> <dbl>
##  1 50         Curva      Absoluta SYBR   5.15
##  2 10         Curva      Absoluta SYBR  10.8 
##  3 5          Curva      Absoluta SYBR  13.9 
##  4 1          Curva      Absoluta SYBR  15.7 
##  5 0.5        Curva      Absoluta SYBR  16.5 
##  6 0.1        Curva      Absoluta SYBR  18.3 
##  7 Muestra    G1         Absoluta SYBR  11.5 
##  8 Muestra    G2         Absoluta SYBR  13.1 
##  9 A01        G1         Relativa SYBR  28.6 
## 10 A02        G1         Relativa SYBR  15.0 
## 11 A03        G1         Relativa SYBR  14.0 
## 12 A04        G1         Relativa SYBR  50   
## 13 A05        G1         Relativa SYBR  15.5 
## 14 A06        G1         Relativa SYBR  12.6 
## 15 A01        G2         Relativa SYBR  12.7 
## 16 A02        G2         Relativa SYBR  16.3 
## 17 A03        G2         Relativa SYBR  13.1 
## 18 Referencia Referencia Relativa SYBR  18.4 
## 19 Profesor   G1         Relativa SYBR  20.0 
## 20 Profesor   G2         Relativa SYBR  20.0

Filtrar datos

Filtrado <- Datos_PCR %>% 
  filter(Practica == "Relativa") %>% 
filter(Grupo=="G2") %>% 
select("Well","Cq")

Filtrado
## # A tibble: 4 Ă— 2
##   Well        Cq
##   <chr>    <dbl>
## 1 A01       12.7
## 2 A02       16.3
## 3 A03       13.1
## 4 Profesor  20.0

Valor de gen de referencia

Referencia <- Datos_PCR %>% 
  filter(Grupo == "Referencia") %>% 
  select(Well, "Cq")

Referencia  
## # A tibble: 1 Ă— 2
##   Well          Cq
##   <chr>      <dbl>
## 1 Referencia  18.4

Valor 2^-DCt

Dos_DCt <- Filtrado %>% 
  mutate(DCt=(Cq-Referencia$Cq),
         DosDct = 2^-DCt )

Dos_DCt
## # A tibble: 4 Ă— 4
##   Well        Cq   DCt DosDct
##   <chr>    <dbl> <dbl>  <dbl>
## 1 A01       12.7 -5.71 52.2  
## 2 A02       16.3 -2.09  4.26 
## 3 A03       13.1 -5.31 39.6  
## 4 Profesor  20.0  1.64  0.320

Obtener el valor de 2^-DDCt

Dos_DDCt <- Dos_DCt %>% 

  mutate(

    DosDDCt = DosDct / last(DosDct),

    L2 = log2(DosDDCt)

  )

Dos_DDCt
## # A tibble: 4 Ă— 6
##   Well        Cq   DCt DosDct DosDDCt    L2
##   <chr>    <dbl> <dbl>  <dbl>   <dbl> <dbl>
## 1 A01       12.7 -5.71 52.2     163.   7.35
## 2 A02       16.3 -2.09  4.26     13.3  3.73
## 3 A03       13.1 -5.31 39.6     124.   6.95
## 4 Profesor  20.0  1.64  0.320     1    0

Graficar Datos

Grafica_comparativa <- ggplot(Dos_DDCt, 
                              aes(x= Well,
                                  y = DosDDCt,
                                  fill = Well))+
  geom_col()
Grafica_comparativa

Grafica logaritmo

Grafica_comparativa2 <- ggplot(Dos_DDCt, 
                              aes(x= Well,
                                  y = L2,
                                  fill = Well))+
  geom_col()+
  theme_classic()+
  labs(title= "Analisis relativo RT-qPCR",
       subtitle = "Tejido: corteza",
       caption = "Equipo: JPP",
       x= "Muestra",
       y= "Log2 (FCh)")
Grafica_comparativa2