| Type: | Package |
| Title: | qPCR Data Analysis |
| Version: | 2.1.2 |
| Description: | Tools for qPCR data analysis using Delta Ct and Delta Delta Ct methods, including t-tests, ANOVA, ANCOVA, repeated-measures models, and publication-ready visualizations. The package supports multiple target, and multiple reference genes, and uses a calculation framework adopted from Ganger et al. (2017) <doi:10.1186/s12859-017-1949-5> and Taylor et al. (2019) <doi:10.1016/j.tibtech.2018.12.002>, covering both the Livak and Pfaffl methods. |
| URL: | https://github.com/mirzaghaderi/rtpcr |
| License: | GPL-3 |
| Imports: | multcomp, ggplot2, lmerTest, purrr, reshape2, tidyr, dplyr, grid, emmeans |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2026-01-23 04:02:42 UTC; GM |
| Author: | Ghader Mirzaghaderi [aut, cre, cph] |
| Depends: | R (≥ 3.5.0) |
| Suggests: | knitr, rmarkdown, multcompView |
| VignetteBuilder: | knitr |
| LazyData: | true |
| Maintainer: | Ghader Mirzaghaderi <mirzaghaderi@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-01-23 09:20:03 UTC |
Delta Delta Ct ANCOVA analysis
Description
Apply Delta Delta Ct (ddCt) analysis to each target gene and performs per-gene statistical analysis.
Usage
ANCOVA_DDCt(
x,
numOfFactors,
numberOfrefGenes,
mainFactor.column,
block,
mainFactor.level.order = NULL,
p.adj = "none",
analyseAllTarget = TRUE
)
Arguments
x |
The input data frame containing experimental design columns, replicates (integer), target gene E/Ct column pairs, and reference gene E/Ct column pairs. Reference gene columns must be located at the end of the data frame. See "Input data structure" in vignettes for details about data structure. |
numOfFactors |
Integer. Number of experimental factor columns
(excluding |
numberOfrefGenes |
Integer. Number of reference genes. |
mainFactor.column |
Integer. Column index of the factor for which the relative expression analysis is applied. The remaining factors are treated as covariate(s). |
block |
Character or |
mainFactor.level.order |
Optional character vector specifying the order of levels for the main factor.
If |
p.adj |
Method for p-value adjustment. See |
analyseAllTarget |
Logical or character.
If |
Details
ddCt analysis of covariance (ANCOVA) is performed for the levels of the mainFactor.column and the other factors are
treated as covariates. if the interaction between the main factor and the covariate is significant, ANCOVA is not appropriate.
ANCOVA is basically used when a factor is affected by uncontrolled quantitative covariate(s).
For example, suppose that wDCt of a target gene in a plant is affected by temperature. The gene may
also be affected by drought. Since we already know that temperature affects the target gene, we are
interested to know if the gene expression is also altered by the drought levels. We can design an
experiment to understand the gene behavior at both temperature and drought levels at the same time.
The drought is another factor (the covariate) that may affect the expression of our gene under the
levels of the first factor i.e. temperature. The data of such an experiment can be analyzed by ANCOVA
or using ANOVA based on a factorial experiment. ANCOVA is done
even there is only one factor (without covariate or factor variable).
All the functions for relative expression analysis (including 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()') return the relative expression table which include fold change and corresponding statistics. The output of 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()' also include lm models, residuals, raw data and ANOVA table for each gene.
The expression table returned by 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', and 'REPEATED_DDCt()' functions include these columns: gene (name of target genes), contrast (calibrator level and contrasts for which the relative expression is computed), ddCt (mean of weighted delta delta Ct values), RE (relative expression or fold change = 2^-ddCt), log2FC (log(2) of relative expression or fold change), pvalue, sig (per-gene significance), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of mean calculated from the weighted delta Ct values of each of the main factor levels), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), and Upper.se.log2FC (The upper limit error bar for log2 RE)
Value
An object containing expression table, lm model, residuals, raw data and ANOVA table for each gene:
- ddCt expression table along with per-gene statistical comparison outputs
object$relativeExpression- ANOVA table
object$perGene$gene_name$ANOVA_table- lm ANOVA
object$perGene$gene_name$lm- lm_formula
object$perGene$gene_name$lm_formula- Residuals
resid(object$perGene$gene_name$lm)
References
LivakKJ, Schmittgen TD (2001). Analysis of Relative Gene Expression Data Using Real-Time Quantitative PCR and the Double Delta CT Method. Methods, 25(4), 402–408. doi:10.1006/meth.2001.1262
Ganger MT, Dietz GD, and Ewing SJ (2017). A common base method for analysis of qPCR data and the application of simple blocking in qPCR experiments. BMC Bioinformatics, 18, 1–11.
Taylor SC, Nadeau K, Abbasi M, Lachance C, Nguyen M, Fenrich, J. (2019). The ultimate qPCR experiment: producing publication quality, reproducible data the first time. Trends in Biotechnology, 37, 761-774.
Yuan JS, Reed A, Chen F, Stewart N (2006). Statistical Analysis of Real-Time PCR Data. BMC Bioinformatics, 7, 85.
Examples
data1 <- read.csv(system.file("extdata", "data_2factorBlock3ref.csv", package = "rtpcr"))
ANCOVA_DDCt(x = data1,
numOfFactors = 2,
numberOfrefGenes = 2,
block = "block",
mainFactor.column = 2,
p.adj = "none")
data2 <- read.csv(system.file("extdata", "data_1factor_one_ref.csv", package = "rtpcr"))
ANCOVA_DDCt(x = data2,
numOfFactors = 1,
numberOfrefGenes = 1,
block = NULL,
mainFactor.column = 1,
p.adj = "none")
Delta Ct ANOVA analysis
Description
Performs Delta Ct (dCt) analysis of the data from a 1-, 2-, or 3-factor experiment. Per-gene statistical grouping is also performed for all treatment (T) combinations.
Usage
ANOVA_DCt(
x,
numOfFactors,
numberOfrefGenes,
block,
alpha = 0.05,
p.adj = "none",
analyseAllTarget = TRUE
)
Arguments
x |
The input data frame containing experimental design columns, target gene E/Ct column pairs, and reference gene E/Ct column pairs. Reference gene columns must be located at the end of the data frame. See "Input data structure" in vignettes for details about data structure. |
numOfFactors |
Integer. Number of experimental factor columns
(excluding |
numberOfrefGenes |
Integer. Number of reference genes. Each reference gene must be represented by two columns (E and Ct). |
block |
Character. Block column name or |
alpha |
statistical level for comparisons |
p.adj |
Method for p-value adjustment. See |
analyseAllTarget |
Logical or character.
If |
Details
The function returns analysis of variance components and the expression table which include these columns: gene (name of target genes), factor columns, dCt (mean weighted delta Ct for each treatment combination), RE (relative expression = 2^-dCt), log2FC (log(2) of relative expression), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of the mean calculated from the weighted delta Ct (wDCt) values of each treatment combination), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), Upper.se.log2FC (The upper limit error bar for log2 RE), and sig (per-gene significance grouping letters).
Value
An object containing expression table, lm models, ANOVA table, residuals, and raw data for each gene:
- dCt expression table for all treatment combinations along with the per-gene statistical grouping
object$relativeExpression- ANOVA table for treatments
object$perGene$gene_name$ANOVA_T- ANOVA table factorial
object$perGene$gene_name$ANOVA_factorial- lm ANOVA for tratments
object$perGene$gene_name$lm_T- lm ANOVA factorial
object$perGene$gene_name$lm_factorial- Residuals
resid(object$perGene$gene_name$lm_T)
Examples
data <- read.csv(system.file("extdata", "data_3factor.csv", package = "rtpcr"))
res <- ANOVA_DCt(
data,
numOfFactors = 3,
numberOfrefGenes = 1,
block = NULL)
Delta Delta Ct ANOVA analysis
Description
Apply Delta Delta Ct (ddCt) analysis to each target gene and performs per-gene statistical analysis.
Usage
ANOVA_DDCt(
x,
numOfFactors,
numberOfrefGenes,
mainFactor.column,
block,
mainFactor.level.order = NULL,
p.adj = "none",
analyseAllTarget = TRUE
)
Arguments
x |
The input data frame containing experimental design columns, replicates (integer), target gene E/Ct column pairs, and reference gene E/Ct column pairs. Reference gene columns must be located at the right end of the data frame. See "Input data structure" in vignettes for details about data structure. |
numOfFactors |
Integer. Number of experimental factor columns
(excluding |
numberOfrefGenes |
Integer. Number of reference genes. |
mainFactor.column |
Integer. Column index of the factor for which the relative expression analysis is applied. |
block |
Character. Block column name or |
mainFactor.level.order |
Optional character vector specifying the order of levels for the main factor.
If |
p.adj |
Method for p-value adjustment. See |
analyseAllTarget |
Logical or character.
If |
Details
ddCt analysis of variance (ANOVA) is performed for
the mainFactor.column based on a full model factorial
experiment by default. However, if ANCOVA_DDCt function is used,
analysis of covariance is performed for the levels of the mainFactor.column and the other factors are
treated as covariates. if the interaction between the main factor and the covariate is significant, ANCOVA is not appropriate.
All the functions for relative expression analysis (including 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()') return the relative expression table which include fold change and corresponding statistics. The output of 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()' also include lm models, residuals, raw data and ANOVA table for each gene.
The expression table returned by 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', and 'REPEATED_DDCt()' functions include these columns: gene (name of target genes), contrast (calibrator level and contrasts for which the relative expression is computed), ddCt (mean of weighted delta delta Ct values), RE (relative expression or fold change = 2^-ddCt), log2FC (log(2) of relative expression or fold change), pvalue, sig (per-gene significance), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of mean calculated from the weighted delta Ct values of each of the main factor levels), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), and Upper.se.log2FC (The upper limit error bar for log2 RE)
Value
An object containing expression table, lm model, residuals, raw data and ANOVA table for each gene:
- ddCt expression table along with per-gene statistical comparison outputs
object$relativeExpression- ANOVA table
object$perGene$gene_name$ANOVA_table- lm ANOVA
object$perGene$gene_name$lm- lm_formula
object$perGene$gene_name$lm_formula- Residuals
resid(object$perGene$gene_name$lm)
References
LivakKJ, Schmittgen TD (2001). Analysis of Relative Gene Expression Data Using Real-Time Quantitative PCR and the Double Delta CT Method. Methods, 25(4), 402–408. doi:10.1006/meth.2001.1262
Ganger MT, Dietz GD, and Ewing SJ (2017). A common base method for analysis of qPCR data and the application of simple blocking in qPCR experiments. BMC Bioinformatics, 18, 1–11.
Taylor SC, Nadeau K, Abbasi M, Lachance C, Nguyen M, Fenrich, J. (2019). The ultimate qPCR experiment: producing publication quality, reproducible data the first time. Trends in Biotechnology, 37, 761-774.
Yuan JS, Reed A, Chen F, Stewart N (2006). Statistical Analysis of Real-Time PCR Data. BMC Bioinformatics, 7, 85.
Examples
data1 <- read.csv(system.file("extdata", "data_2factorBlock3ref.csv", package = "rtpcr"))
ANOVA_DDCt(x = data1,
numOfFactors = 2,
numberOfrefGenes = 2,
block = "block",
mainFactor.column = 2,
p.adj = "none")
data2 <- read.csv(system.file("extdata", "data_1factor_one_ref.csv", package = "rtpcr"))
ANOVA_DDCt(x = data2,
numOfFactors = 1,
numberOfrefGenes = 1,
block = NULL,
mainFactor.column = 1,
p.adj = "none")
Delta Delta Ct pairwise comparisons using a fitted model
Description
Performs relative expression (fold change) analysis based on the
Delta Delta Ct (ddCt) methods using a fitted model object produced by
ANOVA_DCt(), ANOVA_DDCt() or REPEATED_DDCt().
Usage
Means_DDCt(model, specs, p.adj = "none")
Arguments
model |
A fitted model object (typically an |
specs |
A character string or character vector specifying the predictors or
combinations of predictors over which relative expression values are desired.
This argument follows the specification syntax used by
|
p.adj |
Character string specifying the method for adjusting p-values.
See |
Details
The Means_DDCt function performs pairwise comparisons of relative expression values fo all combinations using
estimated marginal means derived from a fitted model.
For ANOVA models, relative expression values can be obtained for main effects,
interactions, and sliced (simple) effects.
For ANCOVA models returned by the rtpcr package, only simple
effects are supported.
Internally, this function relies on the emmeans package to compute marginal means and contrasts, which are then back-transformed to fold change values using the ddCt framework.
Value
A data frame containing estimated relative expression values, confidence intervals, p-values, and significance levels derived from the fitted model.
Author(s)
Ghader Mirzaghaderi
Examples
data <- read.csv(system.file("extdata", "data_3factor.csv", package = "rtpcr"))
# Obtain a fitted model from ANOVA_DDCt
res <- ANOVA_DDCt(
data,
numOfFactors = 3,
numberOfrefGenes = 1,
mainFactor.column = 1,
block = NULL)
# Relative expression values for Type main effect
lm <- res$perGene$PO$lm
Means_DDCt(lm, specs = "Type")
# Relative expression values for Concentration main effect
Means_DDCt(lm, specs = "Conc")
# Relative expression values for Concentration sliced by Type
Means_DDCt(lm, specs = "Conc | Type")
# Relative expression values for Concentration sliced by Type and SA
Means_DDCt(lm, specs = "Conc | Type * SA")
Delta Delta Ct repeated measure analysis
Description
REPEATED_DDCt function performs Delta Delta Ct (ddCt) method
analysis of observations repeatedly taken over different time courses.
Data may be obtained over time from a uni- or multi-factorial experiment.
Usage
REPEATED_DDCt(
x,
numOfFactors,
numberOfrefGenes,
mainFactor.column,
block,
mainFactor.level.order = NULL,
p.adj = "none",
analyseAllTarget = TRUE
)
Arguments
x |
The input data frame containing experimental design columns, target gene E/Ct column pairs, and reference gene E/Ct column pairs. Reference gene columns must be located at the end of the data frame. |
numOfFactors |
Integer. Number of experimental factor columns
(excluding |
numberOfrefGenes |
Integer. Number of reference genes. |
mainFactor.column |
Integer. Column index of the factor (commonly |
block |
Character or |
mainFactor.level.order |
Optional character vector specifying the order of levels for the main factor.
If |
p.adj |
Method for p-value adjustment. See |
analyseAllTarget |
Logical or character.
If |
Details
ddCt analysis of repeated measure data is performed for
the mainFactor.column based on a full model factorial experiment.
All the functions for relative expression analysis (including 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()') return the relative expression table which include fold change and corresponding statistics. The output of 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()' also include lm models, residuals, raw data and ANOVA table for each gene.
The expression table returned by 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', and 'REPEATED_DDCt()' functions include these columns: gene (name of target genes), contrast (calibrator level and contrasts for which the relative expression is computed), ddCt (mean of weighted delta delta Ct values), RE (relative expression or fold change = 2^-ddCt), log2FC (log(2) of relative expression or fold change), pvalue, sig (per-gene significance), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of mean calculated from the weighted delta Ct values of each of the main factor levels), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), and Upper.se.log2FC (The upper limit error bar for log2 RE)
Value
An object containing expression table, lm model, residuals, raw data and ANOVA table for each gene:
- ddCt expression table along with per-gene statistical comparison outputs
object$relativeExpression- ANOVA table
object$perGene$gene_name$ANOVA_table- lm ANOVA
object$perGene$gene_name$lm- lm_formula
object$perGene$gene_name$lm_formula- Residuals
resid(object$perGene$gene_name$lm)
References
LivakKJ, Schmittgen TD (2001). Analysis of Relative Gene Expression Data Using Real-Time Quantitative PCR and the Double Delta CT Method. Methods, 25(4), 402–408. doi:10.1006/meth.2001.1262
Ganger MT, Dietz GD, and Ewing SJ (2017). A common base method for analysis of qPCR data and the application of simple blocking in qPCR experiments. BMC Bioinformatics, 18, 1–11.
Taylor SC, Nadeau K, Abbasi M, Lachance C, Nguyen M, Fenrich, J. (2019). The ultimate qPCR experiment: producing publication quality, reproducible data the first time. Trends in Biotechnology, 37, 761-774.
Yuan JS, Reed A, Chen F, Stewart N (2006). Statistical Analysis of Real-Time PCR Data. BMC Bioinformatics, 7, 85.
Examples
data1 <- read.csv(system.file("extdata", "data_repeated_measure_1.csv", package = "rtpcr"))
REPEATED_DDCt(
data1,
numOfFactors = 1,
numberOfrefGenes = 1,
mainFactor.column = 1,
block = NULL)
data2 <- read.csv(system.file("extdata", "data_repeated_measure_2.csv", package = "rtpcr"))
REPEATED_DDCt(
data2,
numOfFactors = 2,
numberOfrefGenes = 1,
mainFactor.column = 2,
block = NULL,
p.adj = "none")
Delta Delta Ct method t-test analysis
Description
The TTEST_DDCt function performs fold change expression analysis based on
the \Delta \Delta C_T method using Student's t-test. It supports analysis
of one or more target genes evaluated under two experimental conditions
(e.g. control vs treatment).
Usage
TTEST_DDCt(
x,
numberOfrefGenes,
Factor.level.order = NULL,
paired = FALSE,
var.equal = TRUE,
p.adj = "none",
order = "none"
)
Arguments
x |
A data frame containing experimental conditions, biological replicates, and
amplification efficiency and Ct values for target and reference genes.
The number of biological replicates must be equal across genes. If this
is not true, or there are |
numberOfrefGenes |
Integer specifying the number of reference genes used for normalization. |
Factor.level.order |
Optional character vector specifying the order of factor levels.
If |
paired |
Logical; if |
var.equal |
Logical; if |
p.adj |
Method for p-value adjustment. One of
|
order |
Optional character vector specifying the order of genes in the output plot. |
Details
Relative expression values are computed using one or more reference genes for normalization. Both paired and unpaired experimental designs are supported.
Paired samples in quantitative PCR refer to measurements collected from the same individuals under two different conditions (e.g. before vs after treatment), whereas unpaired samples originate from different individuals in each condition. Paired designs allow within-individual comparisons and typically reduce inter-individual variability.
The function returns numerical summaries as well as bar plots based on either relative expression (RE) or log2 fold change (log2FC).
All the functions for relative expression analysis (including 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()') return the relative expression table which include fold change and corresponding statistics. The output of 'ANOVA_DDCt()', 'ANCOVA_DDCt()', 'ANCOVA_DDCt()', 'REPEATED_DDCt()', and 'ANOVA_DCt()' also include lm models, residuals, raw data and ANOVA table for each gene.
The expression table returned by 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', and 'REPEATED_DDCt()' functions include these columns: gene (name of target genes), contrast (calibrator level and contrasts for which the relative expression is computed), RE (relative expression or fold change), log2FC (log(2) of relative expression or fold change), pvalue, sig (per-gene significance), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of mean calculated from the weighted delta Ct values of each of the main factor levels), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), and Upper.se.log2FC (The upper limit error bar for log2 RE)
Value
A list with the following components:
- Result
Table containing RE values, log2FC, p-values, significance codes, confidence intervals, standard errors, and lower/upper SE limits.
Author(s)
Ghader Mirzaghaderi
References
LivakKJ, Schmittgen TD (2001). Analysis of Relative Gene Expression Data Using Real-Time Quantitative PCR and the Double Delta CT Method. Methods, 25(4), 402–408. doi:10.1006/meth.2001.1262
Ganger MT, Dietz GD, and Ewing SJ (2017). A common base method for analysis of qPCR data and the application of simple blocking in qPCR experiments. BMC Bioinformatics, 18, 1–11.
Taylor SC, Nadeau K, Abbasi M, Lachance C, Nguyen M, Fenrich, J. (2019). The ultimate qPCR experiment: producing publication quality, reproducible data the first time. Trends in Biotechnology, 37, 761-774.
Yuan JS, Reed A, Chen F, Stewart N (2006). Statistical Analysis of Real-Time PCR Data. BMC Bioinformatics, 7, 85.
Examples
# Example data structure
data1 <- read.csv(system.file("extdata", "data_ttest18genes.csv", package = "rtpcr"))
# Unpaired t-test
TTEST_DDCt(
data1,
paired = FALSE,
var.equal = TRUE,
numberOfrefGenes = 1)
# With amplification efficiencies
data2 <- read.csv(system.file("extdata", "data_1factor_one_ref_Eff.csv", package = "rtpcr"))
TTEST_DDCt(
data2,
numberOfrefGenes = 1)
# Two reference genes
data3 <- read.csv(system.file("extdata", "data_1factor_Two_ref.csv", package = "rtpcr"))
TTEST_DDCt(
data3,
numberOfrefGenes = 2)
Delta Delta Ct method wilcox.test analysis
Description
The WILCOX_DDCt function performs fold change expression analysis based on
the \Delta \Delta C_T method using wilcox.test. It supports analysis
of one or more target genes evaluated under two experimental conditions
(e.g. control vs treatment).
Usage
WILCOX_DDCt(
x,
numberOfrefGenes,
Factor.level.order = NULL,
paired = FALSE,
p.adj = "none",
order = "none"
)
Arguments
x |
A data frame containing experimental conditions, biological replicates, and
amplification efficiency and Ct values for target and reference genes.
The number of biological replicates must be equal across genes. If this
is not true, or there are |
numberOfrefGenes |
Integer specifying the number of reference genes used for normalization. |
Factor.level.order |
Optional character vector specifying the order of factor levels.
If |
paired |
Logical; if |
p.adj |
Method for p-value adjustment. One of
|
order |
Optional character vector specifying the order of genes in the output plot. |
Details
Relative expression values are computed using reference gene(s) for normalization. Both paired and unpaired experimental designs are supported.
Paired samples in quantitative PCR refer to measurements collected from the same individuals under two different conditions (e.g. before vs after treatment), whereas unpaired samples originate from different individuals in each condition. Paired designs allow within-individual comparisons and typically reduce inter-individual variability.
The function returns expression table. The expression table returned by 'TTEST_DDCt()', 'WILCOX_DDCt()', 'ANOVA_DDCt()', 'ANCOVA_DDCt()', and 'REPEATED_DDCt()' functions include these columns: gene (name of target genes), contrast (calibrator level and contrasts for which the relative expression is computed), RE (relative expression or fold change), log2FC (log(2) of relative expression or fold change), pvalue, sig (per-gene significance), LCL (95% lower confidence level), UCL (95% upper confidence level), se (standard error of mean calculated from the weighted delta Ct values of each of the main factor levels), Lower.se.RE (The lower limit error bar for RE which is 2^(log2(RE) - se)), Upper.se.RE (The upper limit error bar for RE which is 2^(log2(RE) + se)), Lower.se.log2FC (The lower limit error bar for log2 RE), and Upper.se.log2FC (The upper limit error bar for log2 RE)
Value
A table containing RE values, log2FC, p-values, significance, confidence intervals, standard errors, and lower/upper SE limits.
Author(s)
Ghader Mirzaghaderi
References
Yuan, J. S., Reed, A., Chen, F., and Stewart, N. (2006). Statistical Analysis of Real-Time PCR Data. BMC Bioinformatics, 7, 85.
Examples
# Example data structure
data <- read.csv(system.file("extdata", "data_Yuan2006PMCBioinf.csv", package = "rtpcr"))
# Unpaired t-test
WILCOX_DDCt(
data,
paired = FALSE,
numberOfrefGenes = 1)
# Two reference genes
data2 <- read.csv(system.file("extdata", "data_1factor_Two_ref.csv", package = "rtpcr"))
WILCOX_DDCt(
data2,
numberOfrefGenes = 2,
p.adj = "none")
Cleaning data and weighted delta Ct (wDCt) calculation
Description
The compute_wDCt function cleans the data and computes wDCt. This function is
automatically applied to the expression analysis functions like ANOVA_DDCt,
TTEST_DDCt, etc. So it should not be applied in advance of expression analysis functions.
Usage
compute_wDCt(x, numOfFactors, numberOfrefGenes, block)
Arguments
x |
A data frame containing experimental design columns, replicates (integer), target gene E/Ct column pairs, and reference gene E/Ct column pairs. Reference gene columns must be located at the end of the data frame. |
numOfFactors |
Integer. Number of experimental factor columns
(excluding |
numberOfrefGenes |
Integer. Number of reference genes. |
block |
Character or |
Details
The compute_wDCt function computes weighted delta Ct (wDCt) for the input data.
Missing data can be denoted by NA in the input data frame.
Values such as '0' and 'undetermined' (for any E and Ct) are
automatically converted to NA. For target genes, NA for E or Ct measurements cause returning NA for
the corresponding delta Ct for that replicate (row).
If there are more than one reference gene, NA in the place of the E or the Ct value cause
skipping that gene and remaining references are geometrically averaged.
The compute_wDCt function is automatically applied to the expression analysis
functions.
Value
The original data frame along with the weighted delta Ct column.
Examples
data <- read.csv(system.file("extdata", "data_2factorBlock3ref.csv", package = "rtpcr"))
data
compute_wDCt(x = data,
numOfFactors = 2,
numberOfrefGenes = 3,
block = "block")
Sample data (one factor three levels)
Description
A sample dataset. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_1factor
Format
A data frame with 9 observations and 6 variables:
- SA
An experimental factor here called SA
- Rep
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- GAPDH
Mean amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample qPCR data (one target and two reference genes under two different conditions)
Description
Sample qPCR data (one target and two reference genes under two different conditions)
Usage
data_1factor_Two_ref
Format
A data frame with 6 observations and 8 variables:
- Condition
Experimental conditions
- Rep
Biological replicates
- DER5
amplification efficiency of DER5 gene
- Ct_DER5
Ct values of DER5 gene. Each is the mean of technical replicates
- Actin
Amplification efficiency of Actin gene
- Ct_Actin
Ct values of Actin gene. Each is the mean of technical replicates
- HPRT
Amplification efficiency of HPRT gene
- Ct_HPRT
Ct values of HPRT gene
Source
Not applicable
Sample qPCR data (two different conditions)
Description
Sample qPCR data (two different conditions)
Usage
data_1factor_one_ref
Format
A data frame with 6 observations and 10 variables:
- Condition
Experimental conditions
- Rep
Biological replicates
- C2H2_26
amplification efficiency of C2H2_26 gene
- C2H2_26_Ct
Ct values of C2H2_26 gene. Each is the mean of technical replicates
- C2H2_01
Amplification efficiency of C2H2_01 gene
- C2H2_01_Ct
Ct values of C2H2_01 gene. Each is the mean of technical replicates
- C2H2_12
Amplification efficiency of C2H2_12 gene
- C2H2_12_Ct
Ct values of C2H2_12 gene
- ref
Amplification efficiency of ref gene
- ref_Ct
Ct values of ref gene
Source
University of Kurdistan
Sample qPCR data (two different conditions)
Description
Sample qPCR data (two different conditions)
Usage
data_1factor_one_ref_Eff
Format
A data frame with 6 observations and 6 variables:
- Con
Experimental conditions
- r
Biological replicates
- target
Amplification efficiency of target gene
- target_Ct
Ct values of target gene
- Actin
Amplification efficiency of reference gene
- Actin_Ct
Ct values of reference gene
Source
University of Kurdistan
Sample data (two factor)
Description
A sample dataset. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_2factor
Format
A data frame with 18 observations and 7 variables:
- Genotype
First experimental factor
- Drought
Second experimental factor
- Rep
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- GAPDH
Mean amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample data in (two factor with blocking factor)
Description
A sample qPCR data set with blocking factor. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_2factor3ref
Format
A data frame with 18 observations and 8 variables:
- factor1
First experimental factor
- factor2
Second experimental factor
- Rep
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- GAPDH
Mean amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct values of GAPDH gene. Each is the mean of technical replicates
- ref2
Mean amplification efficiency of ref2 gene
- Ct_ref2
Ct values of ref2 gene. Each is the mean of technical replicates
- ref3
Mean amplification efficiency of ref3 gene
- Ct_ref3
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample data in (two factor with blocking factor)
Description
A sample qPCR data set with blocking factor. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_2factorBlock
Format
A data frame with 18 observations and 8 variables:
- Type
First experimental factor
- Concentration
Second experimental factor
- block
Second experimental factor
- Rep
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- GAPDH
Mean amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample data in (two factor with blocking factor and 3 reference genes)
Description
A sample qPCR data set with blocking factor and 3 reference genes. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_2factorBlock3ref
Format
A data frame with 18 observations and 8 variables:
- Type
First experimental factor
- Concentration
Second experimental factor
- block
blocking factor
- Rep
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- NLM
Mean amplification efficiency of NLM gene
- Ct_NLM
Ct values of NLM gene. Each is the mean of technical replicates
- ref1
Mean amplification efficiency of ref1 gene
- Ct_ref1
Ct values of ref1 gene. Each is the mean of technical replicates
- ref2
Mean amplification efficiency of ref2 gene
- Ct_ref2
Ct values of ref2 gene. Each is the mean of technical replicates
- ref3
Mean amplification efficiency of ref3 gene
- Ct_ref3
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample data (three factor)
Description
A sample dataset. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_3factor
Format
A data frame with 36 observations and 8 variables:
- Type
First experimental factor
- Conc
Second experimental factor
- SA
Third experimental factor
- Replicate
Biological replicates
- PO
Mean amplification efficiency of PO gene
- Ct_PO
Ct values of PO gene. Each is the mean of technical replicates
- GAPDH
Mean amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct values of GAPDH gene. Each is the mean of technical replicates
Source
Not applicable
Sample data in (multi-group design with 6 target genes)
Description
A sample qPCR data set with four experimental groups (Uninjected, SNConly, DMSORPE, SNCRPE) and six target genes normalized to one reference gene (Gapdh). Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_Heffer2020PlosOne
Format
A data frame with 18 observations and 16 variables:
- Treatment
Experimental treatment group
- rep
Biological replicates
- Fn1, Ct.Fn1
Efficiency and Ct values of Fn1 gene
- Col1a1, Ct.Col1a1
Efficiency and Ct values of Col1a1 gene
- Acta2, Ct.Acta2
Efficiency and Ct values of Acta2 gene
- TgfB, Ct.TgfB
Efficiency and Ct values of TgfB gene
- Tnfa, Ct.Tnfa
Efficiency and Ct values of Tnfa gene
- Mcp1, Ct.Mcp1
Efficiency and Ct values of Mcp1 gene
- Gapdh, Ct.Gapdh
Efficiency and Ct values of Gapdh reference gene
Details
This dataset is suitable for t-test or one-way ANOVA based expression analysis of multiple genes.
Source
Not applicable
Sample data (with technical replicates)
Description
A sample data for calculating biological replicated. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_Lee_etal2020qPCR
Format
A data frame with 72 observations and 8 variables:
- factor1
experimental factor
- DS
DS
- biolRep
biological replicate
- techRep
technical replicates
- APOE
Amplification efficiency of APOE gene
- Ct_APOE
Ct of APOE gene
- GAPDH
Amplification efficiency of GAPDH gene
- Ct_GAPDH
Ct of GAPDH gene
Source
Lee et al, (2020) <doi:10.12688/f1000research.23580.2>
Sample data in (one factor with one reference gene)
Description
A sample qPCR data set with one experimental factor (condition) and one reference gene. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_Yuan2006PMCBioinf
Format
A data frame with 24 observations and 6 variables:
- condition
Experimental factor with two levels (control, treatment)
- rep
Biological replicates
- target
Mean amplification efficiency of target gene
- Ct_target
Ct values of target gene. Each is the mean of technical replicates
- ref
Mean amplification efficiency of reference gene
- Ct_ref
Ct values of reference gene. Each is the mean of technical replicates
Source
Yuan2006PMCBioinf
Sample qPCR data: amplification efficiency 1
Description
A sample qPCR dataset for demonstrating efficiency calculation.
Usage
data_efficiency1
Format
A data frame with 21 observations and 4 variables:
- Dilutions
Dilution factor
- C2H2.26
Target gene 1
- C2H2.01
Target gene 2
- GAPDH
Reference gene
Source
Not applicable
Sample qPCR data: amplification efficiency 2
Description
A sample qPCR dataset for demonstrating efficiency calculation.
Usage
data_efficiency_Yuan2006PMCBioinf
Format
A data frame with 12 observations and 5 variables:
- dilutions
dilution factor
- ref_control
reference gene in control condition
- ref_treatment
reference gene in treatment condition
- target_control
target gene in control condition
- target_treatment
Reference gene in treatment condition
Source
Yuan2006PMCBioinf
Repeated measure sample data
Description
A repeated measure sample data in which 3 individuals have been analysed. In the "id" column, a unique number is assigned to each individual, e.g. all the three number 1 indicate one individual. samples are taken or measurements are scored over different time points (time column) from each individual.
Usage
data_repeated_measure_1
Format
A data frame with 9 observations and 6 variables:
- time
time course levels
- id
experimental factor
- Target
Amplification efficiency of target gene
- Ct_Target
Ct of target gene
- Ref
Amplification efficiency of reference gene
- Ct_Ref
Ct of reference gene
Source
NA
Repeated measure sample data
Description
A repeated measure sample data in which 6 individuals have been analysed. In the "id" column, a unique number is assigned to each individual, e.g. all the three number 1 indicate one individual. samples are taken or measurements are scored over different time points (time column) from each individual.
Usage
data_repeated_measure_2
Format
A data frame with 18 observations and 7 variables:
- treatment
treatment
- time
time course levels
- id
experimental factor
- Target
Amplification efficiency of target gene
- Target_Ct
Ct of target gene
- Ref
Amplification efficiency of reference gene
- Ref_Ct
Ct of reference gene
Source
NA
Sample data in (repeated-measures design with two reference genes)
Description
A sample qPCR data set with repeated measurements over time, a blocking factor, and two reference genes. The experiment includes two treatments (untreated and treated) with repeated measures on the same individuals (id).
Usage
data_repeated_measure_3bLock
Format
A data frame with 18 observations and 10 variables:
- treatment
Experimental treatment (untreated, treated)
- time
Time point of measurement
- blk
Blocking factor
- id
Subject/individual identifier for repeated measures
- Target
Mean amplification efficiency of target gene
- Ct_Target
Ct values of target gene
- Ref1
Mean amplification efficiency of reference gene 1
- Ct_Ref1
Ct values of reference gene 1
- Ref2
Mean amplification efficiency of reference gene 2
- Ct_Ref2
Ct values of reference gene 2
Details
This dataset is suitable for repeated-measures mixed-model analysis and normalization using multiple reference genes.
Source
Not applicable
Sample data in (two-group design with multiple target genes)
Description
A sample qPCR data set with two experimental groups (Control and Treatment) and 18 target genes normalized to one reference gene (GAPDH). Each line belongs to a separate individual (non-repeated measure experiment). This dataset is suitable for two-sample t-test based expression analysis.
Usage
data_ttest18genes
Format
A data frame with 8 observations and 38 variables:
- Condition
Experimental group (Control, Treatment)
- Rep
Biological replicates
- ANGPT1, Ct.ANGPT1
Efficiency and Ct values of ANGPT1 gene
- ANGPT2, Ct.ANGPT2
Efficiency and Ct values of ANGPT2 gene
- CCL2, Ct.CCL2
Efficiency and Ct values of CCL2 gene
- CCL5, Ct.CCL5
Efficiency and Ct values of CCL5 gene
- CSF2, Ct.CSF2
Efficiency and Ct values of CSF2 gene
- FGF2, Ct.FGF2
Efficiency and Ct values of FGF2 gene
- IL1A, Ct.IL1A
Efficiency and Ct values of IL1A gene
- IL1B, Ct.IL1B
Efficiency and Ct values of IL1B gene
- IL6, Ct.IL6
Efficiency and Ct values of IL6 gene
- IL8, Ct.IL8
Efficiency and Ct values of IL8 gene
- PDGFA, Ct.PDGFA
Efficiency and Ct values of PDGFA gene
- PDGFB, Ct.PDGFB
Efficiency and Ct values of PDGFB gene
- TGFA, Ct.TGFA
Efficiency and Ct values of TGFA gene
- TGFB, Ct.TGFB
Efficiency and Ct values of TGFB gene
- TNF, Ct.TNF
Efficiency and Ct values of TNF gene
- VEGFA, Ct.VEGFA
Efficiency and Ct values of VEGFA gene
- VEGFB, Ct.VEGFB
Efficiency and Ct values of VEGFB gene
- VEGFC, Ct.VEGFC
Efficiency and Ct values of VEGFC gene
- GAPDH, Ct.GAPDH
Efficiency and Ct values of GAPDH reference gene
Source
Not applicable
Sample data (with technical replicates)
Description
A sample data for calculating biological replicated. Each line belongs to a separate individual (non-repeated measure experiment).
Usage
data_withTechRep
Format
A data frame with 18 observations and 9 variables:
- Condition
experimental factor
- biolrep
biological replicate
- techrep
technical replicates
- target
Amplification efficiency of target gene
- Ct_target
Ct of target gene
- ref
Amplification efficiency of reference gene
- Ct_ref
Ct of reference gene
Source
Not applicable
Amplification efficiency statistics and standard curves
Description
The efficiency function calculates amplification efficiency (E)
and related statistics, including slope and coefficient of determination
(R^2), and generates standard curves for qPCR assays.
Usage
efficiency(df, base_size = 12, legend_position = c(0.2, 0.2), ...)
Arguments
df |
A data frame containing dilution series and corresponding Ct values. The first column should represent dilution levels, and the remaining columns should contain Ct values for different genes. |
base_size |
font size |
legend_position |
legend position |
... |
Additional ggplot2 layer arguments |
Details
Amplification efficiency is estimated from standard curves generated by
regressing Ct values against the logarithm of template dilution.
For each gene, the function reports the slope of the standard curve,
amplification efficiency (E), and R^2 as a measure of goodness of fit.
The function also provides graphical visualization of the standard curves.
Value
A list with the following components:
- efficiency
A data frame containing slope, amplification efficiency (E), and R
^2statistics for each gene.- Slope_compare
A table comparing slopes between genes.
- plot
A
ggplot2object showing standard curves for all genes.
Author(s)
Ghader Mirzaghaderi
Examples
# Load example efficiency data
data <- read.csv(system.file("extdata", "data_efficiency1.csv", package = "rtpcr"))
# Calculate amplification efficiency and generate standard curves
efficiency(data)
ef <- read.csv(system.file("extdata", "data_efficiency_Yuan2006PMCBioinf.csv", package = "rtpcr"))
efficiency(ef)
Internal global variables
Description
These objects are declared to avoid R CMD check notes about non-standard evaluation (e.g., in ggplot2).
Converts a 4-column qPCR long data format to wide format
Description
Converts a 4-column (Condition, gene, Efficiency, Ct) qPCR long data format to wide format
Usage
long_to_wide(x)
Arguments
x |
a 4-column (Condition, gene, Efficiency, Ct) qPCR long data |
Details
Converts a 4-column (Condition, gene, Efficiency, Ct) qPCR long data format to wide format
Value
A wide qPCR data frame
Author(s)
Ghader Mirzaghaderi
Examples
df <- read.table(header = TRUE, text = "
Condition Gene E Ct
control C2H2-26 1.8 31.26
control C2H2-26 1.8 31.01
control C2H2-26 1.8 30.97
treatment C2H2-26 1.8 32.65
treatment C2H2-26 1.8 32.03
treatment C2H2-26 1.8 32.4
control C2H2-01 1.75 31.06
control C2H2-01 1.75 30.41
control C2H2-01 1.75 30.97
treatment C2H2-01 1.75 28.85
treatment C2H2-01 1.75 28.93
treatment C2H2-01 1.75 28.9
control C2H2-12 2 28.5
control C2H2-12 2 28.4
control C2H2-12 2 28.8
treatment C2H2-12 2 27.9
treatment C2H2-12 2 28
treatment C2H2-12 2 27.9
control ref 1.9 28.87
control ref 1.9 28.42
control ref 1.9 28.53
treatment ref 1.9 28.31
treatment ref 1.9 29.14
treatment ref 1.9 28.63")
long_to_wide(df)
Computing the mean of technical replicates
Description
Computes the arithmetic mean of technical replicates for each sample or group. This is often performed before ANOVA or other statistical analyses to simplify comparisons between experimental groups.
Usage
meanTech(x, groups, numOfFactors, block)
Arguments
x |
A raw data frame containing technical replicates. |
groups |
An integer vector or character vector specifying the column(s) to group by before calculating the mean of technical replicates. |
numOfFactors |
Integer. Number of experimental factor columns |
block |
Character. Block column name or |
Details
The meanTech function calculates the mean of technical replicates
based on one or more grouping columns. This reduces the dataset to a single
representative value per group, facilitating downstream analysis such as
fold change calculation or ANOVA.
Value
A data frame with the mean of technical replicates for each group.
Author(s)
Ghader Mirzaghaderi
Examples
# Example input data frame with technical replicates
data1 <- read.csv(system.file("extdata", "data_withTechRep.csv", package = "rtpcr"))
# Calculate mean of technical replicates using first four columns as groups
meanTech(data1,
groups = 1:2,
numOfFactors = 1,
block = NULL)
# Another example using different dataset and grouping columns
data2 <- read.csv(system.file("extdata", "data_Lee_etal2020qPCR.csv", package = "rtpcr"))
meanTech(data2, groups = 1:3,
numOfFactors = 2,
block = NULL)
Combine multiple ggplot objects into a single layout
Description
The multiplot function arranges multiple ggplot2 objects
into a single plotting layout with a specified number of columns.
Usage
multiplot(..., cols = 1)
Arguments
... |
One or more |
cols |
Integer specifying the number of columns in the layout. |
Details
Multiple ggplot2 objects can be provided either as separate
arguments via ....
The function uses the grid package to control the layout.
Value
A grid object displaying multiple plots arranged in the specified layout.
Author(s)
Pedro J. (adapted from https://gist.github.com/pedroj/ffe89c67282f82c1813d)
Examples
# Example using output from TTEST_DDCt
data1 <- read.csv(system.file("extdata", "data_ttest18genes.csv", package = "rtpcr"))
out <- TTEST_DDCt(
data1,
paired = FALSE,
var.equal = TRUE,
numberOfrefGenes = 1)
p1 <- plotFactor(out,
x_col = "gene",
y_col = "log2FC",
Lower.se_col = "Lower.se.log2FC",
Upper.se_col = "Upper.se.log2FC",
letters_col = "sig")
p2 <- plotFactor(out,
x_col = "gene",
y_col = "RE",
Lower.se_col = "Lower.se.RE",
Upper.se_col = "Upper.se.RE",
letters_col = "sig")
# Example using output from ANOVA_DCt
data2 <- read.csv(system.file("extdata", "data_1factor.csv", package = "rtpcr"))
out2 <- ANOVA_DCt(
data2,
numOfFactors = 1,
numberOfrefGenes = 1,
block = NULL)
df <- out2$relativeExpression
p3 <- plotFactor(
df,
x_col = "SA",
y_col = "RE",
Lower.se_col = "Lower.se.RE",
Upper.se_col = "Upper.se.RE",
letters_col = "sig",
letters_d = 0.1,
col_width = 0.7,
err_width = 0.15,
fill_colors = "skyblue",
alpha = 1,
base_size = 14)
# Combine plots into a single layout
multiplot(p1, p2, cols = 2)
multiplot(p1, p3, cols = 2)
Bar plot of gene expression for 1-, 2-, or 3-factor experiments
Description
Creates a bar plot of relative gene expression (fold change) values from 1-, 2-, or 3-factor experiments, including error bars and statistical significance annotations.
Usage
plotFactor(
data,
x_col,
y_col,
Lower.se_col,
Upper.se_col,
group_col = NULL,
facet_col = NULL,
letters_col = NULL,
letters_d = 0.2,
col_width = 0.8,
err_width = 0.15,
dodge_width = 0.8,
fill_colors = NULL,
color = "black",
alpha = 1,
base_size = 12,
legend_position = "right",
...
)
Arguments
data |
Data frame containing expression results |
x_col |
Character. Column name for x-axis |
y_col |
Character. Column name for bar height |
Lower.se_col |
Character. Column name for lower SE |
Upper.se_col |
Character. Column name for upper SE |
group_col |
Character. Column name for grouping bars (optional) |
facet_col |
Character. Column name for faceting (optional) |
letters_col |
Character. Column name for significance letters (optional) |
letters_d |
Numeric. Vertical offset for letters (default |
col_width |
Numeric. Width of bars (default |
err_width |
Numeric. Width of error bars (default |
dodge_width |
Numeric. Width of dodge for grouped bars (default |
fill_colors |
Optional vector of fill colors to change the default colors |
color |
Optional color for the bar outline |
alpha |
Numeric. Transparency of bars (default |
base_size |
Numeric. Base font size for theme (default |
legend_position |
Character or numeric vector. Legend position (default |
... |
Additional ggplot2 layer arguments |
Value
ggplot2 plot object
Author(s)
Ghader Mirzaghaderi
Examples
data <- read.csv(system.file("extdata", "data_2factorBlock3ref.csv", package = "rtpcr"))
res <- ANOVA_DDCt(x = data,
numOfFactors = 2,
numberOfrefGenes = 2,
block = "block",
mainFactor.column = 2,
p.adj = "none")
df <- res$relativeExpression
p1 <- plotFactor(
data = df,
x_col = "contrast",
y_col = "RE",
group_col = "gene",
facet_col = "gene",
Lower.se_col = "Lower.se.RE",
Upper.se_col = "Upper.se.RE",
letters_col = "sig",
letters_d = 0.2,
alpha = 1,
col_width = 0.7,
dodge_width = 0.7,
base_size = 14,
legend_position = "none")
p1
data2 <- read.csv(system.file("extdata", "data_3factor.csv", package = "rtpcr"))
#Perform analysis first
res <- ANOVA_DCt(
data2,
numOfFactors = 3,
numberOfrefGenes = 1,
block = NULL)
df <- res$relativeExpression
# Generate three-factor bar plot
p <- plotFactor(
df,
x_col = "SA",
y_col = "log2FC",
group_col = "Type",
facet_col = "Conc",
Lower.se_col = "Lower.se.log2FC",
Upper.se_col = "Upper.se.log2FC",
letters_col = "sig",
letters_d = 0.3,
col_width = 0.7,
dodge_width = 0.7,
#fill_colors = c("blue", "brown"),
color = "black",
base_size = 14,
alpha = 1,
legend_position = c(0.1, 0.2))
p