Compute the Tajima's-D, Pi-Estimator or Watterson-Estimator for multiple sequences.
This module is now part of the bfx suite. See https://py-bfx.readthedocs.io for more information.
Tajima's D is a population genetic test statistic that computes the difference between the mean number of pairwise differences and the number of segregating sites. It is used to determine whether a population is expanding or shrinking.
Tajima's D
Tajima's D is defined as follows: $\theta_\text{Tajima}=\frac{\theta_{\pi}%20-%20\theta_{W}}{\sqrt{\text{Var}(\theta_{\pi}-\theta_{W})}}$
If $\theta_\text{Tajima}<0$, there are many rare variants, indicating an expanding population.
Whereas $0<\theta_\text{Tajima}$, indicates an declining population as there are many intermediate variants.
A result is consideres significant if $\theta_\text{Tajima}<-2$ or $2<\theta_\text{Tajima}$.
Pi-Estimator
The π estimator is the average number of pairwise differences between any two sequences:
$\theta_{\pi}=\frac{\text{Nr. of pairwise differences}}{\binom{n}{2}}$
Watterson-Estimator
The Watterson estimator is the expected number of segregating sites.
$\theta_{W}=\frac{\text{Nr. of segregating sites}}{\Sigma_{i=1}^{n-1}\frac{1}{i}}$
Installation
Using pip / pip3:
pip install tajimas_d
Using conda:
conda install -c bioconda tajimas_d
Or by source:
git clone git@github.com:not-a-feature/tajimas_d.git
cd tajimas_d
pip install .
How to use
from tajimas_d import tajimas_d, watterson_estimator, pi_estimator
sequences = ["AAAA", "AAAT", "AAGT", "AAGT"]
theta_tajima = tajimas_d(sequences)
theta_pi = pi_estimator(sequences)
theta_w = watterson_estimator(sequences)
Standalone version
The standalone version requires miniFasta>=2.2 to be installed.
usage: tajimas_d [-h] -f PATH [-p] [-t] [-w]
tajimas_d: Compute Tajima's D, the Pi- or Watterson-Estimator for multiple
sequences.
optional arguments:
-h, --help show this help message and exit
-f PATH, --file PATH Path to fasta file with all sequences.
-p, --pi Compute the Pi-Estimator score.
-t, --tajima Compute the Pi-Estimator score. (default)
-w, --watterson Compute the Watterson-Estimator score.
License
Copyright (C) 2024 by Jules Kreuer - @not_a_feature
This piece of software is published unter the GNU General Public License v3.0 TLDR:
| Permissions | Conditions | Limitations |
|---|---|---|
| ✓ Commercial use | Disclose source | ✕ Liability |
| ✓ Distribution | License and copyright notice | ✕ Warranty |
| ✓ Modification | Same license | |
| ✓ Patent use | State changes | |
| ✓ Private use |
Go to LICENSE.md to see the full version.
Metadata
Release files for tajimas-d 2.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tajimas_d-2.0.4.tar.gz | 18.5 kB | Without provenance | Details for tajimas_d-2.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tajimas_d-2.0.4-py3-none-any.whl | Python 3 | none | any | Details for tajimas_d-2.0.4-py3-none-any.whl |
Total release size: 36.6 kB
Release files / tajimas_d-2.0.4.tar.gz
| Download URL | tajimas_d-2.0.4.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13c9f71e900649ea459cceb354581e314d548ee0205f5f3df465b100a29da4b8
|
|
BLAKE2b-256 checksum How to use checksums |
abea07b9c07910208e4e4db434b398c8a7d814384250aa9fb5c90e7bcd9dd11e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / tajimas_d-2.0.4-py3-none-any.whl
| Download URL | tajimas_d-2.0.4-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3af5054717d85827171b4190406891700767adfc3a877ae30227afa3f8288dae
|
|
BLAKE2b-256 checksum How to use checksums |
dba1abab6365172e314f5cae623bc4adf06de9d2f247b8505b6577e71216fdc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for tajimas-d 2.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.