Skip to content

statbiophys/paper-viral-immune-coevo-theory

Repository files navigation

Antigenic waves of virus-immune co-evolution

This repository contains the source code associated with the manuscript

Marchi, Laessig, Walczak, Mora: Antigenic waves of virus-immune co-evolution 2021

It allows reproduction of all figures of the manuscript from pre-processed numerical data and also provides the simulation code for transparency and review.

Figures reproduction code

Installation requirements

The visualization code uses Python 2.7+.

A number of standard scientific python packages are needed for the numerical simulations and visualizations. An easy way to install all of these is to install a Python distribution such as Anaconda:

Files organization/running the code

All files necessary to reproduce the figures are in figs_paper_coarse_gr_clean in the required relative positions. The python scripts are in python_code, where lib contains some plotting cosmetics definitions, and plots contains the scripts to run to produce the figures in the corresponding folder. Pre-processed data for Figs 2,3 and 4 can be found in the subdirectories of fig2.

For some figures cosmetic changes were done in inkscape as a postprocessing step. In these cases the figures will not be reproduced precisely.

Simulation and pre-processing code

The simulation and analysis code uses a combination of C, C++, Bash and Python 2.7+.

The C++ code depends on the packages FFTW and NFFT that need to be installed on the local machine and properly compiled (see Makefile).

The code is posted here for transparency, it is not meant to be run on local machines as it is. It may not run across platforms as some synthax is Linux specific and is not necessarily POSIX compliant. Some snippets also rely on the specific folder structure on the machine. So if the reader wants to try and use this code they should be careful to change the code to reflect their OS and folder structure. It should also be noted that for some parameters choices simulations are computationally heavy both in time and memory requirements, and need to be run with the aid of a computing cluster.

Files organization

  • In bash_scripts_handlers_github there are three bash handlers as examples on how we: 1) sweeped through parameters (grid_parameters_slurm.sh), 2) ran the model C++ code handling extinctions and explosions and output directory structure (arrayjob_coarse_grained_slurm.sh), 3) performed analysis and plots on the model outputs (plot_all_slurm.sh ). These scripts are meant to be run on a computing cluster mounting a SLURM queuing engine.
  • In Cpp_code_github there is the core C++ code for the model divided in multiple .cpp and .h (header) files. The input file is an example of input parameters to be passed to the program. The code saves various output files to track the system evolution over time, and to benchmark convolution algorithms speed and approximation errors. The code handling fast convolution using non-homogeneous Fast Fourier Transforms was adapted from open source code documented on the NFFT webpage, the authors of the original code are properly cited in the manuscript.
  • In analysis there are the python scripts used to perform analysis on the output of the C++ program. plot_avg_dyn.py collects some average observables time series, the trace in Fig. 3A was generated by this script. viral_clustering.py clusters and tracks the viral lineages in antigenic space, the trace in Fig. 3B was generated by this script. persistence_length.py infers the persistence time of the lineage trajectories from the output of viral_clustering.py. rspeciations.py computes the number of lineage splits at varius distance thresholds from the output of viral_clustering.py. summary_features.py collects summary statistics reported in the manuscript.

LICENSE

Free use of the source code is granted under the terms of the GNU General Public License version 3 (GPLv3).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published