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 “Making YOUR Code Reproducible: Tips and Tricks”

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 “A Guide to Reproducible Code in Ecology and Evolution”

How Can We Quantify the Strength of Migratory Connectivity?

Technological advancements in the past 20 years or so have spurred rapid growth in the study of migratory connectivity (the linkage of individuals and populations between seasons of the annual cycle). A new article in Methods in Ecology and Evolution provides methods to help make quantitative comparisons of migratory connectivity across studies, data types, and taxa to better understand the causes and consequences of the seasonal distributions … Continue reading How Can We Quantify the Strength of Migratory Connectivity?

Sticking Together or Drifting Apart? Quantifying the Strength of Migratory Connectivity

Post provided by Emily Cohen

Red Knot migratory connectivity is studied with tracking technologies and color band resighting. © Tim Romano
Red Knot migratory connectivity is studied with tracking technologies and colour band resighting. © Tim Romano

The seasonal long-distance migration of all kinds of animals – from whales to dragonflies to amphibians to birds – is as astonishing a feat as it is mysterious and this is an especially exciting time to study migratory animals. In the past 20 years, rapidly advancing technologies  – from tracking devices, to stable isotopes in tissues, to genomics and analytical techniques for the analysis of ring re-encounter databases – mean that it’s now possible to follow many animals throughout the year and solve many of the mysteries of migration.

What is Migratory Connectivity?

One of the many important things we’re now able to measure is migratory connectivity, the connections of migratory individuals and populations between seasons. There are really two components of migratory connectivity:

  1. Linking the geography of where individuals and populations occur between seasons.
  2. The extent, or strength, of co-occurrence of individuals and populations between seasons.

Continue reading “Sticking Together or Drifting Apart? Quantifying the Strength of Migratory Connectivity”

The Power of Infinity: Using 3D Fractal Geometry to Study Irregular Organisms

Post provided by Jessica Reichert, André R. Backes, Patrick Schubert and Thomas Wilke

The Problem with the Shape

More than anything else, the phenotype of an organism determines how it interacts with the environment. It’s subject to natural selection, and may help to unravel the underlying evolutionary processes. So shape traits are key elements in many ecological and biological studies.

The growth form of corals is highly variable. ©Jessica Reichert
The growth form of corals is highly variable. ©Jessica Reichert

Commonly, basic parameters like distances, areas, angles, or derived ratios are used to describe and compare the shapes of organisms. These parameters usually work well in organisms with a regular body plan. The shape of irregular organisms – such as many plants, fungi, sponges or corals – is mainly determined by environmental factors and often lacks the distinct landmarks needed for traditional morphometric methods. The application of these methods is problematic and shapes are more often categorised than actually measured.

As scientists though, we favour independent statistical analyses, and there’s an urgent need for reliable shape characterisation based on numerical approaches. So, scientists often determine complexity parameters such as surface/volume ratios, rugosity, or the level of branching. However, these parameters all share the same drawback: they are delineated to a univariate number, taking information from one or few spatial scales and because of this essential information is lost. Continue reading “The Power of Infinity: Using 3D Fractal Geometry to Study Irregular Organisms”

Microbial Methods Virtual Issue

The BES Microbial Ecology Special Interest Group is running a workshop today (Thursday 2 November) on Novel Tools for Microbial Ecology. To compliment this workshop, Xavier Harrison has edited a Virtual Issue of the best Methods in Ecology and Evolution articles on advances in methods of studying microbial evolution and ecology from the past few years.

Advances in Next-Generation Sequencing (NGS) technology now allow us to study associations between hosts and their microbial communities in unprecedented detail. However, studies investigating host-microbe interactions in the field of ecology and evolution are dominated by 16S and ITS amplicon sequencing. While amplicon sequencing is a useful tool for describing microbial community composition, it is limited in its ability to quantify the function(s) performed by members of those communities. Characterising function is vital to understanding how microbes and their hosts interact, and consequently whether those interactions are adaptive for, or detrimental to, the host. The articles in this Virtual Issue cover a broad suite of approaches that allow us to study host-microbe and microbe-microbe interactions in novel ways.

All of the articles in the Microbial Methods Virtual Issue will be freely available for the next two months. You can find out a little more about each one below. Continue reading “Microbial Methods Virtual Issue”

Phylogenies, Trait Evolution and Fancy Glasses

Post provided by Daniel S. Caetano

Phylogenetic trees represent the evolutionary relationships among different lineages. These trees give us two crucial pieces of information:

  1. the relationships between lineages (which we can tell from the pattern of the branches (i.e., topology))
  2. the point when lineages separated from a common ancestor (which we can tell from the length of the branches, when estimated from genetic sequences and fossils).
Phylogeny of insects inferred from genetic sequences showing the time of divergence between ants and bees.
Phylogeny of insects inferred from genetic sequences showing the time of divergence between ants and bees.

As systematic biologists, we are interested in the evolutionary history of life. We use phylogenetic trees to uncover the past, understand the present, and predict the future of biodiversity on the planet. Among the tools for this thrilling job are the comparative methods, a broad set of statistical tools built to help us understand and interpret the tree of life.

Here’s a Tree, Now Tell Me Something

The comparative methods we use to study the evolution of traits are mainly based on the idea that since species share a common evolutionary history, the traits observed on these lineages will share this same history. In the light of phylogenetics, we can always make a good bet about how a species will look if we know how closely related it is to another species or group. Comparative models aim to quantify the likelihood of our bet being right and use the same principle to estimate how fast evolutionary changes accumulate over time. Continue reading “Phylogenies, Trait Evolution and Fancy Glasses”

Issue 8.8

Issue 8.10 is now online!

The October issue of Methods is now online!

This double-sized issue contains three Applications articles and two Open Access articles. These five papers are freely available to everyone, no subscription required.

 Phylogenetic TreesThe fields of phylogenetic tree and network inference have advanced independently, with only a few attempts to bridge them. Schliep et al. provide a framework, implemented in R, to transfer information between trees and networks.

 Emon: Studies, surveys and monitoring are often costly, so small investments in preliminary data collection and systematic planning of these activities can help to make best use of resources. To meet recognised needs for accessible tools to plan some aspects of studies, surveys and monitoring, Barry et al. developed the R package emon, which includes routines for study design through power analysis and feature detection.

 Haplostrips: A tool to visualise polymorphisms of a given region of the genome in the form of independently clustered and sorted haplotypes. Haplostrips is a command-line tool written in Python and R, that uses variant call format files as input and generates a heatmap view.

Continue reading “Issue 8.8”

Valuing Nature the Interdisciplinary Way

Post provided by Graziella Iossa

Before I started my NERC Valuing Nature Placement in April 2017, I’d never done interdisciplinary work. I had been thinking about it for a while though, when I read on Twitter that the Valuing Nature Programme were launching their placement scheme for 2017. I had already been in touch with my prospective hosts – Hilary Graham, Department of Health Science, and Piran White, Environment Department, both at the University of York – but the launch of the scheme galvanised our interest. We put together our application and were delighted to receive funding. So, what is that we set out to do?

Valuing Nature

Piran, Hilary and I had already been talking about projects focusing on knowledge transfer, particularly around collaborative work to tackle antimicrobial resistance. Valuing Nature was the perfect fit for what we wanted to do. The programme aims to further our understanding of nature in valuation analyses and decision making by building an interdisciplinary research community capable of working across the natural, biological and social sciences, as well as the arts and humanities. Interdisciplinarity is integral to the programme. Continue reading “Valuing Nature the Interdisciplinary Way”

Issue 8.8

Issue 8.8 is now online!

The August issue of Methods is now online!

This issue contains two Applications articles and two Open Access articles. These four papers are freely available to everyone, no subscription required.

 Paco: An R package that assesses the phylogenetic congruence, or evolutionary dependence, of two groups of interacting species using both ecological interaction networks and their phylogenetic history.

 Open MEE: Open Meta-analyst for Ecology and Evolution (Open MEE) addresses the need for advanced, easy-to-use software for meta-analysis and meta-regression.It offers a suite of advanced meta-analysis and meta-regression methods for synthesizing continuous and categorical data, including meta-regression with multiple covariates and their interactions, phylogenetic analyses, and simple missing data imputation.

Continue reading “Issue 8.8”