Skip to main content

Estimation of BDEISS-CT parameters from phylogenetic trees.

Project description

bdext

The bdext package provides scripts to simulate transmission trees, train Deep-Learning-based estimators, and estimate epidemiological parameters with BD(EI)(SS)(CT) models from dated phylogenetic trees.

PyPI version PyPI downloads Docker pulls

BDEISS-CT model

The Birth-Death (BD) Exposed-Infectious (EI) with SuperSpreading (SS) and Contact-Tracing (CT) model (BDEISS-CT) can be described with the following 8 parameters:

  • average reproduction number R;
  • average total infection duration d;
  • sampling probability ρ;
  • incubation period dinc or incubation fraction fE = dinc/d;
  • fraction of superspreaders fS < 0.5;
  • super-spreading transmission increase XS > 1;
  • contact tracing probability υ;
  • contact-traced removal speed up XC > 1.

Setting dinc=0 (equivalent to fE=0) removes incubation (EI), setting fS=0 or XS=1 removes superspreading (SS), while setting υ=0 or XC=1 removes contact-tracing (CT).

For identifiability, we require the sampling probability ρ to be given by the user. The other parameters are estimated from a time-scaled phylogenetic tree.

Example data

In the examples below we will use the [wave3.days.nwk][real_data/wave3.days.nwk] tree as an example to show how to run the commands. This tree is a time-scaled phylogenetic tree of SARS-CoV-2 sequences sampled in Hong-Kong during the third wave of the pandemic, resolved with contact-tracing data and rescaled to days. It was reconstructed by Xie et al. 2024. The estimated sampling probability for this tree is ρ=0.238.

Installation

There are 3 alternative ways to run bdct on your computer: with apptainer, in Python3, or via command line (requires installation with Python3, potentially using conda).

Installation and use in python3 or command-line (for linux systems, recommended Ubuntu 21 or newer versions)

You could either install python (version 3.10 or higher) system-wide and then install bdext via pip:

sudo apt install -y python3 python3-pip python3-setuptools python3-distutils
pip3 install bdext

or alternatively, you could install python (version 3.10 or higher) and bdext via conda (make sure that conda is installed first). Here we will create a conda environment called phylodyn:

conda create --name phylodyn python=3.10
conda activate phylodyn
pip install bdext

Basic usage in a command line

If you installed bdext in a conda environment (here named phylodyn), do not forget to first activate it, e.g.

conda activate phylodyn

We will analyse the [wave3.days.nwk][real_data/wave3.days.nwk] tree, using ρ=0.238 (see above for details). For each of the 8 BDEISS-CT nested models, we will assess whether the tree resembles the transmission trees in its training dataset by checking the summary statistics and reporting those with z-score > 5. We will then make estimates with each model.

for model in BD BDEI BDSS BDCT BDEISS BDEICT BDSSCT BDEISSCT
do
    bdeissct_check --nwk wave3.days.nwk --p 0.238 --model_name ${model} --log wave3.days.ss_${model}.tab
    bdeissct_infer --nwk wave3.days.nwk --p 0.238 --model_name ${model} --log wave3.days.est_${model}.tab
done
Help

To see detailed options, run:

bdeissct_check --help
bdeissct_infer --help
Additional commands

There are also commands to simulate trees, encode them into summary statistics and train models available:

bdeissct_simulate --help
bdeissct_encode --help
bdeissct_train --help

To see an example of how to use these commands, see the example/main.py file.

Basic usage in Python

To see an example of how to use bdext in Python, see the example/main.py file.

Run with apptainer

Once apptainer is installed, run the following command (update the version as needed, here v0.1.98 is used as an example):

apptainer run docker://evolbioinfo/bdext:v0.1.98

This will launch a terminal session within the container, in which you can run bdext commands following the instructions for the command line ("Basic usage in a command line") above.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

bdext-0.1.99.tar.gz (6.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdext-0.1.99-py3-none-any.whl (6.7 MB view details)

Uploaded Python 3

File details

Details for the file bdext-0.1.99.tar.gz.

File metadata

  • Download URL: bdext-0.1.99.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for bdext-0.1.99.tar.gz
Algorithm Hash digest
SHA256 1f00084ad6869db4ac7d9994f78bc87948fda5b0b357f459d0e7ba7289a2deb6
MD5 4bcdee7afa0569080d271b8beb90ba7c
BLAKE2b-256 3b0ea271a699cc380887c81112429f57f8533c9f3b4e45dad505fad3ee467f57

See more details on using hashes here.

File details

Details for the file bdext-0.1.99-py3-none-any.whl.

File metadata

  • Download URL: bdext-0.1.99-py3-none-any.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for bdext-0.1.99-py3-none-any.whl
Algorithm Hash digest
SHA256 c9d7b6bcfa60f14b185b9a2693d9add5e4b2335a725141a4932b1a8882635019
MD5 054b2a5b896a32e440c9d13ab1c51e36
BLAKE2b-256 5c99923df551bf59c9761c50fc07e9258045b212fef6f5bf74ac1dfee5322532

See more details on using hashes here.

Supported by

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