Making YOUR Code Reproducible: Tips and Tricks

When we were putting together the British Ecological Society’s Guide to Reproducible Code we asked the community to send us their advice on how to make code reproducible. We got a lot of excellent responses and we tried to fit as many as we could into the Guide. Unfortunately, we ran out of space and there were a few that we couldn’t include.

Luckily, we have a blog where we can post all of those tips and tricks so that you don’t miss out. A massive thanks to everyone who contributed their tips and tricks for making code reproducible – we really appreciate it. Without further ado, here’s the advice that we were sent about making code reproducible that we couldn’t squeeze into the Guide:

Organising Code

©Leejiah Dorward

“Don’t overwrite data files. If data files change, create a new file. At the top of an analysis file define paths to all data files (even if they are not read in until later in the script).” – Tim Lucas, University of Oxford

“Keep one copy of all code files, and keep this copy under revision management.” – April Wright, Iowa State University

“Learn how to write simple functions – they save your ctrl c & v keys from getting worn out.” – Bob O’Hara, NTNU

For complex figures, it can make sense to pre-compute the items to be plotted as its own intermediate output data structure. The code to do the calculation then only needs to be adjusted if an analysis changes, while the things to be plotted can be reused any number of times while you tweak how the figure looks.” – Hao Ye, UC San Diego Continue reading


A Guide to Reproducible Code in Ecology and Evolution

Post provided by Natalie Cooper and Pen-Yuan Hsing

Cover image by David J. Bird

The way we do science is changing — data are getting bigger, analyses are getting more complex, and governments, funding agencies and the scientific method itself demand more transparency and accountability in research. One way to deal with these changes is to make our research more reproducible, especially our code.

Although most of us now write code to perform our analyses, it’s often not very reproducible. We’ve all come back to a piece of work we haven’t looked at for a while and had no idea what our code was doing or which of the many “final_analysis” scripts truly was the final analysis! Unfortunately, the number of tools for reproducibility and all the jargon can leave new users feeling overwhelmed, with no idea how to start making their code more reproducible. So, we’ve put together the Guide to Reproducible Code in Ecology and Evolution to help. Continue reading

New Associate Editor: Will Pearse

Today, we are pleased to be welcoming a new member of the Methods in Ecology and Evolution Associate Editor Board. Will Pearse joins us from McGill University in Canada and you can find out a little more about him below.

Will Pearse

“I am an evolutionary ecologist and use phylogeny to link the evolution of species’ traits with their ecological community assembly. I’m interested in phylogenetic methods, macro-evolution of species’ traits, community assembly and developing new statistical tools for all of the above.”

Will is a former winner of the Robert May Early Career Researcher Award. He won the prize in 2013 for his Applications article ‘phyloGenerator: an automated phylogeny generation tool for ecologists‘ (co-authored with Andy Purvis). phyloGenerator is an open-source, stand-alone Python program, that makes use of pre-existing sequence data and taxonomic information to largely automate the estimation of phylogenies. He has also recently had a paper on a R package that allows for measurement, modelling and simulation of phylogenetic structure in ecological data published in Bioinformatics. The article, ‘pez: phylogenetics for the environmental sciences‘, was co-authored with Marc CadotteJeannine Cavender-BaresAnthony IvesCaroline TuckerSteve Walker and Matthew Helmus.

We are thrilled to welcome Will as a new Associate Editor and we look forward to working with him on the journal.

NLMpy: a python software package for the creation of neutral landscape models

In this video Thomas Etherington shows how to use the NLMpy Python package to create neutral landscape models.  The video demonstrates how the paper’s Supporting Information documentation, Python scripts, and GIS data can be used to create a the example neutral landscape models that are shown in the paper.

Recognising that some ecologists may not be very familiar with Python, the authors have also created a video that provides some advice about choosing a suitable scientific distribution of Python, and demonstrates how to install the NLMpy package itself.

Recent content and new video

Lots of exciting content has recently gone online.

Firstly, two interesting new applications (as always free): simapse, simulation maps for ecological niche modelling in Python and nadiv, an R package for estimating non-additive genetic variances in animal models.

Also, two research articles. In the first, Julien Beguin and colleagues introduce an alternative procedure for fitting Bayesian hierarchical spatial models (BHSM) with quite general spatial covariance structures. This procedure uses integrated nested Laplace approximations (INLA) as an alternative to MCMC. In the second, Martin Lavoie, Jen Owens and Dave Risk present a new method for real-time monitoring of soil CO2 efflux.This is attractive because of its low cost and low power consumption compared to traditional methods.

Lastly, Dan Mennill and co-authors show us an affordable, portable, wireless microphone array for spatial monitoring of animal ecology and behaviour. They accompany their article with a nice short video: