Last updated: 2021-07-03

Checks: 7 0

Knit directory: wildlife-haemoprotozoa/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210212) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 63bd5ef. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/_footer.html
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  ENA_submission/
    Untracked:  NCBI_submission/
    Untracked:  Rplot02.pdf
    Untracked:  data/NGS_18S_kinet/
    Untracked:  data/Sanger-piroplasm/
    Untracked:  data/haemoprotozoa.csv
    Untracked:  data/haemoprotozoa.xlsx
    Untracked:  data/tryp-phyloseq/count_data_QC.xlsx
    Untracked:  data/tryp-phyloseq/count_data_raw.csv
    Untracked:  data/tryp-phyloseq/sampledata.xlsx
    Untracked:  melt.csv
    Untracked:  melt.xlsx
    Untracked:  microscopy/
    Untracked:  output/plots/

Unstaged changes:
    Modified:   README.md
    Modified:   code/usearchv11_18S_Kineto.sh

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/misc-dataviz.Rmd) and HTML (docs/misc-dataviz.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 63bd5ef siobhon-egan 2021-07-03 Formatting and setup updates
html 2d0d4fb siobhon-egan 2021-07-02 Build site.
Rmd cd30eb4 siobhon-egan 2021-07-02 update data vis page and remove wflow commands from index
html a36fbcb siobhon-egan 2021-07-02 Build site.
Rmd 8e3850e siobhon-egan 2021-07-02 Major update
html 9ad75d7 siobhon-egan 2021-03-18 Build site.
Rmd d429fdd siobhon-egan 2021-03-18 First publish

This page to host some misc. data visualization and notes for phylogenetics.

Haemoprotozoa prevalence

Import data

library(readr)
haem <- read_csv("data/haemoprotozoa.csv")

── Column specification ────────────────────────────────────────────────────────
cols(
  gDNA_ID = col_character(),
  species_code = col_character(),
  `Hepatozoon sp.` = col_double(),
  `Babesia lohae-like` = col_double(),
  `Theileria cf. peramelis` = col_double(),
  `Trypanosoma lewisi-like` = col_double(),
  `Trypanosoma noyesi` = col_double(),
  `Trypanosoma gilletti` = col_double(),
  `Trypanosoma cyclops-like` = col_double()
)

UpSetR plot

Creating UpSetR and the add on ComplexUpset plot to show co-infections, Extra examples here

Load libraries

Load data

Must be in a dataframe format

# convert to dataframe
haemdf <- as.data.frame(haem)
str(haemdf)
'data.frame':   134 obs. of  9 variables:
 $ gDNA_ID                 : chr  "QUE001-M" "CHU001-QIA" "CHU002-M" "CHU003-M" ...
 $ species_code            : chr  "Quenda" "Chuditch" "Chuditch" "Chuditch" ...
 $ Hepatozoon sp.          : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Babesia lohae-like      : num  0 0 0 0 0 0 0 0 1 1 ...
 $ Theileria cf. peramelis : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Trypanosoma lewisi-like : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Trypanosoma noyesi      : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Trypanosoma gilletti    : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Trypanosoma cyclops-like: num  0 0 0 0 0 0 1 1 0 0 ...
 - attr(*, "spec")=
  .. cols(
  ..   gDNA_ID = col_character(),
  ..   species_code = col_character(),
  ..   `Hepatozoon sp.` = col_double(),
  ..   `Babesia lohae-like` = col_double(),
  ..   `Theileria cf. peramelis` = col_double(),
  ..   `Trypanosoma lewisi-like` = col_double(),
  ..   `Trypanosoma noyesi` = col_double(),
  ..   `Trypanosoma gilletti` = col_double(),
  ..   `Trypanosoma cyclops-like` = col_double()
  .. )
# define columns with species info
haem_sp = colnames(haemdf)[3:9]
haem_sp
[1] "Hepatozoon sp."           "Babesia lohae-like"      
[3] "Theileria cf. peramelis"  "Trypanosoma lewisi-like" 
[5] "Trypanosoma noyesi"       "Trypanosoma gilletti"    
[7] "Trypanosoma cyclops-like"

Simple UpSetR plot

upsetR1 = upset(haemdf, sets = c("Hepatozoon sp.", "Babesia lohae-like", "Theileria cf. peramelis", "Trypanosoma lewisi-like", "Trypanosoma noyesi", "Trypanosoma gilletti", "Trypanosoma cyclops-like"), sets.bar.color = "#7a255d")
upsetR1

Version Author Date
2d0d4fb siobhon-egan 2021-07-02

More detailed plots using ComplexUpset

library(ComplexUpset)

Attaching package: 'ComplexUpset'
The following object is masked from 'package:UpSetR':

    upset
upsetR3 = upset(
    haemdf,
    haem_sp, width_ratio=0.1,
    base_annotations=list(
        'Intersection size'=intersection_size(
            counts=TRUE,
            mapping=aes(fill=species_code)
        ))
)
upsetR3

Version Author Date
2d0d4fb siobhon-egan 2021-07-02
upsetR4 = upset(
    haemdf, haem_sp,
    set_sizes=(
        upset_set_size(
            geom=geom_bar(
                aes(fill=species_code, x=group)
            ),
            position='right'
        )
    ),
    # moves legends over the set sizes
    guides='over'
)

upsetR4

Version Author Date
2d0d4fb siobhon-egan 2021-07-02

Phylogenetics

All phylogenetics created in related manuscript was done using IQTEE.

My detailed notes on using IQTREE server for generated phylogenies is here.

Trees visualised using FigTree and annotated in inkscape.


sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ComplexUpset_1.1.0 forcats_0.5.1      stringr_1.4.0      dplyr_1.0.5       
 [5] purrr_0.3.4        tidyr_1.1.2        tibble_3.1.0       ggplot2_3.3.3     
 [9] tidyverse_1.3.0    UpSetR_1.4.0       readr_1.4.0        workflowr_1.6.2   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6        lubridate_1.7.10  assertthat_0.2.1  rprojroot_2.0.2  
 [5] digest_0.6.27     utf8_1.2.1        R6_2.5.0          cellranger_1.1.0 
 [9] plyr_1.8.6        backports_1.2.1   reprex_1.0.0      evaluate_0.14    
[13] highr_0.8         httr_1.4.2        pillar_1.5.1      rlang_0.4.10     
[17] readxl_1.3.1      rstudioapi_0.13   whisker_0.4       jquerylib_0.1.3  
[21] rmarkdown_2.7.2   labeling_0.4.2    munsell_0.5.0     broom_0.7.5      
[25] compiler_4.0.3    httpuv_1.5.5      modelr_0.1.8      xfun_0.21        
[29] pkgconfig_2.0.3   htmltools_0.5.1.1 tidyselect_1.1.0  gridExtra_2.3    
[33] fansi_0.4.2       crayon_1.4.1      dbplyr_2.1.0      withr_2.4.1      
[37] later_1.1.0.1     grid_4.0.3        jsonlite_1.7.2    gtable_0.3.0     
[41] lifecycle_1.0.0   DBI_1.1.1         git2r_0.28.0      magrittr_2.0.1   
[45] scales_1.1.1      cli_2.3.1         stringi_1.5.3     farver_2.0.3     
[49] fs_1.5.0          promises_1.2.0.1  xml2_1.3.2        bslib_0.2.4.9001 
[53] ellipsis_0.3.1    generics_0.1.0    vctrs_0.3.7       tools_4.0.3      
[57] glue_1.4.2        hms_1.0.0         yaml_2.2.1        colorspace_2.0-0 
[61] rvest_0.3.6       knitr_1.31        haven_2.3.1       patchwork_1.1.1  
[65] sass_0.3.1       

Project website by Siobhon L. Egan, 2021. This site was created in R Markdown with workflowr