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
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
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
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.
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.
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.
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.
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
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)
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.
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.
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)
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
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")
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
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.
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.
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?
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.
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")
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.
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:
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/