Adaptomics_CarbonIsotopeAnalysis_InitialResults

Lovell — Jun 5, 2014, 3:53 PM

library(ggplot2)
library(GGally)
rm(list=ls())
############
#Part I: Processing and organization of data
#1.1: Read in the data
setwd("~/Desktop/Adaptomics_Project/Drydown_Analysis")
rawD13<-read.csv("mr2014_d13Craw_edit1.csv", header=T, na.strings="#VALUE!")
rawD13<-rawD13[1:526,]
dd_info<-read.csv("Drydown1-2_ConsolidatedWeights_December13.csv", header=T, na.strings="#VALUE!")

#1.2: Combine relevant information
#spatifolia is in the 1st 192 rows
spatD13<-rawD13[1:192,]
head(spatD13)
     Tray_Name Well_Id Sample_ID   d13C C_Amount_.ug. sample_wt X
1 spatifolia_1      A1       147 -32.46         585.7      1760  
2 spatifolia_1      A2        18 -32.99         762.4      2083  
3 spatifolia_1      A3       148 -33.04         736.2      1932  
4 spatifolia_1      A4        81 -32.29         501.6      1719  
5 spatifolia_1      A5       115 -32.65         690.5      2020  
6 spatifolia_1      A6        51 -33.03         703.5      1945  
info<-dd_info[1:257,c(8,2:4,1)]
names(info)[5]<-"Sample_ID"
head(info)
     Genotype Position Treatment Flat Sample_ID
1 Tiesiding#2        1       Dry    3       105
2   Cripple#6        2       Dry    3        43
3   Cripple#6        3       Dry    3        44
4     Royal#1        4       Dry    3        12
5   Cripple#7        5       Dry    3        26
6 Tiesiding#7        6       Dry    3       124
alldata<-merge(info,spatD13,by="Sample_ID")
alldata<-alldata[,-11]
head(alldata)
  Sample_ID    Genotype Position Treatment Flat    Tray_Name Well_Id
1         1     Royal#1       18       Wet    1 spatifolia_1      B3
2        10     Royal#1       20       Dry    3 spatifolia_1     G11
3       100 Tiesiding#2       28       Wet    1 spatifolia_1     B12
4       101 Tiesiding#2       19       Wet    2 spatifolia_1      D5
5       102 Tiesiding#2       25       Wet    2 spatifolia_1     D10
6       104 Tiesiding#2       29       Wet    2 spatifolia_1      E1
    d13C C_Amount_.ug. sample_wt
1 -32.45         847.8      2184
2 -30.73         828.1      2067
3 -33.19         736.2      1809
4 -32.90         723.1      1815
5 -33.02         729.7      1830
6 -31.98         631.2      1581
#1.3 Process info, bring apomixis location etc. info into the fold
genotype_info<-alldata$Genotype
ids<-as.data.frame(do.call(rbind, strsplit(as.character(genotype_info),"#")))
colnames(ids)<-c("population","genotype")
test<-cbind(ids,alldata[,-2])
apodata<-data.frame(c("Alvarado", "Alvarado","Chicago","Chicago","Chiquito" ,"Chiquito" ,"Cripple","Cripple" ,"Rosita","Rosita","Royal","Royal","Tiesiding","Tiesiding"),
                    c(2,3,2,4,4,7,6,7,3,4,1,2,2,7),c("apo","sex",'sex',"apo","apo","sex","sex","apo","sex","apo","apo","sex","sex","apo"))
names(apodata)<-c("population","genotype","mating_system")
all<-merge(test,apodata,by=c("population","genotype"),all.x=T,all.y=T)
ggpairs(all[,c(9,10,5)], color="Treatment",alpha=0.4)

plot of chunk unnamed-chunk-1

aov1<-aov(d13C~population*Treatment*mating_system, data=all)
summary(aov1)
                                    Df Sum Sq Mean Sq F value  Pr(>F)    
population                           6   43.7     7.3   22.17 < 2e-16 ***
Treatment                            1   50.1    50.1  152.53 < 2e-16 ***
mating_system                        1    0.1     0.1    0.28    0.60    
population:Treatment                 6   14.7     2.4    7.43 5.2e-07 ***
population:mating_system             6   21.5     3.6   10.92 3.9e-10 ***
Treatment:mating_system              1    0.0     0.0    0.09    0.77    
population:Treatment:mating_system   6    1.6     0.3    0.79    0.58    
Residuals                          156   51.3     0.3                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(all,aes(x=Treatment,y=d13C,col=mating_system, group=mating_system))+
  geom_point()+
  facet_wrap(~population)

plot of chunk unnamed-chunk-1