Data and code from: Parasites alter host community structure in a natural experiment
Data files
Apr 24, 2026 version files 12.87 MB
-
killifish-guppy-parasite-mark-recapture-final.zip
12.86 MB
-
README.md
10.45 KB
Abstract
Parasites can profoundly alter host communities. However, the impact of parasites can vary from one community to another. Understanding why the impact of parasites varies across communities is challenging because it requires (i) separating the direct effects of the parasite on the host species from the indirect effects it exerts through the ecological interactions among the hosts, and (ii) identifying how the presence of one host alters rates of infection in another. Freshwater fish communities in Trinidad have recently been invaded by a generalist parasitic nematode. This event, combined with our long-term mark-recapture studies of these communities, which began long before the invasion, presented a replicated natural experiment. In this experiment, we measured how host demographic rates responded to two “treatments”: stage of parasite establishment (before, and 1-2 years, 3-5 years, and 6-8 years after invasion) and type of community (killifish-guppy communities and killifish-only communities). This design allowed us to infer the direct and indirect impacts of the parasite invasion on killifish communities and determine how the presence of guppies altered infection rates in killifish. The parasitic invasion drastically altered killifish-guppy communities: the ratio of killifish to guppies changed from 1:2 before the invasion to 1:16 after the invasion. Living with guppies amplified the effects of the parasite on killifish, such that parasite-related mortality rates of large adult killifish were twice as high in communities with guppies compared to those without. This effect was driven by a doubling of infection rates in large killifish that live with guppies. In a parallel study, we identified the same patterns of size- and community-dependent infection rates of killifish in five separate river systems, implying that this pattern is general in this system. Our study provides mechanistic insight into how parasites alter community structure under natural conditions, via their direct and indirect impacts on host demographic rates. Our work highlights the value of long-term field studies for our understanding of the impact of parasites on community structure and of ecological interactions in general.
Data and code to reproduce the analyses and figures presented in the manuscript "Parasites alter host community structure in a natural experiment," published in the Journal of Animal Ecology. The datasets include mark-recapture observations of guppies and killifish from four streams in Trinidad. There is another dataset that includes dissection data from guppies and killifish from several more streams in Trinidad. Please see the READ-ME.txt file for details on the contents of the code and data files.
OVERVIEW
The zip file: killifish-guppy-parasite-mark-recapture-final.zip
contains the data and R code to reproduce the analyses in the manuscript:
“Parasites alter host community structure in a natural experiment”
published in the Journal of Animal Ecology
by Tomos Potter, Ryan S. Mohammed, Joshua F. Goldberg, Joseph Travis, David N. Reznick, and Ron D. Bassar
...which is a paper about the impact of an invasive parasitic nematode on the population densities and demographic rates of killifish and guppies living in two community types in streams in a beautiful rainforest in Trinidad. You should give it a read!
IMPORTANT: To run this code, you will first need to download and install Program Mark, which is freely available here: http://www.phidot.org/software/mark/downloads/
You won't have to open Program Mark yourself - all work is done via R, using the RMark() package to interface with the external software.
Note that the scripts use relative pathways to access data, call other scripts, save output etc, so please keep the same file names and structure as in this repository if you want everything to run nice and smooth.
If you have any questions, please contact me: tomos.potter{AT}protonmail.com
CONTENTS
The main repository contains the following files and folders:
Files:
- killifish-guppy-parasite-mark-recapture.Rproj
The RStudio project file for this project. Click on it to launch the project in RStudio
- READ-ME.Rmd
The read-me file, yes, the very thing that you are reading right now
- MAIN-SCRIPT.R
This script runs the full analysis by calling all the other scripts, loading the data, running the models, saving the results to file, plotting the figures etc. This is the only script you need to run to generate the results
Folders:
- DATA
Contains the four data files used in the analyses (.csv), plus two images used in the figures (.png):
1. killifish-mr-data.csv
mark-recapture data for killifish with the following columns:
- individual_id: unique identifier for individuals (factor)
- sampling: months since initial introduction of guppies (integer, in units of calendar months)
- FishID: represents the identifier of a fish based on its elastomer tattoo (factor)
- capture_date: date the fish was caught (date: month/day/year - yes, I know, you try working with Americans)
- processing_date: date the fish was processed in the lab (date: month/day/year)
- location: location within the stream that the fish was caught (factor)
- sex_stage: sex or stage of individual (factor levels: I = immature (too small to identify sex), F = female, M = male)
- SL: standard length (distance from tip of snout to posterior of caudal peduncle; N.B. NA reflects that SL was not recorded prior to 2022)
- TL: total length (distance from tip of snout to posterior of tail in units of mm)
- weight: wet weight (in units of grams)
- Dead: logical indicator of whether a fish was known to have died after processing (0 = alive, 1 = dead)
- comments: comments recorded during processing
- stream: identity of stream (factor levels: CA = Caigual; TY = Taylor)
- sex: duplicate of sex_stage column, reserved for posterity
- sampling.year: years since 2000 AD that sampling of fish took place
- sampling.month: month of the year that sampling took place
- sampling.day: day of the month that sampling took place
- Habitat: community type of sampling (factor levels: C = control a.k.a killifish-only; I = introduction a.k.a killifish-guppy)
- parasite: was the fish visibly parasitised? (logical: 0 = no, 1 = yes)
2. guppy-mr-data.csv
mark recapture data for guppies with the following columns:
- stream: identity of stream (factor levels: CA = Caigual; TY = Taylor)
- sampling: months since initial introduction of guppies (integer, in units of calendar months)
- individual_id: unique identifier for individuals (factor)
- capture_date: date the fish was caught (date: month/day/year)
- processing_date: date the fish was processed in the lab (date: month/day/year)
- location: location within the stream that the fish was caught (factor)
- sex_stage: sex or stage of individual (factor levels: I = immature (too small to identify sex), F = female, M = male)
- weight: wet weight (in units of grams)
- Dead: logical indicator of whether a fish was known to have died after processing (0 = alive, 1 = dead)
- comments: comments recorded during processing
- FishID: represents the identifier of a fish based on its elastomer tattoo (factor)
- sampling.year: years since 2000 AD that sampling of fish took place
- sampling.month: month of the year that sampling took place
- sampling.day: day of the month that sampling took place
- sex: duplicate of sex_stage column, reserved for posterity
- parasite: was the fish visibly parasitised? (logical: 0 = no, 1 = yes)
3. dissection-data.csv
data from dissected fish with the following columns:
- species: species name of focal individual (factor levels: killifish, guppy)
- drainage: drainage a.k.a watershed of site (factor levels: Aripo, Guanapo)
- stream: name of stream (factor levels: El Cedro, Endler, Lower Lalaja, Naranjo, Upper Lalaja)
- community: community type of site (factor levels: KO = killifish only, KG = killifish-guppy)
- sample_id: unique identifier for individual fish
- date_sampled: date fish was captured (month/day/year)
- date_processed: date fish was processed in the lab (month/day/year)
- measured_by: initials of the person who performed the dissection
- sex_stage: sex or stage (factor levels: I = immature (too small to identify sex), F = female, M = male)
- sl: standard length (distance from tip of snout to posterior of caudal peduncle in units of mm)
- tl: total length (distance from tip of snout to posterior of tail in units of mm, N.B. tl is not recorded for guppies)
- weight: wet weight (in grams)
- parasite_visible_externally: was parasitic infection visible before dissection? (factor levels: 1 = yes, 0 = no )
- infected: infection status (factor levels: 1 = infected, 0 = uninfected)
N.B. empty cells indicate that data was not recorded - these are treated as NAs in the code
4. stream-data.csv
data on stream area to calculate population densities with the following columns:
- stream: focal stream identity (factor levels: CA = Caigual, TY = Taylor)
- habitat: community type (factor levels: C = control, i.e. killifish-only; I = introduction, i.e. killifish-guppy)
- period: period of study (factor levels: 1 = 2015-2016; 2 = 2017-2018; 3 = 2022-2024)
- stream_length: length of stream in metres
- stream_area: area of stream in metres squared
5. killifish_silhouette.png (killifish image used in figures)
6. guppy_silhouette.png (guppy image used in figures)
- OUTPUT
This is where model outputs, tables of results, and figures are saved to. I have included all of the output here so you can examine them if you like without having to run the models (i.e. if you don't have the time or don't want to download Program Mark). There is a lot of stream-specific output, I.e. either from Caigual (CA) or Taylor (TY). If you run the main script, it will save over the files that are present here.
There are two sub-folders: figures, and results.
- FIGURES
This is where the figures in the manuscript are saved to when you run the code, the file names will correspond to those in the manuscript
- RESULTS
Here you will find 25 (!) output objects: 12 model objects (with extension .Rda), and 13 .csv files of results / parameter estimates. If you run the code again, you will write over these files.
- AICCA.csv (killifish POPAN AIC table for CA)
- AICCAsize.csv (killifish Multistrata AIC table for CA)
- AICTY.csv (killifish POPAN AIC table for TY)
- AICTYsize.csv (killifish Multistrata AIC table for TY)
- G-AICCA.csv (guppy POPAN AIC table for CA)
- G-AICTY.csv (guppy POPAN AIC table for TY)
- G-POPAN-models-CA.Rda (guppy POPAN models for CA)
- G-POPAN-models-TY.Rda (guppy POPAN models for TY)
- G-POPAN-parameters.csv (results: guppy POPAN parameters)
- G-POPAN-results-CA.Rda (all guppy POPAN results for CA)
- G-POPAN-results-TY.Rda (all guppy POPAN results for TY)
- guppy-infection-rate-dissection.csv (results from guppy dissection)
- guppy-infection-rate-focal.csv (guppy infection rate in CA and TY)
- killifish-infection-rate-dissection.csv (results from killifish dissection)
- killifish-infection-rate-focal.csv (killifish infection rate in CA and TY)
- Multistrata-models-CA.Rda (all killifish Multistrata models for CA)
- Multistrata-models-TY.Rda (all killifish Multistrata models for TY)
- Multistrata-parameters.csv (results: killifish Multistrata parameters)
- Multistrata-results-CA.Rda (results: killifish Multistrata final model for CA)
- Multistrata-results-TY.Rda (results: killifish Multistrata final model for TY)
- POPAN-estvarcov-CA.Rda (variance-covariance for model final model for CA)
- POPAN-estvarcov-TY.Rda (variance-covariance for model final model for TY)
- POPAN-models-CA.Rda (all killifish POPAN models for CA)
- POPAN-models-TY-.Rda (all killifish POPAN models for TY)
- POPAN-parameters.csv (results: killifish POPAN parameters)
- SUB-SCRIPTS
This contains 6 R scripts, which are called by MAIN-SCRIPT.R
- POPAN-killifish.R (runs the POPAN models for killifish)
- POPAN-guppies.R (runs the POPAN models for guppies)
- Multistrata-killifish.R (runs the Multistrata models for killifish)
- Parasite-prevalence.R (runs analysis of parasite prevalence in both species)
- Figures.R (unsurprisingly, this one makes the figures)
