Skip to main content

This version contains some changes so the C library used in the Migration class is loaded correctly for Windows/Linux and that the code works in case the loading of the library fails (uses the less efficient pure python function).

Reason this release was yanked:

This version does not use the correct path to the C library.

Project description

Population Structure Package

A package for performing transformation between fst, coalescence, and migration matrices. The transformation between coalescence and migration is based on Wilkinson-Herbot's equations (2003). The transformation between fst and coalescence is based on the Slatkin's equations (2001).

Install package using pip

pip install population-structure

Example usuage

import population_structure.utils as psu
import numpy as np
m = np.array([[0, 1, 1], 
              [1, 0, 1], 
              [1, 1, 0]]) # A conservative migration matrix
t = psu.m_to_t(m) # The corresponding coalescence matrix according to W.H. (2003)
f = psu.m_to_f(m) # The corresponding fst matrix according to Slatkin (2001)
print(f"{t}\n{f}")
"""
prints:
[[3. 4. 4.]
 [4. 3. 4.]
 [4. 4. 3.]]
[[0.         0.14285714 0.14285714]
 [0.14285714 0.         0.14285714]
 [0.14285714 0.14285714 0.        ]]
"""
f = np.array([[0,0.1,0.2],
              [0.1,0,0.3],
              [0.2,0.3,0]]) # An fst matrix
psu.f_to_t(f) # Generates a possilbe corresponding coalescence matrix
psu.f_to_m(f) # Generate a possible corresponding migration matrix

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

population_structure-0.0.3.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

population_structure-0.0.3-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file population_structure-0.0.3.tar.gz.

File metadata

  • Download URL: population_structure-0.0.3.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for population_structure-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0e561faa96d90a9dad52310ba7c0e99ce47c1ec2d0ae97c6dd6a9e05d6f1a6c9
MD5 a31df0f3d050144eb316781ab5bf84cf
BLAKE2b-256 593b94f8b3ac185e77e6ce4eb91b6d9ddd94cdef42183e6550e977db7876f166

See more details on using hashes here.

File details

Details for the file population_structure-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for population_structure-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9705ebea4d30b16f0e6bc02f16d9e22478441d9ec712e7ec89bb6a3dccc87f53
MD5 9a8c3e5a9c458b0c28950fdee32a89ac
BLAKE2b-256 a3dc51c6766a6959e4d9d45f72bcf97822045309a83f20a10c32dd24d467cc0c

See more details on using hashes here.

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