Skip to main content

Implementation of HMM to estimate selection and demography from genetic time series

Project description

SelNeTime: Estimate demography and selection from genetic time series

The selnetime python package implements methods for statistical analysis of genetic data collected in time. This type of data is typically encountered in experimental evolution studies, cohorts of wild and domestic populations or ancient DNA studies.

The statistical approaches implemented in selnetime are based on Hidden Markov Models (HMMs) of the evolution of allele frequencies of biallelic loci through time. For computational efficiency, the methods build on approximating this evolution using continuous distributions (at the moment only the Beta distribution with point masses at 0 and 1, called the "Beta with Spikes" distribution). For more details on the methods see Paris et al. (2019).

Installing the package

The package is available on the python package index (https://pypi.org/project/selnetime) It can be installed with pip: pip install selnetime, possibly inside a python or conda environment

Analysing a dataset

The selnetime package comes with a command line program to analyze a time series dataset: snt. A simple description of the option is obtained by typing snt -h. The typical usage to estimate Ne and s with the Beta-with-Spikes transition model is:

snt -ft baypass -S <prefix>

where <prefix> gives the prefix of input files. Two input files are expected, named <prefix>.genobaypass and <prefix>.times.

The genobaypass file is in the format used by the BayPass software: one line per (biallelic) locus. On each row, successive pairs of counts give the number of alleles observed at a given epoch. For example:

12 19 0 36 0 32 0 26 0 33
6 3 0 3 5 0 11 0 4 0
25 9 39 2 37 14 21 10 17 5

indicates at the first locus, for the first epoch of the time series 12 (resp. 19) copies of the first (resp. second) alleles were observed.

the times file is a simple csv file indicating the times (in generations) at which the data were collected. For example:

11,27,45,58,70

will indicate 5 epochs, corresponding to sampling at generations 11, 27 etc.

The snt program will output two files:

  • <prefix>.snt.N with the results of the estimation effective population size: for each Ne considered by the program, the corresponding loglikelihood.
  • <prefix>.snt.S with the results of the estimation of selection coefficients for each locus:
    • loc : locus index
    • mle : Maximum likelihood estimate of s
    • pmean : posterior mean for s
    • psd : posterior standard deviation for s
    • lo : lower bound of the 95% credible interval for s
    • hi : upper bound of the 95% credible interval for s
    • lfsr: local false-sign rate, i.e. the posterior probability that the MLE is of the wrong sign

References

  • Cyriel Paris, Bertrand Servin, Simon Boitard, Inference of Selection from Genetic Time Series Using Various Parametric Approximations to the Wright-Fisher Model, G3 Genes|Genomes|Genetics, Volume 9, Issue 12, 1 December 2019, Pages 4073–4086

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

selnetime-0.1a0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

selnetime-0.1a0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file selnetime-0.1a0.tar.gz.

File metadata

  • Download URL: selnetime-0.1a0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for selnetime-0.1a0.tar.gz
Algorithm Hash digest
SHA256 112bae6357d8e59490fdf1e7b01bf746f16a13d22bb4d4a07b9aeef804bbaeb3
MD5 9d16182c9fd55f4e08bf0cf53546a3e8
BLAKE2b-256 065b916986f46a4ed5bff23609beda7db4ba0848a65152032b1d5cbf83c72719

See more details on using hashes here.

File details

Details for the file selnetime-0.1a0-py3-none-any.whl.

File metadata

  • Download URL: selnetime-0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for selnetime-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca2cb589b2db548d8b0810b26b233afe3430bc405e8b81f11a14934bdb7d84e
MD5 7620e8904053d2360c994bfbe3c3dcde
BLAKE2b-256 257daa930aa7cfae3ddae9acbaf56c612e3bc0183758b7bc97230f6563ff67fe

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