install.packages(c('dplyr','ggplot2','reshape2','ggbeeswarm','optparse'))
git clone https://github.com/HaojiaWu/qPCR-processing.git
cd qPCR-processingExample code:
Rscript --vanilla plot_qPCR.R -q Cqfile.csv -m metadata.csv -g ref_gene_ID -s ref_sample_ID -n output_nameUsage: plot_qPCR.R [options]
Options:
-q, --cqfile
The Cq file from qPCR machine. Must be in csv format.
-m, --metadata
A metadata file to assign your samples into groups. Must be in csv format.
-g, --refgene
The gene used for normalization. e.g. GAPDH.
-s, --refsample
The sample used as reference sample. e.g. sample from the control group.
-n, --name
The output file name
-h, --help
Show this help message and exit
Here is an example for the metadata file (please keep the column names exactly as "Sample" and "Group"):
| Sample | Group |
|---|---|
| A1 | Ctrl |
| A2 | Ctrl |
| A3 | Ctrl |
| A4 | Disease |
| A5 | Disease |
| A6 | Disease |
| A7 | Treatment |
There are three output files produced from this script. The csv file contains the average quantitative value (2^-ΔΔCt) for each sample (and each gene) after normalized by the reference gene (e.g. GAPDH) and the reference sample (e.g. sample from the control group). This file can be input into Graphpad Prism. The txt file includes all statistics from comparisons of any two given groups. If the run has two groups only, Welch's t test will be performed. Otherwise, one-way ANOVA with post-hoc Tukey's test will be performed. Finally, the tiff file is a boxplot graph to visualize the gene expression across groups.
Example of the csv file output:
| Sample | Gene1 | Gene2 | Group |
|---|---|---|---|
| A1 | 1.00 | 1.00 | Ctrl |
| A2 | 0.85 | 1.12 | Ctrl |
| A3 | 0.89 | 1.10 | Ctrl |
| A4 | 0.93 | 1.04 | Disease |
| A5 | 1.08 | 0.86 | Disease |
| A6 | 0.99 | 1.16 | Disease |
| A7 | 0.98 | 0.87 | Treatment |
Example of the txt file output:
$Gene3 ~ Group
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = x, data = new.data2)
$Group
| Comparison | diff | lwr | upr | p adj |
|---|---|---|---|---|
| Disease-Ctrl | 0.3255648 | -0.1188723 | 0.7700018 | 0.1408691 |
| Treatment-Ctrl | 0.1660909 | 0.2216539 | 1.1105280 | 0.8805601 |
| Treatment-Disease | 0.3405262 | -0.1039109 | 0.7849633 | 0.1234654 |