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:
Wrong conditions when checking operating system
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
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
Built Distribution
File details
Details for the file population_structure-0.0.2.tar.gz
.
File metadata
- Download URL: population_structure-0.0.2.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf7db34297bd598b4563f4536d3a0740d3e8dafea8c6a08814f4e4bb247c7ed9 |
|
MD5 | 7a186ed8a0ee2ba400db45922fa6703c |
|
BLAKE2b-256 | e6bb928df012c7a082356064cb39f86fb787dab60526ba8c0d5e66b40c4d828f |
File details
Details for the file population_structure-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: population_structure-0.0.2-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c651ce163549a5bd7f598c1b79b7152b624bca19389a60e93a7d56de2907b4d8 |
|
MD5 | bab08758ebc1030de709a5d5cec2dae1 |
|
BLAKE2b-256 | 5fbc1553497540ad7b665fdebefbfc2550a8a28ceeff761fb9b7a19455204c6f |