-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlowAnalysis
89 lines (65 loc) · 3.97 KB
/
FlowAnalysis
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
Flowdata <- read.csv(file="/mnt/research/ShadeLab/Chodkowski/JGI_SynCom/SynCom_Paper_MassSpec/SynCom_FlowFinal.csv", header=TRUE, sep=",")
#Keep columns of interest
flowData <- Flowdata[,c(1,5:9)]
#Average tech reps within a time point
library(dplyr)
detach("package:plyr", unload=TRUE)
groupedFlowData <- flowData %>% group_by(Species,Biorep,TimePoint,Membership)
#Get mean and std
groupedAvgCounts.live <- summarise(groupedFlowData, mean=mean(Live.CFU.mL))
groupedAvgCounts.dead <- summarise(groupedFlowData, mean=mean(Dead.Population))
groupedAvgCounts.live$viability <- "Live"
groupedAvgCounts.dead$viability <- "Dead"
groupedAvgCounts <- rbind(groupedAvgCounts.live,groupedAvgCounts.dead)
library(ggplot2)
#B. thailandensis plots
groupedAvgCounts.Bt <- groupedAvgCounts[groupedAvgCounts$Species=="B. thailandensis",]
groupedAvgCounts.Bt$Membership <- factor(groupedAvgCounts.Bt$Membership,levels = c("Bt","BtPs","BtCs","BtCsPs"),ordered = TRUE)
g=ggplot(groupedAvgCounts.Bt, aes(x=as.factor(TimePoint), y=log10(mean),fill=viability))+
geom_boxplot()+
theme_bw(base_size=10)+
scale_fill_manual(values = c("lightblue","green")) +
theme(axis.title = element_text(size = 12),axis.text = element_text(size = 10),strip.text.x = element_text(size = 10))+
facet_wrap(Membership ~ ., nrow = 2)
flowPlot <- g + ylim(c(5,10)) + xlab("Time (h)") + ylab("Log10 cells/mL") +
theme(legend.title = element_text(size = 12),legend.text = element_text(size = 10),legend.position = "bottom") +
labs(fill = "Viability assessment") + guides(fill = guide_legend(reverse = TRUE)) +
annotation_logticks(sides = "l")
ggsave("SynComCellCounts.Bt.eps",plot= flowPlot,device="eps",width=6,height=8,units="in",dpi=300)
Bt.Summary <- groupedAvgCounts.Bt %>%
group_by(Membership,TimePoint,viability) %>%
summarise(mean = mean(mean))
#C. violaceum plots
groupedAvgCounts.Cv <- groupedAvgCounts[groupedAvgCounts$Species=="C. violaceum",]
groupedAvgCounts.Cv$Membership <- factor(groupedAvgCounts.Cv$Membership,levels = c("Cs","CsPs","CsBt","CsPsBt"),ordered = TRUE)
g=ggplot(groupedAvgCounts.Cv, aes(x=as.factor(TimePoint), y=log10(mean),fill=viability))+
geom_boxplot()+
theme_bw(base_size=10)+
scale_fill_manual(values = c("lightblue","green")) +
theme(axis.title = element_text(size = 12),axis.text = element_text(size = 10),strip.text.x = element_text(size = 10))+
facet_wrap(Membership ~ ., nrow = 2)
flowPlot <- g + ylim(c(5,10)) + xlab("Time (h)") + ylab("Log10 cells/mL") +
theme(legend.title = element_text(size = 12),legend.text = element_text(size = 10),legend.position = "bottom") +
labs(fill = "Viability assessment") + guides(fill = guide_legend(reverse = TRUE)) +
annotation_logticks(sides = "l")
ggsave("SynComCellCounts.Cv.eps",plot= flowPlot,device="eps",width=6,height=8,units="in",dpi=300)
Cv.Summary <- groupedAvgCounts.Cv %>%
group_by(Membership,TimePoint,viability) %>%
summarise(mean = mean(mean))
#P. syringae plots
groupedAvgCounts.Ps <- groupedAvgCounts[groupedAvgCounts$Species=="P. syringae",]
groupedAvgCounts.Ps$Membership <- factor(groupedAvgCounts.Ps$Membership,levels = c("Ps","PsCs","PsBt","PsBtCs"),ordered = TRUE)
g=ggplot(groupedAvgCounts.Ps, aes(x=as.factor(TimePoint), y=log10(mean),fill=viability))+
geom_boxplot()+
theme_bw(base_size=10)+
scale_fill_manual(values = c("lightblue","green")) +
theme(axis.title = element_text(size = 12),axis.text = element_text(size = 10),strip.text.x = element_text(size = 10))+
facet_wrap(Membership ~ ., nrow = 2)
flowPlot <- g + ylim(c(5,10)) + xlab("Time (h)") + ylab("Log10 cells/mL") +
theme(legend.title = element_text(size = 12),legend.text = element_text(size = 10),legend.position = "bottom") +
labs(fill = "Viability assessment") + guides(fill = guide_legend(reverse = TRUE)) +
annotation_logticks(sides = "l")
ggsave("SynComCellCounts.Ps.eps",plot= flowPlot,device="eps",width=6,height=8,units="in",dpi=300)
Ps.Summary <- groupedAvgCounts.Ps %>%
group_by(Membership,TimePoint,viability) %>%
summarise(mean = mean(mean))