Code associated with Pers et al. Nature Communications 2014.