-
Notifications
You must be signed in to change notification settings - Fork 1
/
Campy_HGT_report.Rmd
188 lines (129 loc) · 5.67 KB
/
Campy_HGT_report.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
title: "Campy HGT"
author: "Julian Trachsel"
date: "12/02/2020"
output:
html_document:
toc: true
toc_depth: 3
---
```{r setup, include=FALSE}
library(knitr)
library(kableExtra)
library(ggrepel)
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(warning = FALSE)
knitr::opts_chunk$set(message = FALSE)
source("./scripts/01_setup.R", local = knitr::knit_global())
source("./scripts/03_HGT_ID.R", local = knitr::knit_global())
RESULTS[[1]] %>%
select(c(1,6, 12, 16, 19, 20, 26))
```
## Overview
### Terms
- Parental: The genomes which took part in the mating experiments
- Donor: The genome which was the source of the transferred AMR phenotype
- Recipient: The genome which the AMR phenotype was transferred into
- Result: The genome resulting from the mating of Donor and Recipient genomes
I am using a pangenome approach to identify genes that were transferred from the donor-genome to the recipient-genome making the result-genome. This means a pan genome is calculated for each mating experiment, and each of the calculated pangenomes contains exactly three genomes. Roary is used for calculating these pangenomes. For this analysis I increased the stringency for assigning coding sequences to a gene, all sequences assigned to a gene must be 99% identical (up from the standard 95%).
Transferred genes are those that are present in the donor and result genomes but not the recipient genome.
Another (potentially related) event is the deletion of genes. Genes that are present in the recipient genome but not the result genome are identified as deleted.
Sometimes transferred genes are grouped into consecutive strings of genes. These consecutive strings of transferred genes are referred to as 'genomic islands'. Below a table of transferred genomic islands will be presented for each mating experiment, but keep in mind for the purposes of this report I have allowed genomic islands that consist of only 1 gene.
First we verify donor/recipient relationships between parental and result genomes.
This is accomplished by calculating the alignment based average nucleotide identity for all pairwise combinations of genomes. In each mating experiment the parental genome with the greatest average nucleotide identity to the result genome is assigned as the recipient, the other genome is assigned as the donor.
### MDS plot
Visualizing pairwise ANI.
```{r, echo=FALSE, fig.width=10}
# ani_tab <-
# read_tsv('./outputs/pyani_res/ANIm_percentage_identity.tab') %>%
# pivot_longer(cols = -X1, names_to='genome', values_to='ANI') %>%
# mutate(ani_dist=1-ANI) %>%
# select(-ANI)
#
#
# ani_dist <- ani_tab %>%
# pivot_wider(names_from = genome, values_from=ani_dist) %>%
# column_to_rownames(var='X1') %>%
# as.dist()
#
#
ani_mds %>% ggplot(aes(x=V1, y=V2)) +
geom_point()+
geom_text_repel(aes(label=genome), max.overlaps = 1000) +
labs(x='MDS1', y='MDS2') +
ggtitle('MDS showing genome similarity, based on ANI')
```
### Mating experiment table
This table lays out the mating experiments as they have been analysed below.
```{r pressure, echo=FALSE}
read_tsv('./outputs/01_metadata.tsv') %>%
select(experiment, donor_genome, recipient_genome, result_genome, -pan_dir) %>%
kable() %>%
kable_styling(bootstrap_options = 'striped')
```
## Results
Reporting results separately for each mating experiment.
For each experiment there will be the following items:
1. Table of 'genomic islands' (XXX_Results.tsv)
2. Table of transferred genes (XXX_transferred.tsv)
3. Table of deleted genes (XXX_deleted.tsv)
4. plot showing where genomic islands are found in the donor and result genomes.
The tables in this report only contain a subset of the columns for viewing ease.
```{r ,fig.width=9,echo=FALSE,message=FALSE,results="asis"}
for (result_genome in metadata$result_genome){
i <- which(metadata$result_genome == result_genome)
exper <- metadata$experiment[i]
don <- metadata$donor_genome[i]
rec <- metadata$recipient_genome[i]
resu <- metadata$result_genome[i]
exp_name <- paste(exper,':', don, '+', rec, '=', resu )
cat(" \n###", exp_name, "\n")
RESULTS[[result_genome]] %>%
select(c(1,6, 12, 16, 19, 20, 26)) %>%
kable(caption = 'Transferred genomic islands') %>%
kable_styling(bootstrap_options = 'striped') %>% print()
plot_islands(RESULTS[[result_genome]], clust_level = quat_cluster) %>% print()
TRANSFERRED[[result_genome]] %>%
select(Gene, all_Qclusters, Annotation, 22:24) %>%
kable(caption = 'Transferred Genes') %>%
kable_styling(bootstrap_options = 'striped') %>% print()
DELETED[[result_genome]] %>%
select(Gene, all_Qclusters, Annotation, 22:24) %>%
kable(caption = 'Deleted Genes') %>%
kable_styling(bootstrap_options = 'striped') %>% print()
cat(" END", exp_name, " \n")
cat(" \n*****
<br/>
<br/>
<br/>
\n")
}
#
# for(i in 1:length(exp_names)) {
#
# cat(" \n###", exp_names[i], "\n")
# RESULTS[[i]] %>% select(c(1,6, 12, 17, 18, 19, 24)) %>%
# kable(caption = 'Transferred genomic islands') %>%
# kable_styling(bootstrap_options = 'striped') %>% print()
#
# plot_islands(RESULTS[[i]], clust_level = quat_cluster) %>% print()
#
# TRANSFERRED[[i]] %>%
# select(Gene, all_Qclusters, Annotation, 22:24) %>%
# kable(caption = 'Transferred Genes') %>%
# kable_styling(bootstrap_options = 'striped') %>% print()
#
# DELETED[[i]] %>%
# select(Gene, all_Qclusters, Annotation, 22:24) %>%
# kable(caption = 'Deleted Genes') %>%
# kable_styling(bootstrap_options = 'striped') %>% print()
#
# # browser()
# cat(" \n*****
#
# <br/>
# <br/>
# <br/>
# \n")
# }
```