qPCRtools introduction

Install

install.packages("qPCRtools")

Calculate volume for reverse transcription

The first step of qPCR is usually the preparation of cDNA. We need to calculate the column of RNA for reverse transcription to cDNA. So, if we have the concentration of RNA, we can use the function CalRTable to do that. The function have three parameters:

  • data: The table of RNA concentration. The unit of concentration is ng/μl. The demo data can be found at GitHub.
  • template: The table of reagent for reverse transcription. The demo data can be found at GitHub. The column all that must be in this data.frame is the total volume for 1 μg RNA.
  • rna_weight: The mass of RNA. The unit is μg. The default value is 2.
library(magrittr)

df.1.path <- system.file("examples", "crtv.data.txt", package = "qPCRtools")
df.2.path <- system.file("examples", "crtv.template.txt", package = "qPCRtools")
df.1 <- read.table(df.1.path, sep = "\t", header = TRUE)
df.2 <- read.table(df.2.path, sep = "\t", header = TRUE)
## Warning in read.table(df.2.path, sep = "\t", header = TRUE): incomplete final
## line found by readTableHeader on
## '/tmp/Rtmp5p1ell/Rinst135d5a3b6ffd/qPCRtools/examples/crtv.template.txt'
result <- qPCRtools::CalRTable(data = df.1, template = df.2, rna_weight = 2)
## Registered S3 methods overwritten by 'ggpp':
##   method                  from   
##   heightDetails.titleGrob ggplot2
##   widthDetails.titleGrob  ggplot2
result %>% 
  dplyr::slice(1:6) %>% 
  kableExtra::kable(format = "html") %>% 
  kableExtra::kable_styling("striped")
sample mean volume_rna mix gDNARemover all volume_h2o
1 160.4000 12.468828 8 2 40 17.53117
2 163.3333 12.244898 8 2 40 17.75510
3 182.5667 10.954902 8 2 40 19.04510
4 203.8000 9.813543 8 2 40 20.18646
5 180.1333 11.102887 8 2 40 18.89711
6 171.8333 11.639185 8 2 40 18.36081

Calculate standard curve

The function can calculate the standard curve. At the same time, it can get the amplification efficiency of primer(s). Based on the amplification efficiency, we can know which method can be used to calculate the expression level. The function has 6 parameters:

  • cq_table: The table of Cq. It must contain at least two columns:One Position and Cq. The demo data can be found at GitHub.
  • concen_table: The table of gene(s) and concentration. It must contain at least three columns: Position, Gene and Conc. The demo data can be found at GitHub.
  • lowest_concen: The lowest concentration used to calculate the standard curve.
  • highest_concen: The highest concentration used to calculate the standard curve.
  • dilution: The dilution factor of cDNA template. The default value is 4.
  • by_mean: Calculate the standard curve by average data or the full data. The default value is TRUE.
library(qPCRtools)

df.1.path <- system.file("examples", "calsc.cq.txt", package = "qPCRtools")
df.2.path <- system.file("examples", "calsc.info.txt", package = "qPCRtools")
df.1 <- read.table(df.1.path, header = TRUE)
df.2 <- read.table(df.2.path, header = TRUE)
qPCRtools::CalCurve(
                    cq_table = df.1,
                    concen_table = df.2,
                    lowest_concen = 4,
                    highest_concen = 4096,
                    dilution = 4,
                    by_mean = TRUE
                  ) -> p

p[["table"]] %>% 
  dplyr::slice(1:6) %>% 
  kableExtra::kable(format = "html") %>% 
  kableExtra::kable_styling("striped")
Gene Formula Slope Intercept R2 P.value max.Cq min.Cq E Date
Gene1 y = -2.07*Conc + 40.08 -2.07 40.08 0.7509 0 40.00 27.33 0.954 2026-06-10
Gene2 y = -2.09*Conc + 34.97 -2.09 34.97 0.9991 0 33.89 22.31 0.941 2026-06-10
Gene3 y = -2.24*Conc + 33.34 -2.24 33.34 0.9983 0 31.39 19.59 0.857 2026-06-10
Gene4 y = -2.21*Conc + 35.46 -2.21 35.46 0.9993 0 33.44 22.06 0.873 2026-06-10
p[["figure"]]
## `geom_smooth()` using formula = 'y ~ x'

Calculate expression using standard curve

After we calculated the standard curve, we can use the standard curve to calculate the expression level of genes. In qPCRtools, function CalExpCurve can get the expression using standard curve. There are several parameters in this function: - cq_table: The table of Cq. It must contain at least two columns:One Position and Cq. The demo data can be found at GitHub. - curve_table: The table of standard curve calculated by CalCurve. - design_table: The design information including three columns: Position, Treatment and Gene. The demo table can be found at GitHub. - correction: Expression level is corrected or not with internal reference genes. The default value is TRUE. - ref_gene: The name of reference gene. - stat_method: The method used to calculate differential expression of genes. If we want to calculate the difference between target group and reference group, one of t.test or wilcox.test can be used. anova is for all groups. The default value is t.test. - ref_group: The name of reference group. If stat_method is t.test or wilcox.test, the function need a ref_group. - fig_type: The type of figure, box or bar. box represents boxplot. bar represents barplot. The default value is box. - fig_ncol: The column of figure. The default value is NULL.

df1.path <- system.file("examples", "cal.exp.curve.cq.txt", package = "qPCRtools")
df2.path <- system.file("examples", "cal.expre.curve.sdc.txt", package = "qPCRtools")
df3.path <- system.file("examples", "cal.exp.curve.design.txt", package = "qPCRtools")

cq_table <- read.table(df1.path, header = TRUE)
curve_table <- read.table(df2.path, sep = "\t", header = TRUE)
design_table <- read.table(df3.path, header = TRUE)

qPCRtools::CalExpCurve(
                      cq_table,
                      curve_table,
                      design_table,
                      correction = TRUE,
                      ref_gene = "OsUBQ",
                      stat_method = "t.test",
                      ref_group = "CK",
                      fig_type = "box",
                      fig_ncol = NULL) -> res
## Warning in qPCRtools::CalExpCurve(cq_table, curve_table, design_table,
## correction = TRUE, : Cq of A3 out of curve range!
res[["table"]] %>% 
  dplyr::slice(1:6) %>% 
  kableExtra::kable(format = "html") %>% 
  kableExtra::kable_styling("striped")
Treatment Gene expre temp signif mean.expre sd.expre n se
CK OSPOX8 1.0312698 OSPOX8CK NA 1.0359221 0.0483130 8 0.0170812
CK OsWAK91 0.2791407 OsWAK91CK NA 0.7631784 0.2121981 8 0.0750234
CK OsRBBI2 0.5073215 OsRBBI2CK NA 0.5399223 0.0431135 8 0.0152429
CK OsCeBip 0.9040572 OsCeBipCK NA 0.8421330 0.1713979 8 0.0605983
CK OsPR10 1.1275436 OsPR10CK NA 1.2492427 0.2011588 8 0.0711204
CK OSPOX8 1.0715901 OSPOX8CK NA 1.0359221 0.0483130 8 0.0170812
res[["figure"]]
## Warning: Removed 40 rows containing missing values or values outside the scale range
## (`geom_text()`).

Calculate expression using 2-ΔΔCt

$2^{-{Δ}{Δ}{C_t }} $is a widely used method to calculate qPCR data[1]. Our function CalExp2ddCt can do it. Seven parameters are required for this function: - cq_table: The demo file can be found at GitHub. - design_table: The demo data can be found at GitHub. Other parameters are same as the function CalExpCurve. - ref_gene: The name of reference gene. - ref_group: The name of reference group. If stat_method is t.test or wilcox.test, the function need a ref_group. - stat_method: The method used to calculate differential expression of genes. If we want to calculate the difference between target group and reference group, one of t.test or wilcox.test can be used. anova is for all groups. The default value is t.test. - fig_type: The type of figure, box or bar. box represents boxplot. bar represents barplot. The default value is box. - fig_ncol: The column of figure. The default value is NULL.

df1.path <- system.file("examples", "ddct.cq.txt", package = "qPCRtools")
df2.path <- system.file("examples", "ddct.design.txt", package = "qPCRtools")

cq_table <- read.table(df1.path, header = TRUE)
design_table <- read.table(df2.path, header = TRUE)

qPCRtools::CalExp2ddCt(cq_table,
                       design_table,
                       ref_gene = "OsUBQ",
                       ref_group = "CK",
                       stat_method = "t.test",
                       fig_type = "bar",
                       fig_ncol = NULL) -> res

res[["table"]] %>% 
  dplyr::slice(1:6) %>% 
  kableExtra::kable(format = "html") %>% 
  kableExtra::kable_styling("striped")
Treatment gene biorep expre is.out mean.expre sd.expre n se.expre temp signif
Treatment OsPR10 1 0.5398479 no 0.6896177 0.2739611 4 0.3448088 OsPR10Treatment NS
Treatment OsPR10 2 0.8097930 no 0.6896177 0.2739611 4 0.3448088 OsPR10Treatment NS
Treatment OsPR10 3 0.3979406 no 0.6896177 0.2739611 4 0.3448088 OsPR10Treatment NS
Treatment OsPR10 4 1.0108893 no 0.6896177 0.2739611 4 0.3448088 OsPR10Treatment NS
CK OsPR10 1 0.8069913 no 2.0326462 1.5252126 4 1.0163231 OsPR10CK NA
CK OsPR10 2 3.1725106 no 2.0326462 1.5252126 4 1.0163231 OsPR10CK NA
res[["figure"]]
## Warning: Removed 18 rows containing missing values or values outside the scale range
## (`geom_text()`).

Calculate expression using RqPCR

The method from SATQPCR can identify the most stable reference genes (REF) across biological replicates and technical replicates[2]. Our package provides a function, CalExpRqPCR, to achieve it. In the design_table, BioRep, TechRep and Eff are required. BioRep is the biological replicates. TechRep is the technical replicates. Eff is the amplification efficiency of genes.

  • The cq_table can be found at GitHub.
  • The design,table can be found at GitHub. If user want to give reference gene, ref_gene can be used (The default is NULL).
  • ref_gene: The name of reference gene.
  • ref_group: The name of reference group. If stat_method is t.test or wilcox.test, the function need a ref_group.
  • stat_method: The method used to calculate differential expression of genes. If we want to calculate the difference between target group and reference group, one of t.test or wilcox.test can be used. anova is for all groups. The default value is t.test.
  • fig_type: The type of figure, box or bar. box represents boxplot. bar represents barplot. The default value is box.
  • fig_ncol: The column of figure. The default value is NULL.
df1.path <- system.file("examples", "cal.expre.rqpcr.cq.txt", package = "qPCRtools")
df2.path <- system.file("examples", "cal.expre.rqpcr.design.txt", package = "qPCRtools")

cq_table <- read.table(df1.path, header = TRUE)
design_table <- read.table(df2.path, header = TRUE)

qPCRtools::CalExpRqPCR(cq_table,
                       design_table,
                       ref_gene = NULL,
                       ref_group = "CK",
                       stat_method = "t.test",
                       fig_type = "bar",
                       fig_ncol = NULL
                       ) -> res

res[["table"]] %>% 
  dplyr::slice(1:6) %>% 
  kableExtra::kable(format = "html") %>% 
  kableExtra::kable_styling("striped")
group biorep gene Expre4Stat Expression SD SE
CK 1 OSPOX8 1.0000000 1.393984 0.5409190 0.2704595
CK 2 OSPOX8 1.7640638 1.393984 0.5409190 0.2704595
CK 3 OSPOX8 1.1700339 1.393984 0.5409190 0.2704595
CK 4 OSPOX8 0.6965246 1.393984 0.5409190 0.2704595
Treatment 1 OSPOX8 0.6609311 1.000000 0.2887030 0.1443515
Treatment 2 OSPOX8 1.0000000 1.000000 0.2887030 0.1443515
CK 1 OsCeBip 1.0000000 1.123741 0.5020716 0.2510358
CK 2 OsCeBip 0.3006107 1.123741 0.5020716 0.2510358
CK 3 OsCeBip 0.9256854 1.123741 0.5020716 0.2510358
CK 4 OsCeBip 1.1681248 1.123741 0.5020716 0.2510358
Treatment 1 OsCeBip 0.5103220 1.000000 0.4585177 0.2292588
Treatment 2 OsCeBip 1.0000000 1.000000 0.4585177 0.2292588
CK 1 OsPR10 1.0000000 1.946979 0.6240021 0.3120011
CK 2 OsPR10 2.1298352 1.946979 0.6240021 0.3120011
CK 3 OsPR10 1.3107239 1.946979 0.6240021 0.3120011
CK 4 OsPR10 1.5101879 1.946979 0.6240021 0.3120011
Treatment 1 OsPR10 0.7202223 1.000000 0.2092850 0.1046425
Treatment 2 OsPR10 0.6869024 1.000000 0.2092850 0.1046425
CK 1 OsWAK91 0.1901955 1.000000 0.4515142 0.2257571
CK 2 OsWAK91 0.3025867 1.000000 0.4515142 0.2257571
CK 3 OsWAK91 0.5006031 1.000000 0.4515142 0.2257571
CK 4 OsWAK91 0.2294250 1.000000 0.4515142 0.2257571
Treatment 1 OsWAK91 1.5798934 4.219614 1.3413252 0.6706626
Treatment 2 OsWAK91 1.0000000 4.219614 1.3413252 0.6706626
res[["figure"]]
## Warning: Removed 16 rows containing missing values or values outside the scale range
## (`geom_text()`).

References

[1]
LIVAK K J. SCHMITTGEN T D. Analysis of relative gene expression data using real-time quantitative PCR and the 2- \(\Delta\)\(\Delta\)CT method[J]. Methods, 2001, 25(4): 402-408.
[2]
RANCUREL C. VAN TRAN T. ELIE C. 等. SATQPCR: Website for statistical analysis of real-time quantitative PCR data[J]. Molecular and Cellular Probes, 2019, 46: 101418.