Fig S3A,B and D are images.
Setup packages and plotting for the notebook:
# Check packages
source("../../../tools/package_setup.R")
# Load packages
library(tidyverse)
library(cowplot)
library(kableExtra)
library(broom)
library(modelr)
# Code display options
knitr::opts_chunk$set(tidy.opts=list(width.cutoff=60),tidy=FALSE, echo = TRUE, message=FALSE, warning=FALSE, fig.align="center", fig.retina = 2)
# Load plotting tools
source("../../../tools/plotting_tools.R")
#Modify the plot theme
theme_set(theme_notebook())
Let’s read in the data and make the plot:
pRdata <- read_csv('../../../../data/Spectroscopy/TOTO_DAPI_extracts.csv') %>% rename(TOTO=`1uM_TOTO_avg_(535nm)`,DAPI=`1uM_DAPI_avg_(445nm)`) %>%
gather(key='dye',value='fluor',TOTO, DAPI) %>%
separate(X1,sep=' ',c('added','Treatment','Replicate')) %>%
mutate(id=paste(added,Treatment,dye,sep = " ")) %>%
group_by(id) %>%
mutate(mean = ifelse(Replicate=='1',mean(fluor),NA))
# Plot layout
toto_plot <- ggplot(pRdata %>% filter(dye=='TOTO') %>% filter(id!="with ctDNA TOTO"),aes(x=id,y=fluor))+
geom_col(aes(y=mean), fill = "light gray") +
geom_jitter(height=0,width=0.1,shape =21, size = 1)
# Plot styling
toto_plot_styled <- toto_plot +
labs(x = NULL, y = 'TOTO-1 Fluorescence (A.U.)') +
scale_x_discrete(breaks = c('no ctDNA TOTO','no DNase TOTO','with DNase TOTO'),
labels=c("-","+ buffer", "+ buffer\n+ DNase"))
toto_plot_styled
Let’s read in the raw well data and the metadata:
df_biofilms <- read_csv("../../../../data/Spectroscopy/2019_11_22_std_wt_dphz_postCTdna.csv") %>% gather(key = "well", value = "FluorInt", -wavelength)
df_meta <- read_csv("../../../../data/Spectroscopy/2019_11_22_well_metadata.csv")
df_toto <- left_join(df_biofilms, df_meta, by = c('well')) %>% filter(wavelength == 535)
df_toto %>% kable() %>% kable_styling(bootstrap_options = 'condensed') %>%
scroll_box(width = "100%", height = "400px")
wavelength | well | FluorInt | strain | toto_added | ctDNA_added | well_std_conc | bio_rep | tech_rep |
---|---|---|---|---|---|---|---|---|
535 | A1 | 37448 | std | TRUE | TRUE | 50.0000000 | 1 | 1 |
535 | A2 | 36204 | std | TRUE | TRUE | 25.0000000 | 1 | 1 |
535 | A3 | 35944 | std | TRUE | TRUE | 12.5000000 | 1 | 1 |
535 | A4 | 32623 | std | TRUE | TRUE | 6.2500000 | 1 | 1 |
535 | A5 | 23778 | std | TRUE | TRUE | 3.1250000 | 1 | 1 |
535 | A6 | 15091 | std | TRUE | TRUE | 1.5625000 | 1 | 1 |
535 | A7 | 9899 | std | TRUE | TRUE | 0.7812500 | 1 | 1 |
535 | A8 | 7085 | std | TRUE | TRUE | 0.3906250 | 1 | 1 |
535 | A9 | 6164 | std | TRUE | TRUE | 0.1953125 | 1 | 1 |
535 | A10 | 3926 | std | TRUE | TRUE | 0.0976562 | 1 | 1 |
535 | A11 | 4527 | std | TRUE | TRUE | 0.0488281 | 1 | 1 |
535 | A12 | 3075 | std | TRUE | TRUE | 0.0244141 | 1 | 1 |
535 | B1 | 12139 | WT | TRUE | TRUE | NA | 1 | 1 |
535 | B2 | 13446 | WT | TRUE | TRUE | NA | 2 | 1 |
535 | B3 | 11074 | WT | TRUE | TRUE | NA | 3 | 1 |
535 | B4 | 11370 | WT | TRUE | TRUE | NA | 4 | 1 |
535 | B5 | 12068 | WT | TRUE | TRUE | NA | 5 | 1 |
535 | B6 | 11855 | WT | TRUE | TRUE | NA | 6 | 1 |
535 | B7 | 10123 | WT | TRUE | FALSE | NA | 1 | 2 |
535 | B8 | 11827 | WT | TRUE | FALSE | NA | 2 | 2 |
535 | B9 | 9761 | WT | TRUE | FALSE | NA | 3 | 2 |
535 | B10 | 10182 | WT | TRUE | FALSE | NA | 4 | 2 |
535 | B11 | 9634 | WT | TRUE | FALSE | NA | 5 | 2 |
535 | B12 | 11566 | WT | TRUE | FALSE | NA | 6 | 2 |
535 | C1 | 10915 | WT | TRUE | FALSE | NA | 1 | 3 |
535 | C2 | 10894 | WT | TRUE | FALSE | NA | 2 | 3 |
535 | C3 | 9651 | WT | TRUE | FALSE | NA | 3 | 3 |
535 | C4 | 10147 | WT | TRUE | FALSE | NA | 4 | 3 |
535 | C5 | 11910 | WT | TRUE | FALSE | NA | 5 | 3 |
535 | C6 | 12036 | WT | TRUE | FALSE | NA | 6 | 3 |
535 | C7 | 130 | WT | FALSE | FALSE | NA | 1 | 4 |
535 | C8 | 190 | WT | FALSE | FALSE | NA | 2 | 4 |
535 | C9 | 119 | WT | FALSE | FALSE | NA | 3 | 4 |
535 | C10 | 124 | WT | FALSE | FALSE | NA | 4 | 4 |
535 | C11 | 144 | WT | FALSE | FALSE | NA | 5 | 4 |
535 | C12 | 138 | WT | FALSE | FALSE | NA | 6 | 4 |
535 | E1 | 23490 | dPHZ | TRUE | TRUE | NA | 1 | 1 |
535 | E2 | 22622 | dPHZ | TRUE | TRUE | NA | 2 | 1 |
535 | E3 | 24901 | dPHZ | TRUE | TRUE | NA | 3 | 1 |
535 | E4 | 14964 | dPHZ | TRUE | TRUE | NA | 4 | 1 |
535 | E5 | 19109 | dPHZ | TRUE | TRUE | NA | 5 | 1 |
535 | E6 | 14650 | dPHZ | TRUE | TRUE | NA | 6 | 1 |
535 | F1 | 22498 | dPHZ | TRUE | FALSE | NA | 1 | 2 |
535 | F2 | 13008 | dPHZ | TRUE | FALSE | NA | 2 | 2 |
535 | F3 | 15141 | dPHZ | TRUE | FALSE | NA | 3 | 2 |
535 | F4 | 18463 | dPHZ | TRUE | FALSE | NA | 4 | 2 |
535 | F5 | 14572 | dPHZ | TRUE | FALSE | NA | 5 | 2 |
535 | F6 | 17939 | dPHZ | TRUE | FALSE | NA | 6 | 2 |
535 | G1 | 25159 | dPHZ | TRUE | FALSE | NA | 1 | 3 |
535 | G2 | 12442 | dPHZ | TRUE | FALSE | NA | 2 | 3 |
535 | G3 | 14663 | dPHZ | TRUE | FALSE | NA | 3 | 3 |
535 | G4 | 15324 | dPHZ | TRUE | FALSE | NA | 4 | 3 |
535 | G5 | 13968 | dPHZ | TRUE | FALSE | NA | 5 | 3 |
535 | G6 | 16661 | dPHZ | TRUE | FALSE | NA | 6 | 3 |
535 | H1 | 235 | dPHZ | FALSE | FALSE | NA | 1 | 4 |
535 | H2 | 164 | dPHZ | FALSE | FALSE | NA | 2 | 4 |
535 | H3 | 500 | dPHZ | FALSE | FALSE | NA | 3 | 4 |
535 | H4 | 191 | dPHZ | FALSE | FALSE | NA | 4 | 4 |
535 | H5 | 208 | dPHZ | FALSE | FALSE | NA | 5 | 4 |
535 | H6 | 221 | dPHZ | FALSE | FALSE | NA | 6 | 4 |
Now let’s make the plot:
bg_means <- df_toto %>% filter(strain != 'std' & tech_rep == 4) %>% group_by(strain) %>% summarise(mean = mean(FluorInt))
plot_eDNA <- ggplot(df_toto %>% filter(strain != 'std') %>% mutate(facet_labels = ifelse(strain =='dPHZ', paste0('\u0394','phz'), strain)),
aes(x = factor(tech_rep), y = FluorInt)) +
geom_line(data = . %>% filter(tech_rep<4), aes(group = bio_rep), color = 'light gray')+
geom_hline(data = bg_means, aes(yintercept = mean), linetype = 2, color = 'light gray') +
geom_point(data = . %>% filter(tech_rep<4), aes(fill = factor(ctDNA_added)), shape = 21) +
geom_jitter(data = . %>% filter(tech_rep==4), aes(x = 2), width = 1, shape = 21, color = 'light gray')+
facet_wrap(~facet_labels, scales = 'free') + ylim(0, 30000) + guides(fill = F)
# Plot styling
plot_eDNA_styled <- plot_eDNA +
labs(x = 'Technical replicates', y = 'TOTO-1 Fluorescence (A.U.)')
plot_eDNA_styled
theme_set(theme_figure())
fig_s3 <- plot_grid( toto_plot_styled,plot_eDNA_styled, align = 'hv', axis = 'tblr', ncol = 2, rel_widths = c(1,2), scale = 0.95, labels = c('C','E'), label_size = 12)
fig_s3
## R version 3.5.3 (2019-03-11)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS 10.15.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] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] lubridate_1.7.4 hms_0.5.3 modelr_0.1.5
## [4] broom_0.5.2 kableExtra_1.1.0 cowplot_0.9.4
## [7] viridis_0.5.1 viridisLite_0.3.0 knitr_1.23
## [10] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.3
## [13] purrr_0.3.3 readr_1.3.1 tidyr_1.0.0
## [16] tibble_2.1.3 ggplot2_3.3.0 tidyverse_1.3.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_0.2.5 xfun_0.7 haven_2.2.0 lattice_0.20-38
## [5] colorspace_1.4-1 vctrs_0.3.1 generics_0.0.2 htmltools_0.4.0
## [9] yaml_2.2.0 rlang_0.4.6 pillar_1.4.2 glue_1.3.1
## [13] withr_2.1.2 DBI_1.0.0 dbplyr_1.4.2 readxl_1.3.1
## [17] lifecycle_0.1.0 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0
## [21] rvest_0.3.5 evaluate_0.14 labeling_0.3 highr_0.8
## [25] Rcpp_1.0.2 scales_1.0.0 backports_1.1.4 webshot_0.5.1
## [29] jsonlite_1.6 fs_1.3.1 gridExtra_2.3 digest_0.6.21
## [33] stringi_1.4.3 grid_3.5.3 cli_1.1.0 tools_3.5.3
## [37] magrittr_1.5 crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.0
## [41] xml2_1.2.2 reprex_0.3.0 assertthat_0.2.1 rmarkdown_1.13
## [45] httr_1.4.1 rstudioapi_0.10 R6_2.4.0 nlme_3.1-137
## [49] compiler_3.5.3