# How to calculate RNA copies in qPCR using R?

I have these Ct data from qPCR for a series of samples A-H, I want to quantify the RNA copies of my samples using R:

Sample_ID   Replicate1_Ct Replicate2_Ct
A           22.92         24.21
B           24.29         22.16
C           24.29         22.16
D           27.91         23.76
E           21.44         22.81
F           16.50         18.31
G           17.79         16.56
H           17.34         19.09


In addition, I have measured a standard (STD) curve of copy number of the RNA in question, that I want to use as a reference:

STD_Ct      STD_copies      Log10(STD_copies)
33          4.00E+03        3
28          4.00E+04        4
24          4.00E+05        5
20          4.00E+06        6
15          4.00E+07        7
12          4.00E+08        8



It seems

This the original data form:

• This is pretty unclear- at a minimum we need some explanation of the data table. e.g. why do rows G and H not have standards when all other rows do? Is each row a different standard sample? Do you have a loading control reaction for each sample? Nov 28 '20 at 20:44
• The first two columns are the the mean of two replicates, I wanted to make it simple, the standard is only 6 rows, the standard has nothing to do with the samples, it was there just to build to the standard curve to use it for the absolute method @MaximilianPress Nov 28 '20 at 20:54
• I will edit the question to makes this clearer. Nov 28 '20 at 21:13
• I updated the question with the table from excel @MaximilianPress , it should reflect a better idea. Nov 28 '20 at 21:30
• Discussion of latest update moved to a chat. I think there is a numerical error in the way the predictions are being generated, but you seem ok with the results so I'm calling this done. Nov 29 '20 at 23:11

Now that we've straightened out the data, it seems like the simplest solution is to just linearly interpolate the copy number from your standard curve.

When I read your standard curve (std) and your sample data (ct) into R, I see that the log10(Ct) fits the copy number fairly well, whereas the linear is a bit harder:

So we can fit a model to predict copy number based on Ct on the STD data:

> fit = lm(std$$Log10.STD_copies. ~ std$$STD_Ct)
> fit

Call:
lm(formula = std$$Log10.STD_copies. ~ std$$STD_Ct)

Coefficients:
(Intercept)   std$STD_Ct 10.6847 -0.2357 # we plug those numbers into the linear equation, # taking the mean of the two replicates for a best estimate. > rowMeans(ct[,2:3]) * -.2357 + 10.6847 [1] 5.130429 5.210567 5.210567 4.595390 5.469837 6.582341 [7] 6.636553 6.391424  So those are log10(copy number) estimates, of a sort. You can get much more elaborate, of course. • I accepted your answer and upvoted for the efforts, however; I'm not getting the correct results, both intercept (45.29) and slope (-4.2435) are not accurate, I suppose the correct formula (to calculate RNA copies) would be Copy number = 10^((Ct - Intercept)/(Slope))  Nov 29 '20 at 1:27 • @user432797 I think that those parameters would come if you fit the model lm(std$STD_Ct ~std$Log10.STD_copies.), which is then intercept 45.26 and slope -4.23. I believe that you simply want to switch your independent and dependent variables to do your prediction. Nov 29 '20 at 3:42 • I checked another software and it shows intercept (45.29) and slope (-4.2435) @MaximilianPress so I will proceed with these numbers. Nov 29 '20 at 4:47 • @user432797 I honestly wouldn't recommend that- I would recommend instead fitting the model as lm(std$Log10.STD_copies. ~ std\$STD_Ct ), because you are trying to predict copy number from Ct. If you use those parameters that you mention, those are predicting Ct from copy number, which is the opposite of what you want. Obviously, you are free to do as you like, but that does not seem appropriate to me. Nov 29 '20 at 5:03
• @user432797 it sounds like there might still be some numerical error. Are the values that I've given in my answer implausible? I can't see your results. Nov 29 '20 at 15:40