Author: Your name and student ID


0. Having the right R version

Make sure that your R version is set to R 4.4.3. This allows the packages that we use for this assignment to function properly. To change your version look in the upper right corner near the R project symbol and you should be able to select the correct R version


1. Initiate the Project

1.1 Install.packages

This take a little bit of time to run

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.20")
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories",
package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://cran.rstudio.com/
Bioconductor version 3.20 (BiocManager 1.30.26), R 4.4.3 (2025-02-28)
Installation paths not writeable, unable to update packages
  path: /opt/R/4.4.3/lib/R/library
  packages:
    aplot, arrow, audio, backports, base64enc, bayestestR, beepr, BiocManager, bit64, blob,
    broom, bslib, callr, car, carData, checkmate, class, cli, clipr, cluster, colorspace,
    coursekata, cpp11, curl, data.table, datawizard, DBI, dbplyr, descr, diffobj, digest, doBy,
    dplyr, dslabs, dtplyr, duckdb, e1071, foreign, Formula, fs, gargle, gdtools, geojsonsf,
    geometries, ggfun, ggplot2, ggplotify, ggrepel, glmnet, glue, googledrive, googlesheets4,
    graphlayouts, gridExtra, highr, Hmisc, htmlTable, htmltools, httpuv, httr, igraph, insight,
    isoband, jsonify, KernSmooth, knitr, labelled, later, lattice, lazyeval, leaflet.extras,
    leaflet.providers, lifecycle, lme4, lsr, lubridate, lwgeom, magrittr, mapedit, MASS, Matrix,
    mgcv, mice, mitools, modelsummary, mosaic, nlme, nnet, openssl, ordinal, pan, parameters,
    performance, pkgload, png, processx, promises, proxy, ps, purrr, ragg, rapidjsonr, rappdirs,
    rbibutils, Rcpp, RcppArmadillo, Rdpack, readr, readxl, reformulas, reticulate, rio, rlang,
    rmarkdown, robis, rpart, RSQLite, rstudioapi, s2, S7, selectr, servr, sf, sfheaders, shiny,
    shinyWidgets, sourcetools, sp, spatial, stars, stringi, stringr, supernova, survey, survival,
    svglite, systemfonts, tables, terra, textshaping, tibble, tidyr, tidytree, timechange,
    tinytable, tinytex, ucminf, units, uuid, vctrs, viridisLite, vroom, withr, wk, writexl, xfun,
    XML, xml2, xtable, yaml, yulab.utils, zoo
BiocManager::install("ggtree")
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories",
package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://cran.rstudio.com/
Bioconductor version 3.20 (BiocManager 1.30.26), R 4.4.3 (2025-02-28)
Installation paths not writeable, unable to update packages
  path: /opt/R/4.4.3/lib/R/library
  packages:
    aplot, arrow, audio, backports, base64enc, bayestestR, beepr, BiocManager, bit64, blob,
    broom, bslib, callr, car, carData, checkmate, class, cli, clipr, cluster, colorspace,
    coursekata, cpp11, curl, data.table, datawizard, DBI, dbplyr, descr, diffobj, digest, doBy,
    dplyr, dslabs, dtplyr, duckdb, e1071, foreign, Formula, fs, gargle, gdtools, geojsonsf,
    geometries, ggfun, ggplot2, ggplotify, ggrepel, glmnet, glue, googledrive, googlesheets4,
    graphlayouts, gridExtra, highr, Hmisc, htmlTable, htmltools, httpuv, httr, igraph, insight,
    isoband, jsonify, KernSmooth, knitr, labelled, later, lattice, lazyeval, leaflet.extras,
    leaflet.providers, lifecycle, lme4, lsr, lubridate, lwgeom, magrittr, mapedit, MASS, Matrix,
    mgcv, mice, mitools, modelsummary, mosaic, nlme, nnet, openssl, ordinal, pan, parameters,
    performance, pkgload, png, processx, promises, proxy, ps, purrr, ragg, rapidjsonr, rappdirs,
    rbibutils, Rcpp, RcppArmadillo, Rdpack, readr, readxl, reformulas, reticulate, rio, rlang,
    rmarkdown, robis, rpart, RSQLite, rstudioapi, s2, S7, selectr, servr, sf, sfheaders, shiny,
    shinyWidgets, sourcetools, sp, spatial, stars, stringi, stringr, supernova, survey, survival,
    svglite, systemfonts, tables, terra, textshaping, tibble, tidyr, tidytree, timechange,
    tinytable, tinytex, ucminf, units, uuid, vctrs, viridisLite, vroom, withr, wk, writexl, xfun,
    XML, xml2, xtable, yaml, yulab.utils, zoo

These should be fairly quick, but there might be some errors

install.packages("ape")
Installing package into ‘/home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ape_5.8-1.tar.gz'
Content type 'application/x-gzip' length 1424541 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘ape’ ...
** package ‘ape’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)’
using C++ compiler: ‘g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)’
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c BIONJ.c -o BIONJ.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c NNI.c -o NNI.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2   -c RcppExports.cpp -o RcppExports.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c SPR.c -o SPR.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c additive.c -o additive.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c ape.c -o ape.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c bNNI.c -o bNNI.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c bionjs.c -o bionjs.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c bipartition.c -o bipartition.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c bitsplits.c -o bitsplits.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c delta_plot.c -o delta_plot.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c dist_dna.c -o dist_dna.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c dist_nodes.c -o dist_nodes.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c ewLasso.c -o ewLasso.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c heap.c -o heap.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c mat_expo.c -o mat_expo.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c me.c -o me.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c me_balanced.c -o me_balanced.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c me_ols.c -o me_ols.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c mvr.c -o mvr.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c mvrs.c -o mvrs.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c nj.c -o nj.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c njs.c -o njs.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c pic.c -o pic.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c plot_phylo.c -o plot_phylo.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2   -c prop_part.cpp -o prop_part.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c rTrait.c -o rTrait.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c read_dna.c -o read_dna.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2   -c reorder_Rcpp.cpp -o reorder_Rcpp.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c reorder_phylo.c -o reorder_phylo.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c treePop.c -o treePop.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c tree_build.c -o tree_build.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c tree_phylo.c -o tree_phylo.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c triangMtd.c -o triangMtd.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c triangMtds.c -o triangMtds.o
gcc -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c ultrametric.c -o ultrametric.o
g++ -std=gnu++17 -shared -L/opt/R/4.4.3/lib/R/lib -L/usr/local/lib -o ape.so BIONJ.o NNI.o RcppExports.o SPR.o additive.o ape.o bNNI.o bionjs.o bipartition.o bitsplits.o delta_plot.o dist_dna.o dist_nodes.o ewLasso.o heap.o mat_expo.o me.o me_balanced.o me_ols.o mvr.o mvrs.o nj.o njs.o pic.o plot_phylo.o prop_part.o rTrait.o read_dna.o reorder_Rcpp.o reorder_phylo.o treePop.o tree_build.o tree_phylo.o triangMtd.o triangMtds.o ultrametric.o -lflexiblas -lgfortran -lm -lquadmath -L/opt/R/4.4.3/lib/R/lib -lR
installing to /home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-ape/00new/ape/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘ape’
    finding HTML links ... done
    AAbin                                   html  
    CADM.global                             html  
    DNAbin                                  html  
    DNAbin2indel                            html  
    Initialize.corPhyl                      html  
    LTT                                     html  
    MPR                                     html  
    MoranI                                  html  
    SDM                                     html  
    ace                                     html  
    add.scale.bar                           html  
    additive                                html  
    alex                                    html  
    all.equal.DNAbin                        html  
    all.equal.phylo                         html  
    alview                                  html  
    ape-internal                            html  
    ape-package                             html  
    apetools                                html  
    as.alignment                            html  
    as.bitsplits                            html  
    as.matching                             html  
    as.phylo                                html  
    as.phylo.formula                        html  
    axisPhylo                               html  
    balance                                 html  
    base.freq                               html  
    bd.ext                                  html  
    bd.time                                 html  
    binaryPGLMM                             html  
    bind.tree                               html  
    bionj                                   html  
    bird.families                           html  
    bird.orders                             html  
    birthdeath                              html  
    boot.phylo                              html  
    branching.times                         html  
    c.phylo                                 html  
    carnivora                               html  
    checkAlignment                          html  
    checkLabel                              html  
    checkValidPhylo                         html  
    cherry                                  html  
    chiroptera                              html  
    chronoMPL                               html  
    chronopl                                html  
    chronos                                 html  
    clustal                                 html  
    coalescent.intervals                    html  
    collapse.singles                        html  
    collapsed.intervals                     html  
    compar.cheverud                         html  
    compar.gee                              html  
    compar.lynch                            html  
    compar.ou                               html  
    comparePhylo                            html  
    compute.brlen                           html  
    compute.brtime                          html  
    consensus                               html  
    cophenetic.phylo                        html  
    cophyloplot                             html  
    corBlomberg                             html  
    corBrownian                             html  
    corClasses                              html  
    corGrafen                               html  
    corMartins                              html  
    corPagel                                html  
    corphylo                                html  
    correlogram.formula                     html  
    cynipids                                html  
    dbd                                     html  
    def                                     html  
    degree                                  html  
    del.gaps                                html  
    delta.plot                              html  
    dist.dna                                html  
    dist.gene                               html  
    dist.topo                               html  
    diversi.gof                             html  
    diversi.time                            html  
    diversity.contrast.test                 html  
    dnds                                    html  
    drop.tip                                html  
    edges                                   html  
    evonet                                  html  
    ewLasso                                 html  
    fastme                                  html  
    gammaStat                               html  
    getAnnotationsGenBank                   html  
    hivtree                                 html  
    howmanytrees                            html  
    identify.phylo                          html  
    image.DNAbin                            html  
    is.binary.tree                          html  
    is.compatible                           html  
    is.monophyletic                         html  
    is.ultrametric                          html  
    kronoviz                                html  
    label2table                             html  
    ladderize                               html  
    latag2n                                 html  
    lmorigin                                html  
    ltt.plot                                html  
    makeLabel                               html  
    makeNodeLabel                           html  
    mantel.test                             html  
    mat3                                    html  
    mat5M3ID                                html  
    mat5Mrand                               html  
    matexpo                                 html  
    mcconwaysims.test                       html  
    mcmc.popsize                            html  
    mixedFontLabel                          html  
    mrca                                    html  
    mst                                     html  
    multi2di                                html  
    multiphylo                              html  
    mvr                                     html  
    nj                                      html  
    njs                                     html  
    node.dating                             html  
    node.depth                              html  
    nodelabels                              html  
    nodepath                                html  
    parafit                                 html  
    pcoa                                    html  
    phydataplot                             html  
    phymltest                               html  
    pic                                     html  
    pic.ortho                               html  
    plot.correlogram                        html  
    plot.phylo                              html  
    plot.phyloExtra                         html  
    plot.varcomp                            html  
    plotTreeTime                            html  
    print.phylo                             html  
    rDNAbin                                 html  
    rTraitCont                              html  
    rTraitDisc                              html  
    rTraitMult                              html  
    read.GenBank                            html  
    read.caic                               html  
    read.dna                                html  
    read.gff                                html  
    read.nexus                              html  
    read.nexus.data                         html  
    read.tree                               html  
    reconstruct                             html  
    reorder.phylo                           html  
    richness.yule.test                      html  
    rlineage                                html  
    root                                    html  
    rotate                                  html  
    rtree                                   html  
    rtt                                     html  
    seg.sites                               html  
    skyline                                 html  
    skylineplot                             html  
    slowinskiguyer.test                     html  
    solveAmbiguousBases                     html  
    speciesTree                             html  
    stree                                   html  
    subtreeplot                             html  
    subtrees                                html  
    summary.phylo                           html  
    trans                                   html  
    treePop                                 html  
    trex                                    html  
    triangMtd                               html  
    unique.multiPhylo                       html  
    updateLabel                             html  
    varCompPhylip                           html  
    varcomp                                 html  
    vcv.phylo                               html  
    vcv2phylo                               html  
    weight.taxo                             html  
    where                                   html  
    which.edge                              html  
    woodmouse                               html  
    write.dna                               html  
    write.nexus                             html  
    write.nexus.data                        html  
    write.phyloXML                          html  
    write.tree                              html  
    yule                                    html  
    yule.cov                                html  
    yule.time                               html  
    zoom                                    html  
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ape)

The downloaded source packages are in
    ‘/mnt/scratch/rstudio-tmp/andrew.flynn/RtmpEtRrGM/downloaded_packages’
install.packages("dplyr")
Installing package into ‘/home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_1.2.1.tar.gz'
Content type 'application/x-gzip' length 923509 bytes (901 KB)
==================================================
downloaded 901 KB

* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)’
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c chop.cpp -o chop.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c filter.cpp -o filter.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c funs.cpp -o funs.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c group_by.cpp -o group_by.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c group_data.cpp -o group_data.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c imports.cpp -o imports.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c init.cpp -o init.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c mask.cpp -o mask.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c mutate.cpp -o mutate.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c reconstruct.cpp -o reconstruct.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c slice.cpp -o slice.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2   -c summarise.cpp -o summarise.o
g++ -std=gnu++17 -shared -L/opt/R/4.4.3/lib/R/lib -L/usr/local/lib -o dplyr.so chop.o filter.o funs.o group_by.o group_data.o imports.o init.o mask.o mutate.o reconstruct.o slice.o summarise.o -L/opt/R/4.4.3/lib/R/lib -lR
installing to /home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-dplyr/00new/dplyr/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘dplyr’
    finding HTML links ... done
    across                                  html  
    all_equal                               html  
    all_vars                                html  
    args_by                                 html  
    arrange                                 html  
    arrange_all                             html  
    auto_copy                               html  
    backend_dbplyr                          html  
    band_members                            html  
    between                                 html  
    bind_cols                               html  
    bind_rows                               html  
    c_across                                html  
    case-and-replace-when                   html  
    case_match                              html  
    check_dbplyr                            html  
    coalesce                                html  
    common_by                               html  
    compute                                 html  
    consecutive_id                          html  
    context                                 html  
    copy_to                                 html  
    count                                   html  
    cross_join                              html  
    cumall                                  html  
    defunct-each                            html  
    defunct-lazyeval                        html  
    defunct                                 html  
    deprec-context                          html  
    desc                                    html  
    dim_desc                                html  
    distinct                                html  
    distinct_all                            html  
    do                                      html  
    dplyr-locale                            html  
    dplyr-package                           html  
    dplyr_by                                html  
    dplyr_data_masking                      html  
    dplyr_extending                         html  
    dplyr_tidy_select                       html  
    explain                                 html  
    filter-joins                            html  
    filter                                  html  
    filter_all                              html  
    funs                                    html  
    glimpse                                 html  
    group_by                                html  
    group_by_all                            html  
    group_by_drop_default                   html  
    group_by_prepare                        html  
    group_cols                              html  
    group_data                              html  
    group_map                               html  
    group_nest                              html  
    group_split                             html  
    group_trim                              html  
    grouped_df                              html  
    ident                                   html  
    if_else                                 html  
    join_by                                 html  
    last_dplyr_warnings                     html  
    lead-lag                                html  
    make_tbl                                html  
    mutate-joins                            html  
    mutate                                  html  
    mutate_all                              html  
    n_distinct                              html  
    na_if                                   html  
    near                                    html  
    nest_by                                 html  
    nest_join                               html  
    new_grouped_df                          html  
    nth                                     html  
    ntile                                   html  
    order_by                                html  
    percent_rank                            html  
    pick                                    html  
    progress_estimated                      html  
    pull                                    html  
    recode-and-replace-values               html  
    recode                                  html  
    reexports                               html  
    reframe                                 html  
    relocate                                html  
    rename                                  html  
    row_number                              html  
    rows                                    html  
    rowwise                                 html  
    same_src                                html  
    sample_n                                html  
    scoped                                  html  
    select                                  html  
    select_all                              html  
    setops                                  html  
    slice                                   html  
    sql                                     html  
    src                                     html  
    src_tbls                                html  
    starwars                                html  
    storms                                  html  
    summarise                               html  
    summarise_all                           html  
    tbl                                     html  
    tbl_ptype                               html  
    tbl_vars                                html  
    tidyeval-compat                         html  
    top_n                                   html  
    transmute                               html  
    vars                                    html  
    when-any-all                            html  
    with_groups                             html  
    with_order                              html  
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (dplyr)

The downloaded source packages are in
    ‘/mnt/scratch/rstudio-tmp/andrew.flynn/RtmpEtRrGM/downloaded_packages’
install.packages("phytools")
Installing package into ‘/home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/phytools_2.5-2.tar.gz'
Content type 'application/x-gzip' length 521658 bytes (509 KB)
==================================================
downloaded 509 KB

* installing *source* package ‘phytools’ ...
** package ‘phytools’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘phytools’
    finding HTML links ... done
    Dtest                                   html  
    add.arrow                               html  
    add.color.bar                           html  
    add.everywhere                          html  
    add.random                              html  
    add.simmap.legend                       html  
    add.species.to.genus                    html  
    aic.w                                   html  
    allFurcTrees                            html  
    anc.Bayes                               html  
    anc.ML                                  html  
    anc.trend                               html  
    ancThresh                               html  
    ancr                                    html  
    anoletree                               html  
    ansi_phylo                              html  
    applyBranchLengths                      html  
    as.Qmatrix                              html  
    as.multiPhylo                           html  
    ave.rates                               html  
    averageTree                             html  
    bd                                      html  
    bind.tip                                html  
    bind.tree.simmap                        html  
    bmPlot                                  html  
    bounded_bm                              html  
    branching.diffusion                     html  
    brownie.lite                            html  
    brownieREML                             html  
    cladelabels                             html  
    collapse.to.star                        html  
    collapseTree                            html  
    compare.chronograms                     html  
    consensus.edges                         html  
    contMap                                 html  
    cophylo                                 html  
    cospeciation                            html  
    countSimmap                             html  
    ctt                                     html  
    density.multiSimmap                     html  
    densityMap                              html  
    densityTree                             html  
    describe.simmap                         html  
    di2multi.simmap                         html  
    dotTree                                 html  
    drop.clade                              html  
    drop.leaves                             html  
    drop.tip.contMap                        html  
    drop.tip.multiSimmap                    html  
    drop.tip.simmap                         html  
    edge.widthMap                           html  
    edgeProbs                               html  
    estDiversity                            html  
    evol.rate.mcmc                          html  
    evol.vcv                                html  
    evolvcv.lite                            html  
    exhaustiveMP                            html  
    expand.clade                            html  
    export.as.xml                           html  
    fancyTree                               html  
    fastAnc                                 html  
    fastBM                                  html  
    fastMRCA                                html  
    findMRCA                                html  
    fit.bd                                  html  
    fitBayes                                html  
    fitDiversityModel                       html  
    fitMk                                   html  
    fitPagel                                html  
    fitThresh                               html  
    fitcontMk                               html  
    fitmultiBM                              html  
    force.ultrametric                       html  
    gamma_pruning                           html  
    gammatest                               html  
    genSeq                                  html  
    geo.legend                              html  
    get.treepos                             html  
    getCladesofSize                         html  
    getDescendants                          html  
    getExtant                               html  
    getSisters                              html  
    getStates                               html  
    labelnodes                              html  
    ladderize.simmap                        html  
    lambda.transform                        html  
    likMlambda                              html  
    linklabels                              html  
    locate.fossil                           html  
    locate.yeti                             html  
    ls.tree                                 html  
    ltt                                     html  
    ltt95                                   html  
    make.era.map                            html  
    make.simmap                             html  
    map.overlap                             html  
    map.to.singleton                        html  
    mapped.states                           html  
    markChanges                             html  
    matchNodes                              html  
    mergeMappedStates                       html  
    midpoint.root                           html  
    minRotate                               html  
    minSplit                                html  
    modified.Grafen                         html  
    mrp.supertree                           html  
    multi.mantel                            html  
    multiC                                  html  
    multiRF                                 html  
    multirateBM                             html  
    nodeHeights                             html  
    nodelabels.cophylo                      html  
    optim.phylo.ls                          html  
    orderMappedEdge                         html  
    paintSubTree                            html  
    paste.tree                              html  
    pbtree                                  html  
    pgls.Ives                               html  
    phenogram                               html  
    phyl.RMA                                html  
    phyl.cca                                html  
    phyl.pairedttest                        html  
    phyl.pca                                html  
    phyl.resid                              html  
    phyl.vcv                                html  
    phylANOVA                               html  
    phylo.heatmap                           html  
    phylo.impute                            html  
    phylo.to.map                            html  
    phylo.toBackbone                        html  
    phyloDesign                             html  
    phylomorphospace                        html  
    phylomorphospace3d                      html  
    phylosig                                html  
    phytools-package                        html  
    plot.backbonePhylo                      html  
    plotBranchbyTrait                       html  
    plotSimmap                              html  
    plotThresh                              html  
    plotTree                                html  
    plotTree.datamatrix                     html  
    plotTree.errorbars                      html  
    plotTree.lollipop                       html  
    plotTree.wBars                          html  
    posterior.evolrate                      html  
    posthoc                                 html  
    print.backbonePhylo                     html  
    pscore                                  html  
    ratebystate                             html  
    ratebytree                              html  
    rateshift                               html  
    read.newick                             html  
    read.simmap                             html  
    reorder.backbonePhylo                   html  
    reorderSimmap                           html  
    rep.phylo                               html  
    reroot                                  html  
    rerootingMethod                         html  
    rescale                                 html  
    rescaleSimmap                           html  
    resolveNode                             html  
    rotateNodes                             html  
    roundBranches                           html  
    roundPhylogram                          html  
    rstate                                  html  
    sampleFrom                              html  
    setMap                                  html  
    sim.corrs                               html  
    sim.history                             html  
    sim.ratebystate                         html  
    sim.rates                               html  
    simBMphylo                              html  
    skewers                                 html  
    splitEdgeColor                          html  
    splitTree                               html  
    splitplotTree                           html  
    starTree                                html  
    strahlerNumber                          html  
    threshBayes                             html  
    threshDIC                               html  
    threshState                             html  
    to.matrix                               html  
    tree.grow                               html  
    treeSlice                               html  
    untangle                                html  
    vcvPhylo                                html  
    write.simmap                            html  
    writeAncestors                          html  
    writeNexus                              html  
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (phytools)

The downloaded source packages are in
    ‘/mnt/scratch/rstudio-tmp/andrew.flynn/RtmpEtRrGM/downloaded_packages’
install.packages("tidyr")
Installing package into ‘/home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/tidyr_1.3.2.tar.gz'
Content type 'application/x-gzip' length 809031 bytes (790 KB)
==================================================
downloaded 790 KB

* installing *source* package ‘tidyr’ ...
** package ‘tidyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)’
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/cpp11/include' -I/usr/local/include    -fpic  -g -O2   -c cpp11.cpp -o cpp11.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/cpp11/include' -I/usr/local/include    -fpic  -g -O2   -c melt.cpp -o melt.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG  -I'/opt/R/4.4.3/lib/R/library/cpp11/include' -I/usr/local/include    -fpic  -g -O2   -c simplifyPieces.cpp -o simplifyPieces.o
g++ -std=gnu++17 -shared -L/opt/R/4.4.3/lib/R/lib -L/usr/local/lib -o tidyr.so cpp11.o melt.o simplifyPieces.o -L/opt/R/4.4.3/lib/R/lib -lR
installing to /home/andrew.flynn/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-tidyr/00new/tidyr/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘tidyr’
    finding HTML links ... done
    billboard                               html  
    check_pivot_spec                        html  
    chop                                    html  
    cms_patient_experience                  html  
    complete                                html  
    construction                            html  
    deprecated-se                           html  
    drop_na                                 html  
    expand                                  html  
    expand_grid                             html  
    extract                                 html  
    extract_numeric                         html  
    fill                                    html  
    fish_encounters                         html  
    full_seq                                html  
    gather                                  html  
    hoist                                   html  
    household                               html  
    nest                                    html  
    nest_legacy                             html  
    pack                                    html  
    pipe                                    html  
    pivot_longer                            html  
    pivot_longer_spec                       html  
    pivot_wider                             html  
    pivot_wider_spec                        html  
    reexports                               html  
    relig_income                            html  
    replace_na                              html  
    separate                                html  
    separate_longer_delim                   html  
    separate_rows                           html  
    separate_wider_delim                    html  
    smiths                                  html  
    spread                                  html  
    table1                                  html  
    tidyr-package                           html  
    tidyr_data_masking                      html  
    tidyr_legacy                            html  
    tidyr_tidy_select                       html  
    uncount                                 html  
    unite                                   html  
    unnest                                  html  
    unnest_auto                             html  
    unnest_longer                           html  
    unnest_wider                            html  
    us_rent_income                          html  
    who                                     html  
    world_bank_pop                          html  
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tidyr)

The downloaded source packages are in
    ‘/mnt/scratch/rstudio-tmp/andrew.flynn/RtmpEtRrGM/downloaded_packages’

NOTE: When you are done with this section please comment out lines or delete the section above entirely. You can double check if they were installed in the packages section in the lower right tabs

1.2 Load your libraries

library(ape)
library(dplyr)

Attaching package: ‘dplyr’

The following object is masked from ‘package:ape’:

    where

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union
library(ggplot2)
Use suppressPackageStartupMessages() to eliminate package startup messages
library(ggtree)
ggtree v3.14.0 Learn more at https://yulab-smu.top/contribution-tree-data/

Please cite:

Guangchuang Yu.  Data Integration, Manipulation and Visualization of Phylogenetic Trees
(1st edition). Chapman and Hall/CRC. 2022, doi:10.1201/9781003279242, ISBN:
9781032233574

Attaching package: ‘ggtree’

The following object is masked from ‘package:ape’:

    rotate
library(phytools)
Loading required package: maps
library(tidyr)

Attaching package: ‘tidyr’

The following object is masked from ‘package:ggtree’:

    expand

2. Where Did COVID-19 Come From?

Coronaviruses are common pathogens in humans and mostly have benign effects (e.g., the common cold). But some past coronavirus strains have caused substantial illness in humans, including MERS (Middle East Respiratory Syndrome), which caused a limited outbreak in 2012, and SARS (Severe Acute Respiratory Syndrome), which caused a limited outbreak in 2002/2003. The ubiquity of coronaviruses raises questions about the origins of SARS-CoV-2, which is causing the current COVID-19 pandemic.


2.1. Hypothesis

Based on the information above and what you know about the evolution of flu viruses, phrase a hypothesis about the potential evolutionary origins of SARS-CoV-2.

Your answer goes here The virus originated in bats, and then evolved to become more transmitable when first getting in contact with humans.

2.2. Identifying the Evolutionary Origins of SARS-CoV-2

Phylogenetic analyses allow us to examine how organisms are related, and in the case of SARS-CoV-2, where its evolutionary origins might lie. In the modern age of DNA sequencing, virus genomes from the current pandemic have become rapidly available. In the section below, you will visualize a phylogenetic tree that is based on whole genome sequencing of different SARS-CoV-2 isolates, isolates of SARS-CoV (which caused the outbreak in 2002/2003), as well as other SARS-like coronaviruses that were isolated from a variety of host species. We will walk you through the visualization and annotation of the tree step by step in the following section.


2.2.1. Importing and Plotting a Phylogenetic Tree

Phylogenetic trees come in a wide variety of formats that are not easily readable with standard programs. In this exercise, we will use trees that are encoded in the Newick format (nwk file ending), and R can read and interpret such trees with the read.tree() function from the ape package. To load the phylogeny of the different coronaviruses, you can simply execute the code below, and a object cov.tree should show up in your Global Environment.

#This line simply reads in the phylogenetic tree (akin to the read.csv function for reading in tables)
cov.tree <- read.tree("coronaviruses_tree.nwk")

Once your tree is imported into R, you can visualize it using the ggtree() function from the ggtree package. ggtree is an extension of ggplot2, which you have already worked with. You only have to specify the data frame containing the phylogenetic tree (which we named cov.tree above). Like with ggplot(), you can add graphical elements using the plus sign. For example, the names of the different viral isolates are added to the tips of the phylogeny using geom_tiplab().

#You can plot phylogenetic trees with the ggtree function (it works just like ggplot). Note that "size=2" associated with geom_tiplab just modifies the font size
p1 <- ggtree(cov.tree) + geom_tiplab(size=2)
p1

At this point, we can see the tree structure. However, the tip labels in this case have limited information, because they are mostly just weird acronyms that researchers used to designate their samples. To address our question above, we need to add some additional information to our tree.


2.2.2. Importing Metadata

Files containing phylogenetic trees only include the names of the taxa included and the length and topology of the branches that connect them. Additional information about each sample (the so-called metadata) is stored in a separate file. You will see that the first column in the metadata file corresponds to the tip labels in the phylogeny. The metadata for this tree includes the country of origin, the host species, virus type, the authors that collected the original data, and the accession (a unique code that allows you to find the specific sample in designated databases). As other datasets you have worked with, the metadata is stored in a simple table that you can import with the read.csv() function.

#This line reads the metadata of samples included in the phylogenetic tree
cov.tree.meta<- read.csv("coronaviruses_tree_meta.csv")
cov.tree.meta

2.2.3. Annotating the Phylogenetic Tree

We can use the metadata to annotate the phylogenetic tree in a way that allows us to address our central question. In the example below, I am using the variable virus.type to color the tip of the phylogeny (adding geom_tippoint()), and rather than labeling the tips with the name of the strain, I am labeling them with the host species the virus was isolated from (using geom_tiplab()).

#This line of code simply plots the same tree as above, but without the sample label
p2 <- ggtree(cov.tree)
Warning in fortify(data, ...) :
  Arguments in `...` must be used.
✖ Problematic arguments:
• as.Date = as.Date
• yscale_mapping = yscale_mapping
• hang = hang
ℹ Did you misspell an argument name?
#This codes adds the metadata to the tree
p2 %<+% cov.tree.meta + 
  geom_tiplab(aes(label=host), size=2) +
  geom_tippoint(aes(color=virus.type), na.rm = TRUE)


2.3. Interpretation

What does the phylogeny tell you about the evolutionary origins of SARS-CoV-2, which causes the current pandemic? Discuss the findings in the context of your hypothesis.

Your answer goes here. Only humans and civets host this strain of the virus, and their closest ancestor of hosts are bats which supports my hypothesis.


3. Molecular Clock: How Fast Do Mutations Accumulate?

Unlike most previous disease outbreaks, our ability to sequence a large number of virus genomes has allowed us to literally observe the evolution of the pathogen live. Visit the the Nextstrain graphical interface to see how the pathogen spread across the globe and how mutations accumulate as different viral clades diversify.

The neutral theory predicts that mutations steadily accumulate during the course of evolution. In this section, you will analyze data from 2,625 whole-genome sequences of SARS-CoV-2 that researchers have collected all over the world. The data set includes the original isolate from December 26 2019 and representative isolates up until July 6 2022.


3.1. COVID-19 Genomes

In the first step, let’s visualize the phylogenetic relationships among all of these strains in the context of where they were collected. Hold your breath… this will be a mess:) No surprise when you plot over 2,500 data points at once!

Note this uses the same approach as above. You import the tree and the metadata. Then you plot the tree and add the metadata information to the tree. The code below is complete and should run automatically. Note that the scale bar represents the number of mutations between isolates.

#Load the phylogenetic tree
cov19.tree <- read.tree("nextstrain_ncov_open_global_6m_tree.nwk")

#Load the corresponding metadata
cov19.tree.meta <- read.csv("nextstrain_ncov_open_global_6m_metadata.csv")

#Visualize the tree and color the tips by region
#Note that I am using a fan layout here rather than the traditional layout, because it spreads out the tips more
#Depending on your monitor size, you may want to adjust the size of the tip points using the size parameter (currently set to 1.5)
p3 <- ggtree(cov19.tree, layout="fan", open.angle=10)  + geom_treescale(offset=20)
Scale for y is already present.
Adding another scale for y, which will replace the existing scale.
p3 %<+% cov19.tree.meta +
  geom_tippoint(aes(color=region), na.rm = TRUE, size=1.5)


3.2. Quantifying Mutations

To examine how mutations accumulate during virus evolution, we need to tally up the number of nucleotide substitutions for each isolate relative to the original virus. Using the phylogenetic data we have available, this is really simple, because we can sum up the length of branches that separates each isolate from the root of the tree (i.e., the original virus sequence).

The code you need to do this is really simple; it requires a single function (distRoot()). However, I do not recommend that you run this on your computer! For 2,625 genomes, this calculation takes quite a while, and depending on your hardware, it might just crash your computer. So, I already ran this analysis for you, and you can simply import the results in the next section.

##YOU DO NOT NEED TO RUN THIS! THIS TAKES A LONG TIME TO RUN. THIS CODE IS HERE FOR ILLUSTRATION ONLY, IN CASE YOU ARE INTERESTED HOW IT WORKS

#library(adephylo)
#dist <- distRoot(cov19.tree, method = "patristic")
#ncov_mutations <- merge (cov19.tree.meta, dist, by.x = "strain", by.y = 0)
#ncov_mutations$date2 <- as.Date(ncov_mutations$date, format = "%Y-%m-%d")
#ref <- as.Date("2019-12-26", format = "%Y-%m-%d")
#ncov_mutations$time <- ncov_mutations$date2-ref

3.3 Plot the Data

If we want to know how fast SARS-CoV-2 accumulates mutations over time, we can estimate the genome-wide molecular clock (i.e., the rate at which mutations occur over time). This can be done by plotting the number of mutations separating any isolate from the root as a function of time and then calculating the slope of a regression line between time (in days) and the number of mutations. We will do this using virus isolates for the first two years of the pandemic.

First, let’s import and plot the data using a scatter plot. The data file “ncov_mutations.csv” includes the number of of mutations separating any isolate from the root (calculated from the phylogeny as described above) as well as the number of days that passed between the collection of the original isolate. Remember, to draw a regression line, you can add geom_smooth(method=lm, formula= y~0+x, se=FALSE) to the code that makes a scatter plot.

#Import data
cov19.mutations <- read.csv("ncov_mutations.csv")

#Select first two years of data
cov19.mutations2 <- cov19.mutations[which(cov19.mutations$DaysSinceRoot<730),]

#Plot data
ggplot(cov19.mutations2, aes(x=DaysSinceRoot, y=Mutations)) + 
  geom_point() +
  geom_smooth(method="lm", se=FALSE, formula=y~x-1) + 
  theme_classic() + 
  xlab("Days Since Root") + 
  ylab("Mutations")


3.4. Estimate the Slope

The regression line essentially represents the average at which rate mutations accumulate. Numerically, the number of mutations per day (i.e., the slope of the regression line in the graph above) can be calculated with the code below.

#You can run a regression with the lm function, designating the relationship between the variables as "y ~ 0 + x". The 0 indicates that the regression line must go through the origin.
regression <- lm(cov19.mutations2$Mutations ~ 0 + cov19.mutations2$DaysSinceRoot)

#The slope of the regression (in number of mutations per day) can be found by calling regression$coefficients[1]. Multiplying that number by 365 gives us a substitution rate per year.
mutations.per.year <- 365*regression$coefficients[1]
mutations.per.year
cov19.mutations2$DaysSinceRoot 
                      23.89179 

3.5. Interpretation


3.5.1. General Patterns

As you evaluate the analyses in this section, what do you notice? What happened to all the viruses that were highly similar to the original samples and common in the first 100 days of the pandemic?

Your answer goes here Each virus started to collect more and more mutations.


3.5.2. Application of the Molecular Clock

The calculation of the rate of mutation accumulation was really straightforward for the first two years of the pandemic. However, let’s plot the data for the full range of the dataset. I am color coding the data for the first two years separately:

#Here, I am just making a new variable for first two years or not
cov19.mutations$group <- ifelse(cov19.mutations$DaysSinceRoot<730, "Early", "Late")

#Plot data
ggplot(cov19.mutations, aes(x=DaysSinceRoot, y=Mutations, color=group)) + 
  geom_point(aes()) +
  geom_smooth(data=subset(cov19.mutations,group=="Early"), method="lm", se=FALSE, formula=y~x-1, color="black") + 
  theme_classic() + 
  xlab("Days Since Root") + 
  ylab("Mutations")

With your knowledge of the mutation rate, how do you interpret the results? Why are there apparent jumps in the number of mutations of isolates past day 730?

Your answer goes here They are new evolutionary groups that are able to mutate faster that their ancestors.


4. Distribution of Mutations and Positive Selection

Now you saw how SARS-CoV-2 has continuously accumulated mutations as it was spreading across the globe. The next question of course is where in the viral genomes do these mutations occur?


4.1. Distribution of Mutations

Using the 2,625 genomes that were sequenced, we can literally tally up where in the genome we see the variable sites. Here, we are providing you with a data set that measured the genetic diversity at every site in the SARS-CoV-2 genome. Diversity is measured as the number of observed mutations per codon (events).

To properly visualize this type of data, it requires some R wizardry. You don’t need to know the details of how this code works, just press play and focus on interpreting the results of the graph. If you are interested in unpacking the code line by line, I’m happy to meet with you outside of class.

#Import data
diversity <- read.csv("nextstrain_ncov_open_global_6m_diversity_aa.csv")

diversity2 <- diversity %>% 
  group_by(gene) %>% 
  complete(position = 1:max(position), fill = list(events = 0))

#This is so
diversity3 <- diversity2 %>% 
  
  # Compute chromosome size
  group_by(gene) %>% 
  summarise(chr_len=max(position)) %>% 
  
  # Calculate cumulative position of each chromosome
  mutate(tot=cumsum(chr_len)-chr_len) %>%
  select(-chr_len) %>%
  
  # Add this info to the initial dataset
  left_join(diversity, ., by=c("gene"="gene")) %>%
  
  # Add a cumulative position of each SNP
  arrange(gene, position) %>%
  mutate( BPcum=position+tot)

axisdf = diversity3 %>% group_by(gene) %>% summarize(center=( max(BPcum) + min(BPcum) ) / 2 )


ggplot(diversity3, aes(x=BPcum, y=events)) + 
  geom_point( aes(color=as.factor(gene))) + scale_color_manual(values = rep(c("red", "black"), 7 )) + 
  scale_x_continuous(label = axisdf$gene, breaks= axisdf$center) +
  coord_flip()+
  theme_classic() +
  xlab("Gene") +
  ylab("Diversity") +
  theme(legend.position = "none")

As you evaluate the graph, what do you notice? How do you interpret these results in the context of neutral evolution?

Your answer goes here) Seems that most genes have very little diversity, which shows that increased diveristy would be a mutation and therefore evolution.


4.2. Detecting the Footprint of Selection

Applying the principles of the neutral theory, we can also identify what parts of the viral genome are likely under selection. In the data set below, researchers quantified ⍵ for some of the larger genes in the SARS-CoV-2 genome. ⍵ is defined as dN/dS, so it is the ratio of rate of non-synonymous mutations to the rate of synonymous mutations. Plot the values of ⍵ for the different genes using a bar graph.

#Import data
dn.ds <- read.csv("ncov_dnds.csv")

ggplot(dn.ds, aes(x=gene, y=w)) +
    geom_bar(stat="identity") +
    theme_classic() +
    xlab("Gene") +
    ylab("W")

4.3. Interpretation

Based on the information, what genes do you think are under positive selection? What do the results mean for our understanding of COVID-19?

Your answer goes here. The genes closest to positive selection is orf7a and N, however the W value needs to be over 1 in order for there to be positive selection. These results mean that most of the genes are mutating at around the same rate.


5. Resources


5.1. Data References

Phylogenetic trees and genetic diversity data of SARS-CoV-2 and other betacoronaviruses were retrieved from Nextstrain:

For additional information on Nextstrain, see:

Data for DN/DS ratios were kindly provided by Manuela Sironi and Diego Forni based on the following work:


5.2. Resources You Consulted

Consulting additional resources to solve this assignment is absolutely allowed, but failure to disclose those resources is plagiarism. Please list any collaborators you worked with and resources you used below or state that you have not used any.

Your answer goes here. https://statisticsfundamentals.com/assumptions/shapiro-wilk-test/

LS0tCnRpdGxlOiAiVGhlIE9yaWdpbnMgYW5kIE1vbGVjdWxhciBFdm9sdXRpb24gb2YgU0FSUy1Db1YtMiIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6CiAgICBmaWdfY2FwdGlvbjogdHJ1ZQogICAgdG9jOiB0cnVlCiAgICB0b2NfZGVwdGg6IDMKICAgIHRvY19mbG9hdDogdHJ1ZQogIGh0bWxfZG9jdW1lbnQ6CiAgICBrZWVwX21kOiB0cnVlCiAgcGRmX2RvY3VtZW50OgogICAgdG9jOiB0cnVlCiAgICB0b2NfZGVwdGg6ICczJwogIHdvcmRfZG9jdW1lbnQ6CiAgICB0b2M6IHRydWUKICAgIHRvY19kZXB0aDogJzMnCi0tLQoKIyMgQXV0aG9yOiBZb3VyIG5hbWUgYW5kIHN0dWR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