-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrthoFinder_Analysis .Rmd
167 lines (121 loc) · 4.86 KB
/
OrthoFinder_Analysis .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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
title: "Analysis with Orthofinder"
output:
word_document: default
html_document: default
pdf_document: default
---
## Loading packages
```{r}
#if installation is need, uncomment the following
#if (!require("DESeq2")) install.packages("DESeq2"); library(DESeq2)
#if (!require("apeglm")) install.packages("apeglm"); library(apeglm)
#if (!require("ggplot2")) install.packages("ggplot2"); library(ggplot2)
#if (!require("pheatmap")) install.packages("pheatmap"); library(pheatmap)
#if (!require("ggVennDiagram")) install.packages("ggVennDiagram"); library(ggVennDiagram)
library(DESeq2)
library(apeglm)
library(ggplot2)
library(pheatmap)
library(ggVennDiagram)
```
## Loading data
```{r }
data <- read.csv("ortho_count.csv", header=T, row.names = 1)
info <- read.table("orthoRef.txt", header = T, sep ="\t")
```
## Running DESeq and editing data
```{r}
de <- DESeqDataSetFromMatrix(data, info, ~diet)
keep <- rowSums(counts(de)) >= 10
de <- de[keep,]
deSeqData <- DESeq(de)
#export normalized read count
normCounts <- counts(deSeqData, normalized = T)
#write.csv(normCounts, "normal.ortho_count.csv")
#p value less than .05 is d.e.
result <- results(deSeqData, alpha = 0.05)
#summary(res)
# order based on p adjusted value
resOrdered <- result[order(result$padj),]
#write.csv(resOrdered, "deSeq.order.ortho.csv")
```
## Plotting the data
```{r}
normCount <- read.csv("normal.ortho_count.csv", row.names = 1)
sigCounts <- normCount[1:20,]
pheatmap(log2(sigCounts + 1), color=colorRampPalette(c("blue", "white", "pink"))(50),treeheight_row= 0, show_rownames = F, )
```
## Using ggVennDiagram to show overlapping orthogroups
```{r}
#reading in the files
#nerctarivores
ange <- readLines("ange01.csv")
loth<- readLines("loth01.csv")
glso<- readLines("glso01.csv")
#frugivores
arja <- readLines("arja01.csv")
cabr <- readLines("cabr01.csv")
chvi<- readLines("chvi01.csv")
stlu<- readLines("stlu01.csv")
#blood feeding
dero<- readLines("dero01.csv")
#insectivores
mawa<- readLines("mawa01.csv")
mobl<- readLines("mobl01.csv")
ptpa<- readLines("ptpa01.csv")
#piscivore
nole<- readLines("nole01.csv")
# nectarivores vs piscivore
nec_pis <- list(nec1 = ange, nec2= glso, pis = nole )
ggVennDiagram(nec_pis[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# nectarivores vs frugivore
nec_fru <- list(nec1 = ange, nec2= glso, fru = arja )
ggVennDiagram(nec_fru[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# nectarivores vs insectivore
nec_ins <- list(nec1 = ange, nec2= glso, ins = ptpa )
ggVennDiagram(nec_ins[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivores vs piscivore
fru_pis <- list(fru1 = arja, fru2= stlu, pis = nole )
ggVennDiagram(fru_pis[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivores vs nectarivore
fru_nec <- list(fru1 = arja, fru2= stlu, nec = loth )
ggVennDiagram(fru_nec[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivores vs insectivore
fru_ins <- list(fru1 = arja, fru2= stlu, ins = ptpa )
ggVennDiagram(fru_ins[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
```
```{r}
# frugivore vs nectarivore vs piscivore
fru_pis_nec <- list(fru = arja, nec = loth, pis= nole )
ggVennDiagram(fru_pis_nec[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivore vs blood feeding vs piscivore
fru_pis_blo <- list(fru = arja, blo = dero, pis= nole )
ggVennDiagram(fru_pis_blo[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivore vs insectivore vs piscivore
fru_ins_blo <- list(fru = arja, blo = dero, ins = ptpa)
ggVennDiagram(fru_ins_blo[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
# frugivore vs nectarivore vs blood feeding
fru_blo_nec <- list(fru = arja, nec = loth, blo= dero )
ggVennDiagram(fru_blo_nec[1:4],label_alpha = 0, stroke_size = 0.1) +
ggplot2::scale_fill_gradient(low="white",high = "purple") +
theme(text = element_text(size=10, family="Comic Sans MS"))
```