Skip to content

Commit 8598443

Browse files
author
Liam Shaw
committed
included Figure 1, updated text
1 parent b716638 commit 8598443

10 files changed

+116
-317
lines changed

Pathogen-host-range.Rmd

+28-6
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ bacteria.df$vector.borne <- bacteria.unique[bacteria.names, "VectorBorne"]
265265

266266
## Figure 1
267267

268+
![](figures/Figure-1-schematic-overview.png)
269+
270+
268271
This is the schematic overview figure, and was made manually in Inkscape using images from FlatIcon (see references in main manuscript).
269272

270273
## Figure 2
@@ -338,6 +341,11 @@ p.histogram.figure.2
338341
dev.off()
339342
```
340343

344+
345+
### Subsampling to non-human hosts
346+
347+
To examine whether sampling bias could be influencing this result, we look at the effect of subsampling to only non-human hosts (both domestic and non-domestic).
348+
341349
```{r Figure_PHB_histogram_subsample_function, cache=cachedata}
342350
options(warn=-1) # Turn off warnings
343351
# Function to plot PHB histogram for a given dataset
@@ -396,7 +404,6 @@ plotHistogram <- function(association_dataset, cophenetic_distances){
396404
```
397405

398406

399-
### Subsampling to non-human hosts
400407
```{r Figure_PHB_domestic, cache=cachedata}
401408
options(warn=-1) # Turn off warnings
402409
pathogen_vs_host_db_domestic <- pathogen_vs_host_db[which(pathogen_vs_host_db$Domestic=="Yes" & pathogen_vs_host_db$HostSpeciesPHB!="Homosapiens"),]
@@ -419,7 +426,7 @@ cowplot::plot_grid(p.PHB.domestic+ggtitle("Domestic (n=2,270)"), p.PHB.nondomest
419426

420427
## Figure 3
421428

422-
We want to produce an analagous version of Figure 1 from Olival et al. (2017) with our data.
429+
We produce an analagous version of Figure 1 from Olival et al. (2017) based on our dataset. Ordering of mammal orders is the same to allow easy comparison with their viral figure.
423430

424431
```{r viral_richness_per_host_order, cache=cachedata}
425432
options(warn=-1) # Turn off warnings
@@ -543,7 +550,7 @@ cor.test(mammal.bacterial.viral.richness$nBacteria, mammal.bacterial.viral.richn
543550

544551
## Figure 4
545552

546-
First we do GAMs for host traits which predict viral and bacterial richness.
553+
We fit generalized additive models (GAMs) for host traits which predict viral and bacterial richness. To do this we use a dataset of host traits collected by Olival et al. to predict pathogen richness (bacterial and viral) per species. These host traits included a phylogenetic eigenvector regression (PVR) of body mass. As Olival et al. collected information for an analysis of only viral pathogens, we found there was better overlap for viruses in our dataset (n=613 host wild mammals) than for bacteria (n=274).
547554

548555
```{r GAMs, cache=cachedata, message=FALSE}
549556
options(warn=-1) # Turn off warnings
@@ -554,7 +561,7 @@ allplots
554561

555562
## Figure 5
556563

557-
Then GAMs for predicting zoonotic potential.
564+
We also fit GAMs to predict zoonotic potential. For bacteria, GAMs could include terms for host range (PHB_mean, PHB_median, or PHB_max), research effort (NCBI PubMed, Nucleotide, or SRA results), motility, sporulation, being vector-borne, oxygen requirements, and Gram stain. We excluded cellular lifestyle (intra/extracellular) as a predictor due to low numbers, and excluded pathogens of unknown motility (n=50) or sporulation (n=17). For viruses, GAMs could include terms for host range, research effort, genome size (number of proteins and length), being vector-borne, and genome type (Baltimore classification). We excluded pathogens with unknown genome size (n=253). We observed structure in some partial effect residuals in the best-fit GAMs: research effort for bacteria (Figure 6b) and host range for viruses (Figure 6d). This structure was driven by pathogen taxonomy, with families (orders) for bacteria (viruses) having different zoonotic potential; e.g. the Staphylococcaceae contain a high proportion of generalists. Attempts to include taxonomy as a categorical predictor produced best fit models which excluded all lifestyle factors (not shown), although host range and research effort were still the strongest predictors.
558565

559566
```{r GAMs-zoonotic-potential, cache=cachedata, message=FALSE}
560567
detachAllPackages <- function() {
@@ -608,7 +615,16 @@ allplots
608615

609616
## Figure 6
610617

611-
We make a plot of the host switching for bacteria and viruses together (left panel of figure). We restrict
618+
We make a plot of the host switching for bacteria and viruses together (left panel of figure).
619+
620+
If we denote the set of pathogens seen at least once in a host taxon a as p_a (where the taxon could be a species, genus, family etc.), we define the fraction of shared pathogens between two taxa a and b as
621+
622+
```{latex}
623+
s_(a,b) = \frac{| p_{a} \union p_b |}{p_{a} \intersection p_{b}}
624+
```
625+
626+
Note that this definition is symmetric in a, b. It can therefore be compared with the (mean) phylogenetic distance between taxa using a Mantel test to determine the correlation.
627+
612628

613629
```{r Figure_distance_shared_pathogens_scatter, cache=cachedata}
614630
hostShiftingResultsOrder <- function(type="Bacteria", min.rep=0){
@@ -1082,6 +1098,7 @@ dev.off()
10821098
How do genome GC content and size vary in specialist vs. generalist pathogens?
10831099

10841100
```{r Figure_genome_GC_size_specialist_generalist, cache=cachedata}
1101+
options(warn=-1)
10851102
bacteria.unique <- pathogen_vs_host_db[which(pathogen_vs_host_db$Type=="Bacteria" & !duplicated(pathogen_vs_host_db$Species)),]
10861103
rownames(bacteria.unique) <- bacteria.unique$Species
10871104
bacteria.unique$PHB <- sapply(bacteria.unique$Species, function(x) PHB(x, m=pathogen_vs_host_db))
@@ -1412,7 +1429,12 @@ kable(table(unique_pathogens$generalist.narrow.broad, unique_pathogens$Type))
14121429

14131430
## Table 3
14141431

1415-
This is a summary of the best-fit GAMs (see `intermediates/*rds') for host traits which predict viral/bacterial richness (Figure 4) and pathogen traits which predict zoonotic potential (Figure 5).
1432+
This is a summary of the best-fit GAMs (see `intermediates/*rds') for host traits which predict viral/bacterial richness (Figure 4) and pathogen traits which predict zoonotic potential (Figure 5). This table was manually edited and prettified in Excel but contains all the same information as in the manuscript.
1433+
1434+
```{r GAM_tables, cache=cachedata}
1435+
options(warn=-1)
1436+
source('scripts/08-tables-GAMs.R')
1437+
```
14161438

14171439

14181440
## Supplementary Table 1

Pathogen-host-range.html

+65-10
Large diffs are not rendered by default.

data/phylopic-sources.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
A list of the PhyloPic IDs of all silhouettes used:
2+
3+
3.7 MB
Loading

scripts/04-fit-GAMs-host-traits.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ library(ggplot2)
2121
library(viridis)
2222
library(knitr)
2323
library(svglite)
24-
source('scripts/Olival_fit_gam.R')
24+
source('scripts/Olival-functions.R')
2525

2626
olival.db <- readRDS("data/Olival-et-al-database.rds")
2727
hosts <- olival.db$hosts

scripts/05-plot-GAMs-host-traits.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library(svglite)
2525
library(mgcv)
2626
library(magrittr)
2727
set.seed(0)
28-
source('scripts/Olival_fit_gam.R')
28+
source('scripts/Olival-functions.R')
2929

3030
SHOW_DEV_EXPL = FALSE
3131

scripts/06-fit-GAM-viral-zoonotic-potential.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1616

1717
# Make ideal data frames for predicting zoonotic potential
18-
source('scripts/Olival_fit_gam.R')
18+
source('scripts/Olival-functions.R')
1919

2020
# Read in viral zoonotic potential dataset
2121
# N.B. Generated from pathogen_vs_host_db association dataset, with additional

scripts/07-fit-GAM-bacterial-zoonotic-potential.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1616

1717
# Make ideal data frames for predicting zoonotic potential
18-
source('scripts/Olival_fit_gam.R')
18+
source('scripts/Olival-functions.R')
1919

2020
# Read in viral zoonotic potential dataset
2121
# N.B. Generated from pathogen_vs_host_db association dataset, with additional

scripts/08-tables-GAMs.R

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
# This code was originally written by Olival et al. (2017)
2+
# and was adapted (lightly) by Liam Shaw 2019 (liam.philip.shaw at gmail dot com)
3+
# for this project.
4+
5+
# See: https://zenodo.org/record/807517 for the original code repository this code was sourced from
6+
7+
# This file is based on: scripts/11-make-ExtendedTable01-models.R
8+
# from that repository
9+
10+
# I am grateful to Olival et al. for making their original code available under an MIT License, which also applies here.
11+
# https://opensource.org/licenses/MIT
12+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
116
library(mgcv)
217
library(stringi)
318
library(dplyr)
419
library(purrr)
520
library(officer)
6-
source('scripts/Olival_fit_gam.R')
21+
source('scripts/Olival-functions.R')
722

823
top_models <- lapply(c("intermediates/all_bacteria_models.rds", "intermediates//all_viruses_models.rds", "intermediates/zoonotic-GAM-fits-bacteria.rds", "intermediates/zoonotic-GAM-fits-virus.rds"), function(mods) {
924
readRDS(mods)$model[[1]]

0 commit comments

Comments
 (0)