Notebook summary

This notebook summarizes the joint distribution of antibody responses in each cohort. The first section creates main text Figure 2, which summarizes comparisons between different antigens for the same pathogen plus a comparison between ETEC and cholera, where the toxin B subunit is known to elicit cross-reactivity. Each scatter plot also includes the spearman’s rank correlation coefficient (\(\rho\)). After creating Figure 2, the notebook creates supplemental figures that include pairs plots for the joint distribution of every combination of enteric antibody responses in each cohort.

Script preamble

## here() starts at /Users/benarnold/enterics-seroepi
## [1] "/Users/benarnold/enterics-seroepi"
## ── Attaching packages ────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.1       ✔ purrr   0.3.2  
## ✔ tibble  2.1.1       ✔ dplyr   0.8.0.1
## ✔ tidyr   0.8.3       ✔ stringr 1.4.0  
## ✔ readr   1.1.1       ✔ forcats 0.3.0
## ── Conflicts ───────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## 
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
## 
##     discard
## The following object is masked from 'package:readr':
## 
##     col_factor
## Loading required package: viridisLite
## 
## Attaching package: 'viridis'
## The following object is masked from 'package:scales':
## 
##     viridis_pal
## 
## Attaching package: 'ellipse'
## The following object is masked from 'package:graphics':
## 
##     pairs
## 
## Attaching package: 'foreach'
## The following objects are masked from 'package:purrr':
## 
##     accumulate, when
## Loading required package: iterators
## Loading required package: parallel

Load and format data

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector

## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
#--------------------------------
# create antigen groupings for
# comparisons
# drop obs not contributing
#--------------------------------
d <- dall %>%
  mutate(comp= ifelse(antigen %in% c("vsp3","vsp5"),"Giardia",NA),
         comp= ifelse(antigen %in% c("cp17","cp23"),"Cryptosporidium",comp),
         comp= ifelse(antigen %in% c("p18","p39"),"Campylobacter",comp),
         comp= ifelse(antigen %in% c("sald","salb"),"Salmonella",comp),
         comp= ifelse(antigen %in% c("cholera","etec"),"ETEC\nV. cholerae",comp),
         comp= ifelse(antigen %in% c("norogi","norogii"),"Norovirus",comp),
         comp= ifelse(country=="Haiti" & antigen =="etec",NA,comp),
         comp= factor(comp,levels=c("Giardia","Cryptosporidium","Campylobacter","Salmonella","ETEC\nV. cholerae","Norovirus"))
         ) %>% 
  mutate(xlab=ifelse(antigen %in% c("vsp3","vsp5"),"VSP-3",NA),
         ylab=ifelse(antigen %in% c("vsp3","vsp5"),"VSP-5",NA),
         xlab=ifelse(antigen %in% c("cp17","cp23"),"Cp17",xlab),
         ylab=ifelse(antigen %in% c("cp17","cp23"),"Cp23",ylab),
         xlab=ifelse(antigen %in% c("p18","p39"),"p18",xlab),
         ylab=ifelse(antigen %in% c("p18","p39"),"p39",ylab),
         xlab=ifelse(antigen %in% c("salb","sald"),"LPS Group B",xlab),
         ylab=ifelse(antigen %in% c("salb","sald"),"LPS Group D",ylab),
         xlab=ifelse(antigen %in% c("cholera","etec"),"Cholera toxin B subunit",xlab),
         ylab=ifelse(antigen %in% c("cholera","etec"),"ETEC LT B subunit",ylab),
         xlab=ifelse(antigen %in% c("norogi","norogii"),"GII.4.NO",xlab),
         ylab=ifelse(antigen %in% c("norogi","norogii"),"GI.4",ylab)
         ) %>%
  filter(!is.na(comp))

#--------------------------------
# for antigen each pair, 
# label it as "x" or "y" to 
# spread it to wide format
#--------------------------------
dw <- d %>%
  mutate(xy=ifelse(antigen %in% c("vsp3","cp17","sald","p18","cholera","norogii"),"x","y")) %>%
  select(country,comp,xlab,ylab,id,sid,xy,logmfi) %>%
  spread(xy,logmfi) %>%
  mutate(country=factor(country,levels=c("Haiti","Kenya","Tanzania")))

Individual country pairs plots

The above figure was created as a synthesis across individual country pairs plots. Below, the script creates each pairs plot that shows the joint relationship between every combination of antigens in each cohort.

Session Info

## R version 3.5.3 (2019-03-11)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.6
## 
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] doParallel_1.0.11  iterators_1.0.9    foreach_1.4.4     
##  [4] RColorBrewer_1.1-2 ellipse_0.4.1      viridis_0.5.1     
##  [7] viridisLite_0.3.0  scales_1.0.0       forcats_0.3.0     
## [10] stringr_1.4.0      dplyr_0.8.0.1      purrr_0.3.2       
## [13] readr_1.1.1        tidyr_0.8.3        tibble_2.1.1      
## [16] ggplot2_3.1.1      tidyverse_1.2.1    here_0.1          
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_0.2.5 xfun_0.6         reshape2_1.4.3   haven_2.1.0     
##  [5] lattice_0.20-38  colorspace_1.3-2 htmltools_0.3.6  yaml_2.2.0      
##  [9] rlang_0.3.4      pillar_1.4.0     foreign_0.8-71   glue_1.3.1      
## [13] withr_2.1.2      modelr_0.1.2     readxl_1.1.0     plyr_1.8.4      
## [17] munsell_0.5.0    gtable_0.3.0     cellranger_1.1.0 rvest_0.3.2     
## [21] codetools_0.2-16 psych_1.8.4      evaluate_0.13    knitr_1.22      
## [25] broom_0.4.4      Rcpp_1.0.1       backports_1.1.4  jsonlite_1.6    
## [29] gridExtra_2.3    mnormt_1.5-5     hms_0.4.2        digest_0.6.18   
## [33] stringi_1.4.3    grid_3.5.3       rprojroot_1.3-2  cli_1.1.0       
## [37] tools_3.5.3      magrittr_1.5     lazyeval_0.2.2   crayon_1.3.4    
## [41] pkgconfig_2.0.2  xml2_1.2.0       lubridate_1.7.4  assertthat_0.2.1
## [45] rmarkdown_1.12   httr_1.4.0       rstudioapi_0.9.0 R6_2.4.0        
## [49] nlme_3.1-137     compiler_3.5.3