Investigating the consequences of the mating system for drug resistance evolution in C. elegans
Data files
Jun 27, 2025 version files 1 GB
-
AnalyzeClusterData.ipynb
3.21 MB
-
CombinedDataL2.zip
114.34 MB
-
CombinedDataL6.zip
876.47 MB
-
DataMerger.py
1.86 KB
-
FitnessFigures.ipynb
404.70 KB
-
MatingWormsCluster.ipynb
4.97 KB
-
PlottingClusterData.ipynb
4.76 MB
-
README.md
5.29 KB
-
ScanningXi.ipynb
836.84 KB
-
ShowExtinction.ipynb
713.25 KB
-
WormFunctionsMating.py
40.44 KB
Abstract
The rise of anthelmintic-resistant strains in livestock threatens both animal and human health. Understanding the factors influencing anthelmintic resistance is crucial to mitigate the threat posed by these parasites. Due to difficulties in studying parasitic worms in the laboratory, the non-parasitic nematode Caenorhabditis elegans is used as a model organism to investigate anthelmintic resistance evolution. However, the suitability of this free-living nematode as a model for parasitic worms is debatable due to its rare androdioecious reproductive system, raising questions about the generalizability of findings from evolutionary experiments in C. elegans to other species. In this study, we developed a polygenic, population genetic model combined with pharmacodynamic approaches to investigate the effects of reproductive strategy and other aspects, such as dominance, mutational effects, the number of loci, and population size, on determining the dynamics and outcome of evolutionary processes. We found that androdioecious populations showed both rapid initial adaptation typical for hermaphrodites and tolerance to high drug concentrations observed in dioecious populations. They also exhibited the highest diversity and shortest time for the fixation of the beneficial allele. These results suggest that androdioecious populations can harness the advantages of both selfing and outcrossing, optimizing their reproductive strategy in response to drug selection.
Dataset DOI: 10.5061/dryad.fqz612k4h
Description of the data and file structure
There are two main types of data, all described in detail below.
1) Python code used to generate all the data used in the article, ending .ipynb or .py.
- DataMerger.py
- AnalyzeClusterData.ipynb
- MatingWormsCluster.ipynb
- PlottingClusterData.ipynb
- WormFunctionsMating.py
- FitnessFigures.ipynb
- ScanningXi.ipynb
- ShowExtinction.ipynb
2) Simulated data in .npy format, readable by Python.
- CombinedDataL2.zip (114.34 MB)
- CombinedDataL6.zip (876.47 MB)
Code:
The Python code was written in Python 3 in Jupyter Notebook.
Necessary packages: sys, numpy, matplotlib and WormFunctionsMating.py
WormFunctionsMating.py
This is the main file containing all the classes (e.g. Experiment, Population) that are necessary to run the simulations. This file needs to be placed in the same directory as the following file MatingWormsCluster[2].ipynb for simulations to be run.
MatingWormsCluster.ipynb and MatingWormsCluster2Loci.ipynb
These are the two files that can run simulations for situations with 6 and 2 loci, respectively, by calling functions defined in WormFunctionsMating.py. They define the parameters of the individual experiment and call the necessary functions to run it: all details of the experiments are encoded here. Individual outputs of the simulations are saved in individual files.
Data saved are time courses of population sizes of male and hermaphrodite subpopulations, concentrations, dilutions and mutant frequencies. Generations are also saved in files.
DataMerger.py
This code merges batches of individual output data repeats (generated by MatingWormsCluster.ipynb ) together for future manipulation. Repeats that should be merged together are defined within the file by specifying the parameters of the experiment for which the merging is performed.
The files are saved as
name+’N’+(N)+’L’+(L)+’E’+(E)+’X’+(X)+’D’+(D)+’all’+(data name)
where
name is your desired name preposition
N is the population size
L is the number of loci
E is epistasis
X is the fraction of mating hermaphrodites
D is dominance.
These variables uniquely define a simulated scenario. Data name describes type of data saved:
frequency (allele frequency of individual mutations),
dilutions (needed to restore populations to the original size),
time (generation count),
concentration (concentration at which the worms were surviving at a given time), dynamics_h (population sizes of hermaphrodites)
dynamics_m (population sizes of males).
For your convenience, data outputs from DataMerger.py are provided in this depository, as described below.
The following scripts use data generated by DataMerger.py for calculations and plotting.
AnalyzeDataCluster.ipynb
This code takes the outputs of DataMerger.py and calculates and plots relevant statistics and observations.
ScanningXi.ipynb
This script loads data created by DataMerger and analyses the effect of the fraction of hermaphrodites on the drug concentration that worms adapted to. It creates figures saved as ‘FigFirstToFixVaryXL’+(L)+’D’+(D)+’NAll.png’ where L is the number of loci (2 or 6) and D is dominance (0 for recessive and 1 for dominant).
FitnessFigures.ipynb
This is a script that allows plotting fitness figures based on the experiment parameters, defined within the file.
ShowExtinctions.ipynb
This script allows for the reproduction of preliminary simulations testing the extinction and survival of worms at various concentrations, depending on the steepness of the concentration increase.
Data
CombinedData2.zip contains simulation data for two-loci scenarios
CombinedData6.zip contains simulation data for six-loci scenarios
These data are outputs of DataMerger.py, which merges outputs from individual repeats together for easier manipulation. These data can be directly used by AnalyzeDataCluster.ipynb and ScanningXi.ipynb for analysis, to produce figures shown in the manuscript.
Name convention is as follows:
WormsT500+‘N’+(N)+’L’+(L)+’E’+(E)+’X’+(X)+’D’+(D)+’all_’+(data name)*
where
N is the population size (200, 2000, 20 000 or 200 000)
L is the number of loci (2 or 6)
E is epistasis (0 in all simulated cases)
X is the fraction of mating hermaphrodites (range from 0 to 1 in 0.1 increments)
D is dominance (0 for recessive mutation, 1 for dominant mutation).
These variables uniquely define a simulated scenario, and the files contain all the repeats for the respective scenario. The following data are included:
frequency (allele frequency of individual mutations),
dilutions (needed to restore populations to the original size),
time (generation count),
concentration (concentration at which the worms were surviving at a given time), dynamics_h (population sizes of hermaphrodites)
dynamics_m (population sizes of males).
Sharing/Access information
The code is also available at: https://github.com/Trubenova/MatingSystemCelegans