Skip to main content

MetaWards disease metapopulation modelling

Project description

MetaWards

This is a Python port of the MetaWards package originally written by Leon Danon. This is currently a work in progress and is not intended yet for production use. The port is kept in sync with the original C code, with checks in place to ensure that the two codes give identical results. This improves the robustness of both codes, as it minimises the footprint to bugs that can evade both C and Python.

The aim of this port is to make it easier for others to contribute to the program, to improve robustness by adding in unit and integration test, and to also open up scope for further optimisation and parallelisation.

The package makes heavy use of cython which is used to compile bottleneck parts of the code to C. This enables this Python port to run at approximately the same speed as the original C program.

There is still a lot of work to do, so please bear with us as we work to make this package into a well-documented, easily usable application that will help you to reproduce the model runs and analysis. Apologies in advance if we are slow to respond to any issues - we are working at high speed to get everything ready and aim to have most things completed by the beginning of Easter. We appreciate people want to help. At this stage adding more people won't speed things up, and we now have a team of professional Research Software Engineers working on this package.

Data

The data and input parameters needed to use this package are stored in the MetaWardsData repository. Please make sure that you clone this repository to your computer and supply the full path to that repository to the program when it runs. There are three ways to do this;

  1. Set the METAWARDSDATA environment variable to point to this directory, e.g. export METAWARDSDATA=$HOME/GitHub/MetaWards

  2. Pass the repository variable to the input data classes Disease, InputFiles and Parameters

  3. Or simply make sure you clone into the directory $HOME/GitHub/MetaWardsData as this is the default path.

References

These are the references behind the original C code are;

  • "Individual identity and movement networks for disease metapopulations" Matt J. Keeling, Leon Danon, Matthew C. Vernon, Thomas A. House Proceedings of the National Academy of Sciences May 2010, 107 (19) 8866-8870; DOI: 10.1073/pnas.1000416107

  • "A spatial model of CoVID-19 transmission in England and Wales: early spread and peak timing" Leon Danon, Ellen Brooks-Pollock, Mick Bailey, Matt J Keeling medRxiv 2020.02.12.20022566; doi: 10.1101/2020.02.12.20022566

Dependencies

The code requires Python 3.7 or above and depends on pygsl and cython.

Only the gsl_rng.binomial function is used from GSL, so it is likely that this requirement will soon be dropped. The link to GSL forces us to use a GPL3 license for this Python package. Once we have replaced the binomial function we will re-evaluate the license under which this code is distributed.

Installation

You can install the code from source by typing;

git clone https://github.com/chryswoods/MetaWards
cd MetaWards
python setup.py install

(assuming that python is version 3.7 or above)

You can run tests using pytest, e.g.

METAWARDSDATA="/path/to/MetaWardsData" pytest tests

You can also install via pip using

pip install metawards

Running

You can either load and use the Python classes directly, or you can run the metawards front-end command line program that is automatically installed.

metawards --help

will print out all of the help for the program. For example;

metawards --input tests/data/ncovparams.csv --seed 15324 --nsteps 30

This will duplicate the run of the MetaWards C program that is bundled in this repository that was run using;

./original/metawards 15324 tests/data/ncovparams.csv 0 1.0

The original C code, command line and expected output are in the original directory that is bundled in this repo.

Running an ensemble

We will be integrating this Python port with multiprocessing and dask to enable multiple models and seeds to be run in parallel over distributed resources. The aim is to have this parallel code working by the beginning of Easter.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metawards-0.3.0b0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

metawards-0.3.0b0-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file metawards-0.3.0b0.tar.gz.

File metadata

  • Download URL: metawards-0.3.0b0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for metawards-0.3.0b0.tar.gz
Algorithm Hash digest
SHA256 5621bd1668866c53d3f80e24a8abdd328fa99949223538c4eb39840b774ed509
MD5 a7c62c1ab310e9d17bebe980be379ce7
BLAKE2b-256 54af734012a6901382535936ea92e01082cdf408a3c55ec69507c902670778c9

See more details on using hashes here.

File details

Details for the file metawards-0.3.0b0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: metawards-0.3.0b0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for metawards-0.3.0b0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b9f75fac7a9727e5b6dba314e9cce5e946fa3e9dca3ff383f51566d97dcec72
MD5 2edbc4c3b23cc6d402378084439c1300
BLAKE2b-256 be064bcd266904a5c48930f27d427f5bcdf7b0ff4d65fad63859cae87c6202b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page