## Monday, July 13, 2015

### 7 13 2015 TLR expression boxplot and statistics

To see how TLR compares to the other I ran data cultivated before I put in place the optimization practices for the qPCR. TLR tends to have issues amplifying in Dabob samples which possibly don't express the gene. To get the script to work properly I had to eliminate several samples which had very low or very high expression values which were errors generated by qpcR.  TLRrepscript.R
#Load in required packages for functions below
require(qpcR)
## Loading required package: qpcR
## Loading required package: Matrix
require(plyr)
## Loading required package: plyr
require(ggplot2)
## Loading required package: ggplot2
require(splitstackshape)
## Loading required package: splitstackshape
## Loading required package: data.table
#Read in raw fluorescence data from 1st Actin replicate
#Remove blank first column entitled "X"
rep1$X<-NULL #Rename columns so that qpcR package and appropriately handle the data rep1<-rename(rep1, c("Cycle" = "Cycles", "A1" = "H_C_1", "A2" = "N_C_1", "A3"= "S_C_1", "A4"="H_T_1", "A5"="N_T_1","A6"="S_T_1", "A7"="NT_C_1","B1" = "H_C_2", "B2" = "N_C_2","B3"= "S_C_2", "B4"="H_T_2", "B5"="N_T_2", "B6"="S_T_2","B7"="NT_C_2", "C1" = "H_C_3", "C2" = "N_C_3","C3"= "S_C_3","C4"="H_T_3", "C5"="N_T_3", "C6"="S_T_3", "C7"="NT_C_3","D1" = "H_C_4", "D2" = "N_C_4","D3"= "S_C_4", "D4"="H_T_4", "D5"="N_T_4", "D6"="S_T_4", "D7"="NT_C_4","E1" = "H_C_5", "E2" = "N_C_5", "E3"= "S_C_5", "E4"="H_T_5", "E5"="N_T_5", "E6"="S_T_5", "F1" = "H_C_6", "F2" = "N_C_6","F3"= "S_C_6", "F4"="H_T_6", "F5"="N_T_6", "F6"="S_T_6","G1" = "H_C_7", "G2" = "N_C_7", "G3"= "S_C_7", "G4"="H_T_7", "G5"="N_T_7", "G6"="S_T_7", "H1" = "H_C_8", "H2" = "N_C_8","H3"= "S_C_8", "H4"="H_T_8", "H5"="N_T_8", "H6"="S_T_8")) #Run data through pcrbatch in qpcR package which analyzes fluorescence and produces efficiency and cycle threshold values rep1ct<-pcrbatch(rep1, fluo=NULL) ## Making model for H_C_1 (l4) ## => Fitting passed... ## ## Making model for N_C_1 (l4) ## => Fitting passed... ## ## Making model for S_C_1 (l4) ## => Fitting passed... ## ## Making model for H_T_1 (l4) ## => Fitting passed... ## ## Making model for N_T_1 (l4) ## => Fitting passed... ## ## Making model for S_T_1 (l4) ## => Fitting passed... ## ## Making model for NT_C_1 (l4) ## => Fitting passed... ## ## Making model for H_C_2 (l4) ## => Fitting passed... ## ## Making model for N_C_2 (l4) ## => Fitting passed... ## ## Making model for S_C_2 (l4) ## => Fitting passed... ## ## Making model for H_T_2 (l4) ## => Fitting passed... ## ## Making model for N_T_2 (l4) ## => Fitting passed... ## ## Making model for S_T_2 (l4) ## => Fitting passed... ## ## Making model for NT_C_2 (l4) ## => Fitting passed... ## ## Making model for H_C_3 (l4) ## => Fitting passed... ## ## Making model for N_C_3 (l4) ## => Fitting passed... ## ## Making model for S_C_3 (l4) ## => Fitting passed... ## ## Making model for H_T_3 (l4) ## => Fitting passed... ## ## Making model for N_T_3 (l4) ## => Fitting passed... ## ## Making model for S_T_3 (l4) ## => Fitting passed... ## ## Making model for NT_C_3 (l4) ## => Fitting passed... ## ## Making model for H_C_4 (l4) ## => Fitting passed... ## ## Making model for N_C_4 (l4) ## => Fitting passed... ## ## Making model for S_C_4 (l4) ## => Fitting passed... ## ## Making model for H_T_4 (l4) ## => Fitting passed... ## ## Making model for N_T_4 (l4) ## => Fitting passed... ## ## Making model for S_T_4 (l4) ## => Fitting passed... ## ## Making model for NT_C_4 (l4) ## => Fitting passed... ## ## Making model for H_C_5 (l4) ## => Fitting passed... ## ## Making model for N_C_5 (l4) ## => Fitting passed... ## ## Making model for S_C_5 (l4) ## => Fitting passed... ## ## Making model for H_T_5 (l4) ## => Fitting passed... ## ## Making model for N_T_5 (l4) ## => Fitting failed. Tagging name of N_T_5... ## ## Making model for S_T_5 (l4) ## => Fitting passed... ## ## Making model for H_C_6 (l4) ## => Fitting passed... ## ## Making model for N_C_6 (l4) ## => Fitting passed... ## ## Making model for S_C_6 (l4) ## => Fitting passed... ## ## Making model for H_T_6 (l4) ## => Fitting passed... ## ## Making model for N_T_6 (l4) ## => Fitting passed... ## ## Making model for S_T_6 (l4) ## => Fitting passed... ## ## Making model for H_C_7 (l4) ## => Fitting passed... ## ## Making model for N_C_7 (l4) ## => Fitting passed... ## ## Making model for S_C_7 (l4) ## => Fitting passed... ## ## Making model for H_T_7 (l4) ## => Fitting passed... ## ## Making model for N_T_7 (l4) ## => Fitting passed... ## ## Making model for S_T_7 (l4) ## => Fitting passed... ## ## Making model for H_C_8 (l4) ## => Fitting passed... ## ## Making model for N_C_8 (l4) ## => Fitting passed... ## ## Making model for S_C_8 (l4) ## => Fitting passed... ## ## Making model for H_T_8 (l4) ## => Fitting passed... ## ## Making model for N_T_8 (l4) ## => Fitting passed... ## ## Making model for S_T_8 (l4) ## => Fitting passed... ## ## Calculating delta of first/second derivative maxima... ## .........10.........20.........30.........40.........50 ## .. ## Found univariate outlier for NT_C_3 NT_C_4 S_T_5 H_T_6 H_T_7 ## Tagging name of NT_C_3 NT_C_4 S_T_5 H_T_6 H_T_7 ... ## Analyzing H_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **NT_C_3** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **NT_C_4** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing *N_T_5* ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **S_T_5** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **H_T_6** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **H_T_7** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... #pcrbatch creates a file with each sample as an individual column in the dataframe. The problem with this is #that I want to compare all the Ct (labelled sig.cpD2) and generate expression data for them but these values have to be #in individual columns. To do this I must transpose the data and set the first row as the column names. rep1res<-setNames(data.frame(t(rep1ct)),rep1ct[,1]) #Now I must remove the first row as it is a duplicate and will cause errors with future analysis rep1res<-rep1res[-1,] #since the sample names are now in the first column the column title is row.names. This makes analys hard based on the ability to call the first column. #to eliminate this issue, I copied the first column into a new column called "Names" rep1res$Names<-rownames(rep1res)

#Since each sample name contains information such as Population, Treatment, and Sample Number I want to separate out these factors
#into new columns so that I can run future analysis based on population, treatment, or both. Also note the "drop = F" this is so the original names column remains.
rep1res2<-cSplit_f(rep1res, splitCols=c("Names"), sep="_", drop = F)

#After splitting the names column into three new columns I need to rename them appropriately.
rep1res2<-rename(rep1res2, c("Names_1"="Pop", "Names_2"="Treat", "Names_3"="Sample"))

#I also create a column with the target gene name. This isn't used in this analysis but will be helpful for future work.
rep1res2$Gene<-rep("TLR", length(rep1res2)) #In transposing the data frame, the column entries became factors which cannot be used for equations. #to fix this, I set the entries for sig.eff (efficiency) and sig.cpD2 (Ct value) to numeric. Be aware, without the as.character function the factors will be transformed inappropriately. rep1res2$sig.eff<-as.numeric(as.character(rep1res2$sig.eff)) rep1res2$sig.cpD2<-as.numeric(as.character(rep1res2sig.cpD2)) #Now I plot the Ct values to see how they align without converting them to expression. ggplot(rep1res2, aes(x=Names,y=sig.cpD2, fill=Pop))+geom_bar(stat="identity") #Now I want to get expression information from my data set. qpcR has a way of doing this but its complicated and I'm not comfortable using it. #Luckily there is an equation I can use to do it. The equation is expression = 1/(1+efficiency)^Ctvalue. I tried multiple ways to get this to work in R #but it doesn't handle the complicated equation easily. #To work around this, I created a function in R to run the equation and produce an outcome. x = efficiency argument, y=Ctvalue argument expr<-function(x,y){ newVar<-(1+x)^y 1/newVar } #Now I run the data through the function and produce a useful expression value rep1res2expression<-expr(rep1res2$sig.eff, rep1res2$sig.cpD2)

#Graphing the expression values is a good way to examine the data quickly for errors that might have occurred.
ggplot(rep1res2, aes(x=Names,y=expression, fill=Pop))+geom_bar(stat="identity")

#Before I'm able to compare the replicates I need to process the raw fluorescence from the second Actin run.
#To do this I perform all the same steps as the previous replicate.
rep2$X<-NULL rep2<-rename(rep2, c("Cycle" = "Cycles", "A1" = "H_C_1", "A2" = "N_C_1", "A3"= "S_C_1", "A4"="H_T_1", "A5"="N_T_1","A6"="S_T_1", "A7"="NT_C_1","B1" = "H_C_2", "B2" = "N_C_2","B3"= "S_C_2", "B4"="H_T_2", "B5"="N_T_2", "B6"="S_T_2","B7"="NT_C_2", "C1" = "H_C_3", "C2" = "N_C_3","C3"= "S_C_3","C4"="H_T_3", "C5"="N_T_3", "C6"="S_T_3", "C7"="NT_C_3","D1" = "H_C_4", "D2" = "N_C_4","D3"= "S_C_4", "D4"="H_T_4", "D5"="N_T_4", "D6"="S_T_4", "D7"="NT_C_4","E1" = "H_C_5", "E2" = "N_C_5", "E3"= "S_C_5", "E4"="H_T_5", "E5"="N_T_5", "E6"="S_T_5", "F1" = "H_C_6", "F2" = "N_C_6","F3"= "S_C_6", "F4"="H_T_6", "F5"="N_T_6", "F6"="S_T_6","G1" = "H_C_7", "G2" = "N_C_7", "G3"= "S_C_7", "G4"="H_T_7", "G5"="N_T_7", "G6"="S_T_7", "H1" = "H_C_8", "H2" = "N_C_8","H3"= "S_C_8", "H4"="H_T_8", "H5"="N_T_8", "H6"="S_T_8")) rep2ct<-pcrbatch(rep2, fluo=NULL) ## Making model for H_C_1 (l4) ## => Fitting passed... ## ## Making model for N_C_1 (l4) ## => Fitting passed... ## ## Making model for S_C_1 (l4) ## => Fitting passed... ## ## Making model for H_T_1 (l4) ## => Fitting passed... ## ## Making model for N_T_1 (l4) ## => Fitting passed... ## ## Making model for S_T_1 (l4) ## => Fitting passed... ## ## Making model for NT_C_1 (l4) ## => Fitting passed... ## ## Making model for H_C_2 (l4) ## => Fitting passed... ## ## Making model for N_C_2 (l4) ## => Fitting passed... ## ## Making model for S_C_2 (l4) ## => Fitting passed... ## ## Making model for H_T_2 (l4) ## => Fitting passed... ## ## Making model for N_T_2 (l4) ## => Fitting passed... ## ## Making model for S_T_2 (l4) ## => Fitting passed... ## ## Making model for NT_C_2 (l4) ## => Fitting passed... ## ## Making model for H_C_3 (l4) ## => Fitting passed... ## ## Making model for N_C_3 (l4) ## => Fitting passed... ## ## Making model for S_C_3 (l4) ## => Fitting passed... ## ## Making model for H_T_3 (l4) ## => Fitting passed... ## ## Making model for N_T_3 (l4) ## => Fitting passed... ## ## Making model for S_T_3 (l4) ## => Fitting passed... ## ## Making model for NT_C_3 (l4) ## => Fitting passed... ## ## Making model for H_C_4 (l4) ## => Fitting passed... ## ## Making model for N_C_4 (l4) ## => Fitting passed... ## ## Making model for S_C_4 (l4) ## => Fitting passed... ## ## Making model for H_T_4 (l4) ## => Fitting passed... ## ## Making model for N_T_4 (l4) ## => Fitting passed... ## ## Making model for S_T_4 (l4) ## => Fitting passed... ## ## Making model for NT_C_4 (l4) ## => Fitting passed... ## ## Making model for H_C_5 (l4) ## => Fitting passed... ## ## Making model for N_C_5 (l4) ## => Fitting passed... ## ## Making model for S_C_5 (l4) ## => Fitting passed... ## ## Making model for H_T_5 (l4) ## => Fitting passed... ## ## Making model for N_T_5 (l4) ## => Fitting passed... ## ## Making model for S_T_5 (l4) ## => Fitting passed... ## ## Making model for H_C_6 (l4) ## => Fitting passed... ## ## Making model for N_C_6 (l4) ## => Fitting passed... ## ## Making model for S_C_6 (l4) ## => Fitting passed... ## ## Making model for H_T_6 (l4) ## => Fitting passed... ## ## Making model for N_T_6 (l4) ## => Fitting passed... ## ## Making model for S_T_6 (l4) ## => Fitting passed... ## ## Making model for H_C_7 (l4) ## => Fitting passed... ## ## Making model for N_C_7 (l4) ## => Fitting passed... ## ## Making model for S_C_7 (l4) ## => Fitting passed... ## ## Making model for H_T_7 (l4) ## => Fitting passed... ## ## Making model for N_T_7 (l4) ## => Fitting passed... ## ## Making model for S_T_7 (l4) ## => Fitting passed... ## ## Making model for H_C_8 (l4) ## => Fitting passed... ## ## Making model for N_C_8 (l4) ## => Fitting passed... ## ## Making model for S_C_8 (l4) ## => Fitting passed... ## ## Making model for H_T_8 (l4) ## => Fitting passed... ## ## Making model for N_T_8 (l4) ## => Fitting passed... ## ## Making model for S_T_8 (l4) ## => Fitting passed... ## ## Calculating delta of first/second derivative maxima... ## .........10.........20.........30.........40.........50 ## .. ## Found univariate outlier for H_T_2 ## Tagging name of H_T_2 ... ## Analyzing H_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_1 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing **H_T_2** ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_2 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_3 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing NT_C_4 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_5 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_6 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_7 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_C_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing H_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing N_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... ## ## Analyzing S_T_8 ... ## Calculating 'eff' and 'ct' from sigmoidal model... ## Using window-of-linearity... ## Fitting exponential model... ## Using linear regression of efficiency (LRE)... rep2res<-setNames(data.frame(t(rep2ct)),rep2ct[,1]) rep2res<-rep2res[-1,] rep2res$Names<-rownames(rep2res)

rep2res2<-cSplit_f(rep2res, splitCols=c("Names"), sep="_", drop = F)

rep2res2<-rename(rep2res2, c("Names_1"="Pop", "Names_2"="Treat", "Names_3"="Sample"))

rep2res2$Gene<-rep("TLR", length(rep2res2)) rep2res2$sig.eff<-as.numeric(as.character(rep2res2$sig.eff)) rep2res2$sig.cpD2<-as.numeric(as.character(rep2res2$sig.cpD2)) ggplot(rep2res2, aes(x=Names,y=sig.cpD2, fill=Pop))+geom_bar(stat="identity") expr<-function(x,y){ newVar<-(1+x)^y 1/newVar } rep2res2$expression<-expr(rep2res2$sig.eff, rep2res2$sig.cpD2)

ggplot(rep2res2, aes(x=Names,y=expression, fill=Pop))+geom_bar(stat="identity")

#Now that I have Ct values, efficiencies and expression values for both replicates I can create a table of the differences between reps.
#To do this I create a data frame with a single formula that creates a column of values generated by subtracting the first run from the second.
repcomp<-as.data.frame(rep1res2$sig.cpD2-rep2res2$sig.cpD2)

#Now I need to add some Names for the samples to use with ggplot.Since the names column contains all the relevant information
#I copy only that column and run the split function on it again as well as the rename function.
repcomp$Names<-rep1res2$Names
repcomp<-cSplit_f(repcomp, splitCols=c("Names"), sep="_", drop = F)

#To better address the difference column in ggplot I need to rename it something simple and short.
repcomp<-rename(repcomp, c("rep1res2$sig.cpD2 - rep2res2$sig.cpD2"="rep.diff", "Names_1"="Pop", "Names_2"="Treat", "Names_3"="Sample"))

#Now I just run the data through ggplot to generate a bar graph exploring the differences between the two replicate in terms of Ct values.
ggplot(repcomp, aes(x=Names, y=rep.diff, fill=Pop))+geom_bar(stat="identity")

tlr<-as.data.frame(cbind(rep1res2$expression,rep1res2$Names,rep1res2$Pop,rep1res2$Treat,rep2res2$expression)) tlr<-rename(tlr, c(V1="rep1.expr","V2"="name","V3"="pop","V4"="treat" ,"V5"="rep2.expr")) tlr$rep1.expr<-as.numeric(as.character(tlr$rep1.expr)) tlr$rep2.expr<-as.numeric(as.character(tlr$rep2.expr)) tlr$avgexpr<-rowMeans(tlr[,c("rep1.expr","rep2.expr")],na.rm=F)

tlr<-tlr[which(tlr$name!=c("H_C_3")),] tlr<-tlr[which(tlr$name!=c("H_T_2")),]

tlr<-tlr[which(tlr$pop!=c("**S")),] tlr<-tlr[which(tlr$pop!=c("**H")),]
tlr<-tlr[which(tlr$pop!=c("**NT")),] tlr<-tlr[which(tlr$pop!=c("NT")),]
tlr<-tlr[which(tlr$pop!=c("*N")),] ggplot(tlr, aes(x=treat,y=avgexpr, fill=pop))+geom_boxplot() fit<-aov(avgexpr~pop+treat+pop:treat,data=tlr) fit ## Call: ## aov(formula = avgexpr ~ pop + treat + pop:treat, data = tlr) ## ## Terms: ## pop treat pop:treat Residuals ## Sum of Squares 1.387959e-24 3.623459e-24 1.087264e-24 1.521966e-23 ## Deg. of Freedom 2 1 2 36 ## ## Residual standard error: 6.502063e-13 ## Estimated effects may be unbalanced TukeyHSD(fit) ## Tukey multiple comparisons of means ## 95% family-wise confidence level ## ## Fit: aov(formula = avgexpr ~ pop + treat + pop:treat, data = tlr) ## ##$pop
##             diff           lwr          upr     p adj
## N-H 1.871523e-13 -4.283799e-13 8.026845e-13 0.7396288
## S-H 4.499808e-13 -1.655514e-13 1.065513e-12 0.1883345
## S-N 2.628285e-13 -3.175009e-13 8.431578e-13 0.5160357
##
## $treat ## diff lwr upr p adj ## T-C -5.895191e-13 -9.983307e-13 -1.807076e-13 0.0059349 ## ##$pop:treat
##                  diff           lwr           upr     p adj
## N:C-H:C  2.035564e-13 -8.088703e-13  1.215983e-12 0.9900053
## S:C-H:C  7.815453e-13 -2.308813e-13  1.793972e-12 0.2116836
## H:T-H:C -3.495711e-13 -1.495001e-12  7.958589e-13 0.9392588
## N:T-H:C -1.437124e-13 -1.189342e-12  9.019174e-13 0.9983185
## S:T-H:C -2.410672e-13 -1.286697e-12  8.045626e-13 0.9815165
## S:C-N:C  5.779889e-13 -4.001082e-13  1.556086e-12 0.4920724
## H:T-N:C -5.531275e-13 -1.668330e-12  5.620748e-13 0.6712284
## N:T-N:C -3.472688e-13 -1.359695e-12  6.651579e-13 0.9039812
## S:T-N:C -4.446237e-13 -1.457050e-12  5.678030e-13 0.7714929
## H:T-S:C -1.131116e-12 -2.246319e-12 -1.591417e-14 0.0451756
## N:T-S:C -9.252577e-13 -1.937684e-12  8.716899e-14 0.0898974
## S:T-S:C -1.022613e-12 -2.035039e-12 -1.018588e-14 0.0465536
## N:T-H:T  2.058587e-13 -9.395713e-13  1.351289e-12 0.9940347
## S:T-H:T  1.085039e-13 -1.036926e-12  1.253934e-12 0.9997234
## S:T-N:T -9.735487e-14 -1.142985e-12  9.482749e-13 0.9997459

The graph represents boxplots generated from the average expression value of both TLR reps. The darkened line in the box represents the median value, the box equals the second and third quartiles, the lines are the 1st and 4th quartiles. Dots are data outliers from the data set. There appears to be a difference between Dabob treated group and the Oyster Bay control, it also appears there is a difference between Oyster Bay control and Oyster Bay treatment group.

The statistics are broken into groups of population ($pop), treatment ($treat), and population by treatment (\$'pop:treat'). The statistics show that the populations are not significantly different from one another, but the treatment/control are. They also show that the Dabob treatment is significantly different than the Oyster Bay control. The Oyster Bay treatment was also significantly different from the Oyster Bay control.