-
Notifications
You must be signed in to change notification settings - Fork 10
/
Fig.S13.Edward2018.Rmd
114 lines (88 loc) · 2.53 KB
/
Fig.S13.Edward2018.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: "Untitled"
author: "Cheng Gao"
date: "9/10/2018"
output: html_document
---
```{r, message=FALSE, warning=FALSE}
setwd("/Users/chengg/Google Drive/Soft tutotials/R/Edward 2018")
library(dplyr)
library(tidyverse)
library(betapart)
library(vegan)
library(colorRamps)
#### 2014 ###
Y45 <- readRDS("cal_ark_data.rds")
Y45a<-Y45[,c(1:11, 13,15)]
#levels(factor(Y2a$variable))
#tax$Timepoint
Y45spr <- Y45a %>%
spread(variable, value)
Y14<-Y45spr[Y45spr$Site=="Arbuckle" &Y45spr$Compartment=="Endosphere" & Y45spr$Season =="2014" ,]
#gap_medium$Genotype
env<-Y14[, 1:11]
com<-Y14[, -1:-11]
com[com>0]=1
fd<-beta.pair(com, index.family = "jaccard")
jtu<-fd$beta.jtu
bd<-betadisper(jtu,factor(env$Age))
print (anova(bd));
boxplot(bd)
plot(bd, col=blue2red(19),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(19), main="", xlab="PC1", ylab="PC2")
jac<-fd$beta.jac
bd<-betadisper(jac,factor(env$Age))
print (anova(bd));
boxplot(bd)
plot(bd, col=blue2red(19),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(19), main="", xlab="PC1", ylab="PC2")
#### 2015 ###
Y15<-Y45spr[Y45spr$Site=="Arbuckle" & Y45spr$Compartment=="Endosphere" & Y45spr$Season =="2015" & Y45spr$Age >4 ,]
env<-Y15[, 1:11]
com<-Y15[, -1:-11]
com[com>0]=1
fd<-beta.pair(com, index.family = "jaccard")
jtu<-fd$beta.jtu
bd<-betadisper(jtu,factor(env$Age))
print (anova(bd));
boxplot(bd)
plot(bd, col=blue2red(17),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(17), main="", xlab="PC1", ylab="PC2")
jac<-fd$beta.jac
bd<-betadisper(jac,factor(env$Age))
print (anova(bd));
boxplot(bd)
plot(bd, col=blue2red(19),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(19), main="", xlab="PC1", ylab="PC2")
#### 2016 #
Y16 <- readRDS("cal_2016.rds")
Y16 <-Y16[,c(1:10, 13,14)]
#head(tax[1:5, 1:15])
#levels(factor(tax$value))
#tax$Timepoint
Y16 <- Y16 %>%
spread(variable, value)
Y16<-Y16[Y16$Compartment=="Endosphere" ,]
#gap_medium$Genotype
env<-Y16[, 1:10]
com<-Y16[, -1:-10]
com[com>0]=1
fd<-beta.pair(com, index.family = "jaccard")
jtu<-fd$beta.jtu
bd<-betadisper(jtu,factor(env$Timepoint))
print (anova(bd));
boxplot(bd)
plot(bd, col=blue2red(9),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(9), main="", xlab="PC1", ylab="PC2")
jac<-fd$beta.jac
bd<-betadisper(jac,factor(env$Timepoint))
print (anova(bd)); #print(adonis(fung.dist~envx$Timepoint))
plot(bd, col=blue2red(9),
hull = FALSE,cex = 0.8,label.cex = 0.8,
seg.col=blue2red(9), main="", xlab="PC1", ylab="PC2")
```