Preparation
Here are steps to get ready for the tutorial.
install julia
- install Julia and add it to your
PATH
- install VSCode or another editor, if you don’t have one already.
- install R
customize VSCode
If you use VSCode, like we will demonstrate, then within VSCode:
- add
code
to yourPATH
, by opening the command palette (⇧⌘P or Ctrl+Shift+P) then searching for “shell command”. After this step, you can open any folder or document with VSCode by typingcode filename
orcode foldername
in the shell. - within VSCode, install the Julia extension
- you may consider installing Quarto extension but this is not necessary for this tutorial —or other cool extensions! e.g. for R, for Python, for LaTeX, etc.
download tutorial files
Download the data and other files for this tutorial. Below we explain 2 alternatives ways: using the shell, or not.
- using the shell and cloning with git:
- In the shell, navigate (
cd
) to a place on your machine where you want to get the folder.
This should not be inside an already existing git repository. To know if we are inside a git folder, we can dogit status
. We want to get an error message, which would mean that we are not in a git repo.
- clone the tutorial files with:
git clone https://github.com/juliaphylo/networkPCM-tutorial.git
. This command will create a foldernetworkPCM-tutorial
with the data and.qmd
(quarto markdown) files containing the code rendered on this website. - go into that folder:
cd networkPCM-tutorial
- In the shell, navigate (
- without the shell:
- download the folder and unzip it. Its default name may be
networkPCM-tutorial-main
. - move it somewhere and/or rename it if desired, to organize your projects
- open that folder or go inside, or open it with VSCode.
- download the folder and unzip it. Its default name may be
The data are in folder data
. The code is in files named like topic*.qmd
.
install packages
Open julia, e.g. in a terminal integrated in VSCode. Preferably, open julia from the tutorial directory (cloned or downloaded earlier) to make it easier to use this directory as a julia environment.
Then within julia, install PhyloNetworks v0.16 (see below to install this particular version). Also install other packages, including: PhyloPlots. For this, we suggest using the environment provided in this tutorial, which consists of the two .toml
files that lists which packages to install (in Project.toml
) and which versions exactly (in Manifest.toml
). These installations will not interfere with other ways you might be using julia. Here is how:
- type
]
to switch to package mode - type
activate .
if your current directory is the tutorial folder. Otherwise, typeactivate path-to-tutorial-folder
to activate the tutorial folder as the current julia environment for packages. - type
instantiate
: this command will read the.toml
files and install the packages given by these files, at the specific versions listed in these files. It will pre-compile them for the environment, in a way that won’t interfere with other julia environments (if any).
Alternatively, if you want to install these packages in the default or any other environment, type ]
to switch to package mode. Julia will show a prompt like this: (networkPCM-tutorial) pkg>
showing the name of the folder used as environment, followed by “pkg>” to mean that it’s in package mode. Then type this:
add CSV, CategoricalArrays, DataFrames
add Distributions, StatsBase, StatsModels
add RCall0.16.4
add PhyloNetworks@# do this after adding PhyloNetworks v0.16, to install a compatible version add PhyloPlots
Installation may take a while, especially if internet is slow.
After this is done, type delete or backspace to go back to julian mode (exit from package mode). The julia prompt will go back to julia>
.
We will make use of R within Julia, and of some R functions in specific R packages. Install the ape
and viridis
packages in R:
> install.packages("viridis")
R> install.packages("ape") R