Welcome to the Tutorials
This set of tutorials is designed to help you use an integrated coding tool, VSCode, to run experiments with the Bioenergetic Foodweb Model, built in the coding language Julia.
It will cover four core objectives
- Acquire/install the
Julia
programming language, the Integrated Development Environment calledVSCode
. - Learn how to work with
Julia
programming, from installing packages to understanding arithmetic and plotting and data frames - Learn how to simulate a simple predator-prey (consumer-resource) model using the
DifferentialEquations
package in Julia - Learn how to implement and use the multi-species
EcologicalNetworksDynamics
in Julia
Having done these, you will then be introduced to further complexities and opportunities.
Moving from R and RStudio to Julia and VSCode
For users of R and RStudio, VSCode and Julia can be thought of as the same working team, i.e. VSCode/RStudio are the text editors that allow you to create a ‘rich text’ environment from which to run Julia/R. That being said (as to be expected) there are a few differences in the workflow that it might be worth familiarising yourself with. You can also keep Table 1 handy to help with getting over the first initial stumbling blocks.
RStudio users might be familiar with the concept of working with projects (i.e. a way of ‘containerising’ your work within a specific directory), Julia works in a similar manner. Broadly a Julia project is much more localised in that any packages that you use (install) are downloaded locally for that specific project (environment), meaning that it is possible to have multiple versions of a package installed for different projects - which is very handy from a reproducibility perspective. The details of the packages (dependencies) that you install are recorded in the Project.toml
(a records of packages that have been installed and their versions - very useful when sharing code as any user can see exactly what version of a package has been used) and the Manifest.toml
(all the package dependencies installed - i.e. packages that for a part of the other packages that you have installed) files, these files are machine generated and will update as you add or removed packages while you work so you don’t need to worry too much about interacting with them but its good to know what they mean/do. For an R specific analogy these files can be thought as the equivalents of the renv.lock
file generated from the {renv}
package.
action | R | Julia |
---|---|---|
checking current working directory | getwd() | pwd() |
install a package | install.package(“PACKAGE_NAME”) | Pkg.add(“PACKAGE_NAME”)
|
call/import a package | library(PACKAGE_NAME) | using PACKAGE_NAME |
resolving naming conflicts (functions from different packages with the same name) | PACKAGE_NAME::function() | PACKAGE_NAME.function() |
calling column from dataframe | df$COL_NAME | df.COL_NAME |
calling the first elements of a dataframe | head() | first() |
calling the last elements of a dataframe | tail() | last() |
How to use these tutorials
The simple idea here is to make a Julia script and add the code in these tutorials to your scripts. Make sure you annotate using the #
symbol, as we do in R Scripts. We suggest that You have a script associated with each section of the table of contents on the left.