Skip to main content

A python phylogeny tracking module

Project description

phylotrackpy: a python phylogeny tracker

status Tests Documentation Status PyPi Package Version PyPI - Wheel

In in silico evolution experiments, we have the luxury of being able to perfectly track the phylogenies of our populations, rather than having to just infer them after the fact. Phylotrackpy is a Python package designed to help you do so as efficiently as possible.

At face value, measuring a phylogeny in in silico evolution may seem very straightforward: you just need to keep track of what gives birth to what. However, multiple aspects turn out to be non-trivial. The goal of Phylotrackpy is to implement these things the right way once so that we all can stop needing to re-implement them over and over. Phylotrackpy is a python library designed to flexibly handle all aspects of recording phylogenies in in silico evolution.

Note: this library is essentially a wrapper around Phylotracklib, which is implemented in C++. If you need a C++ phylogeny tracker, you can use that one directly (it is part of the larger Empirical library, which is header-only so you can just include the parts you want).

Features

  • Pruning: Ability to prune out taxa that are extinct and have no extant descendants (to keep memory use under control)
  • Flexible taxon definitions: Flexible control of how taxa are defined (e.g. by genotype, by phenotype, by trait, or by something more complex)
  • Efficiency: Highly efficient (implemented in C++ under the hood)
  • Phylostatistics: Includes various phylogenetic topology metrics
  • Flexible output: Easily add columns to output files.

High level usage

There are three main steps in using phylotrackpy:

For more detailed instructions, see the documentation

Installation

Phylotrackpy is available through pip:

pip install phylotrackpy

Useful background information

There are certain quirks associated with real-time phylogenies (especially digital ones) that you might not be used to thinking about if you're used to dealing with reconstructed phylogenies. Many of these discrepancies are the result of the very different temporal resolutions on which these types of phylogenies are measured, and the fact that the taxonomic units we work with are often at a finer resolution than species. We document some here so that they don't catch you off guard:

  • Multifurcations are real: In phylogenetic reconstructions, there is usually an assumption that any multifurcation/polytomy (i.e. a node that has more than two child nodes) is an artifact of having insufficient data. In real-time phylogenies, however, we often observe multifurcations that we know for sure actually happened.
  • Not all extant taxa are leaf nodes: In phylogenetic reconstructions, there is usually an assumption that all extant (i.e. still living) taxa are leaf nodes in the phylogeny (i.e. none of them are parents/offspring of each other; similar taxa are descended from a shared common ancestor). In real-time phylogenies it is entirely possible that one taxon gives birth to something that we have defined as a different taxon and then continues to coexist with that child taxon.
  • Not all nodes are branch points: In phylogenetic reconstructions, we only attempt to infer where branch points (i.e. common ancestors of multiple taxa) occurred. We do not try to infer how many taxa existed on a line of descent between a branch point and an extant taxa. In real-time phylogenies we observe exactly how many taxa exist on this line of descent and we keep a record of them. In practice there are often a lot of them, depending on you define your taxa. It is unclear whether we should include these non-branching nodes when calculating phylogenetic statistics (which is why Phylotrackpy lets you choose whether you want to).

An example of a full digital evolution phylogeny

The above image represents an actual phylogeny measured from digital evolution. Each rectangle represents a different taxon. It's position along the x axis represents the span of time it existed for. Note that there are often sections along a single branch where multiple taxa coexisted for a period of time. Circles represent extant taxa at the end of this run.

Dependencies

  • pybind11 (for wrapping C++ code into Python)
  • Empirical (where the C++ version of this code lives)

Testing dependencies

  • pytest

Documentation dependencies

  • myst_parser (for writing documentation in markdown)
  • sphinx_rtd_theme (theme for readthedocs)

Contributing

Contributions are welcome! See CONTRIBUTING.md.

Developers

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

phylotrackpy-0.1.16.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distributions

phylotrackpy-0.1.16-pp39-pypy39_pp73-win_amd64.whl (159.1 kB view hashes)

Uploaded PyPy Windows x86-64

phylotrackpy-0.1.16-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (245.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (258.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (208.8 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

phylotrackpy-0.1.16-pp38-pypy38_pp73-win_amd64.whl (159.0 kB view hashes)

Uploaded PyPy Windows x86-64

phylotrackpy-0.1.16-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (244.3 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (256.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (208.9 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

phylotrackpy-0.1.16-pp37-pypy37_pp73-win_amd64.whl (158.9 kB view hashes)

Uploaded PyPy Windows x86-64

phylotrackpy-0.1.16-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (245.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (256.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (208.3 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp311-cp311-win_amd64.whl (160.1 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

phylotrackpy-0.1.16-cp311-cp311-win32.whl (139.7 kB view hashes)

Uploaded CPython 3.11 Windows x86

phylotrackpy-0.1.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (259.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (270.1 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp311-cp311-macosx_10_9_x86_64.whl (212.9 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp310-cp310-win_amd64.whl (159.4 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

phylotrackpy-0.1.16-cp310-cp310-win32.whl (138.9 kB view hashes)

Uploaded CPython 3.10 Windows x86

phylotrackpy-0.1.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (269.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp310-cp310-macosx_10_9_x86_64.whl (211.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp39-cp39-win_amd64.whl (155.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

phylotrackpy-0.1.16-cp39-cp39-win32.whl (139.1 kB view hashes)

Uploaded CPython 3.9 Windows x86

phylotrackpy-0.1.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (258.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (269.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp39-cp39-macosx_10_9_x86_64.whl (211.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp38-cp38-win_amd64.whl (159.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

phylotrackpy-0.1.16-cp38-cp38-win32.whl (138.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

phylotrackpy-0.1.16-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (269.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp38-cp38-macosx_10_9_x86_64.whl (211.5 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp37-cp37m-win_amd64.whl (158.5 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

phylotrackpy-0.1.16-cp37-cp37m-win32.whl (139.0 kB view hashes)

Uploaded CPython 3.7m Windows x86

phylotrackpy-0.1.16-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (264.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (278.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp37-cp37m-macosx_10_9_x86_64.whl (208.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

phylotrackpy-0.1.16-cp36-cp36m-win_amd64.whl (164.4 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

phylotrackpy-0.1.16-cp36-cp36m-win32.whl (143.9 kB view hashes)

Uploaded CPython 3.6m Windows x86

phylotrackpy-0.1.16-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (264.6 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

phylotrackpy-0.1.16-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl (278.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ i686

phylotrackpy-0.1.16-cp36-cp36m-macosx_10_9_x86_64.whl (208.5 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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