GEx qPCR analysis - bcfgothenburg/HT23 GitHub Wiki
Course: HT23 Gene expression analysis using R (SC00034)
PCR is typically used to measure the amount of gene transcripts or double-stranded DNA in a sample and is used for both diagnostic and basic research.
In these exercises we will assess efficiency and quantify gene expression of a target gene c-myc, normalized by a control GAPDH in kidney samples relative to the brain samples. We will use the ΔΔCT method to get the relative quantification and we will also compare the expression between groups.
Based on Analysis of real-time qPCR data
Good Luck!
In this exercise we are going to analyze the expression of c-myc. The example data contains the CT values of two genes from 12 different samples.
-
Open the qPCR template from canvas in RStudio.
-
Install and load the package
pcrfrom CRAN with the code
install.packages("pcr") -
Load the installed package with the function
library() -
Locate and save the filepath to a variable for the raw ct data using the
system.file()function
fl <- system.file("extdata", "ct1.csv", package = "pcr") - Read in the data
ct1 <- readr::read_csv(fl) # or use ct1<-read.csv(fl) - Add a grouping variable for the brain and kidney samples (required for the following analyze).
group_var <- rep(c("brain", "kidney"), each = 6) - Use the
pcr_analyzefunction from thepcrpackage to calculate the relative expression. Type?pcr_analyzein the console for more info. The input includes the CT value of c-myc in kidney and brain samples, which will be normalized to the control GAPDH.
pcr_analyze(ct1,
group_var = group_var,
reference_gene = "GAPDH",
reference_group = "brain") Q1. Look at the result table. What is the relative expression of c-myc in the kidney relative to the brain? What assumption about the PCR efficiency have been made for these calculations? Add the answers to your report.
In this exercise we are going to look at the efficiency of the PCR reaction. Many calculations assume a 2-fold increase (100% efficiency) each cycle, but is it really 100%?
First calculate it using the built in function and after that manually using the lm() function in R. Is there any difference?
-
Use the
pcr_assessfunction frompcrpackage. Type?pcr_assessin the console for more info. -
Locate and save the file path to a variable using the
system.file()function
fl <- system.file("extdata", "ct3.csv", package = "pcr")-
Read in the data to an object
-
Make a vector of RNA amounts for the standard curve, 3 each of the following values 1, .5, .2, .1, .05, .02, .01.
-
Calculate amplification efficiency using the standard curve option.
-
As you remember from the lectures the value of the amplification efficiency is given by
E=10^(−1/slope) - 1.
Q2. What is the slope and the efficiency for c_myc? Include the values in your report.
- Now use the
lm()function inRand calculate the slope and the efficiency for c_myc using the amount vector you created in step 4 above i.elm(ct3$c_myc ~ log10(amount)). Hint you can use either the coefs() or the summary() function on your lm object to extract the coefficients.
Here we are going to look at the efficiency of the PCR reaction visually, using the same dataset as in Exercise 2. Again we use the pcr_assess function from pcr package, but this time with the method = "efficiency" and plot = TRUE options. A plot is produced that shows the average and standard deviation of ΔCT at difference input amounts.
-
Run the
pcr_assessfunction above but change method and the plot option. -
If you like you can pass
ggplot2options to make the graph look better (ielabsandtheme), try it out! -
What does the axis represent?
Q3. Look at the slope of the trend line. What does the slope indicate? What are the values of the slope and R2? Include the values in your report.
When using the ct3 dataset we saw that the slope and intercept deviated from the 100% PCR efficiency slope we learned at the lectures. Now we are going to recalculate Exercise 1 with the slope and intercept we got in exercise 2.
-
Save the output of exercise 2 to an object and use
str()to see how you extract the slopes and intercept. Save them to slope and intersect, respectively. -
Redo exercise 1 with the extra options
method = "relative_curve", to use the real values for the PCR efficiency and not the assumed 100% efficiency. Hint use?pcr_analyzeto figure out how.
Q4. Does the result differ from Exercise 1? If so how?
Here we will be testing for statistical significance between conditions using the pcr_test function from the pcr package. Type ?pcr_test in the console for more info.
In this exercise the ct4 data set consisting of 48 samples will be used. It has two gene columns ref and target. The samples came from two groups as indicated in the grouping variable. The arguments reference_gene and reference_control are used to construct the comparison in a similar way they when the relative expression was calculated.
-
Locate and save the filepath to ct4.csv from the pcr package using the
system.file()function -
Make grouping variable for the statistical tests between groups control and treatment, 12 of each.
-
Run an initial analysis using the
pcr_analyzefunction from thepcr packageto find out the relative expression for the controls and treated samples, respectively. What is the relative expression of the controls and treated samples? -
Now run the analyses with firstly the options
t.testand secondlywilcox.testand note the difference in your report.
**Q5. Name the main reason to use a Wilcoxon test instead of a T-test. (Hint: What is one of the assumptions of the t-test?) **
-
When using the
t.testwhat does the estimate represent (Hint: type?t.testand look forestimateunder the value section). -
If you haven’t already done it, save your script for future use. Also check if you have enough comments that will help you understand the code later.
Developed by Björn Andersson, 2019.