Bram van Dijk . org

Studying microbial ecology and evolution across multiple levels

Javascript programming – Part III (Game of Life)

Now that Javascript is set up, we could implement more boring programs that print stuff to the console. As discussed in my introduction, however, the benefit of javascript is how easy it is to visualise/debug stuff that is less boring. To that end, I’m implementing a famous Cellular Automaton (CA) next. It was first described by John Horton Conway in 1970, and it looks cool. It does more than look cool, however, as its interesting properties have kept scientists busy for decades. I should say up front that the implementation of Game of Life described below is directly based on a video of the Youtube channel The Coding Train.

Continue reading

Javascript programming – Part II (My setup)

Javascript and Node.js

As you may suspect by the name, Javascript is a scripting language. The word script is typically used to describe small programs that are designed to perform simple tasks. However, I found that Javascript can actually be used to efficiently execute rather complex tasks too. While Javascript natively runs within a browser (making visualisation etc. very easy), the Node.js runtime environment allows one to run it outside of the browser too. However, Node.js also comes with a slightly different synthax. Fortunately, we don’t have to bother with all these syntax changes ourselves if we get the setup right. There are probably multiple ways to do this, but below I show you my setup with Visual Studio Code.

Continue reading

Javascript programming – Part I (Introduction)

As someone who frequently programs (relatively) complex biological models, I frequently rely on direct visual feedback. Visualisations can not only help to quickly see the results of my program, but also allows the debugging of strange behaviour. However, such visualisation can really slow things down, and I have therefore always stuck with programming in C with the lightning-fast X11 library.
However, both C and X11 are as dated as they are hard to work with. Moreover, every operating system needs a different compiler for the C code, while support for X11-library is waning. Rarely does a piece of C-code simply run “out of the box”.

Continue reading

Tips for visualising grid-data in ggplot2

As someone who works primarily with models in which individuals have spatial coordinates, I have struggled a lot with visualising these systems. If you are using similar models, or biological data sets that have a similar structure of datapoints with x- and y-coordinates, here’s a few things I’ve picked up to make them prettier.

But first, let’s start at step 0, and read some data…

Continue reading
« Older posts