First version of the population_structure package published on PyPi.
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).
Example usage:
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.1.tar.gz
.
File metadata
- Download URL: population_structure-0.0.1.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c923cbc9217b5dbeca600db17d28cbf1c2782e7a88189ee6b41dc5863de56de2 |
|
MD5 | f64b759918014058e22b343c92a44035 |
|
BLAKE2b-256 | dc498cfb6034f3a3871a69657b6ccdf7b390d1414ea28fc07d9dcac734adcd96 |
File details
Details for the file population_structure-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: population_structure-0.0.1-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6875f8694c989b85c6ff8f840e38a630b80077566e8711f42796228c3d73cb22 |
|
MD5 | 0ff88e623b4619d6d793df98e10eea66 |
|
BLAKE2b-256 | f08b1489464e7c3edcfa0c1e9cbb4874cedd140e2684f5b3870f18223294d2a5 |