<img src="https://github.com/not-a-feature/tajimas_d/raw/main/tajimas-d.png" width=300px alt="tajimas_d logo"></img>
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.
![Test Badge](https://github.com/not-a-feature/tajimas_d/actions/workflows/tests.yml/badge.svg)
![Python Version Badge](https://img.shields.io/pypi/pyversions/tajimas_d)
![Download Badge](https://img.shields.io/pypi/dm/tajimas_d.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
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:
```bash
pip install tajimas_d
```
Using conda:
```bash
conda install -c bioconda tajimas_d
```
Or by source:
```bash
git clone git@github.com:not-a-feature/tajimas_d.git
cd tajimas_d
pip install .
```
## How to use
```python
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](https://github.com/not-a-feature/tajimas_d/blob/main/LICENSE) to see the full version.
Raw data
{
"_id": null,
"home_page": "https://github.com/not-a-feature/tajimas_d/",
"name": "tajimas-d",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "Tajima, Tajimas D, Pi, Watterson, Estimator, Population, Bioinformatics, Genetics",
"author": "Jules Kreuer / not_a_feature",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b3/be/ef4d477e12d5d55560ead8ea60da52ce159f321deec19853f818da42ba85/tajimas_d-2.0.2.tar.gz",
"platform": "unix",
"description": "<img src=\"https://github.com/not-a-feature/tajimas_d/raw/main/tajimas-d.png\" width=300px alt=\"tajimas_d logo\"></img>\n\nCompute the Tajima's-D, Pi-Estimator or Watterson-Estimator for multiple sequences.\n\nThis module is now part of the bfx suite. See https://py-bfx.readthedocs.io for more information.\n\n![Test Badge](https://github.com/not-a-feature/tajimas_d/actions/workflows/tests.yml/badge.svg)\n![Python Version Badge](https://img.shields.io/pypi/pyversions/tajimas_d)\n![Download Badge](https://img.shields.io/pypi/dm/tajimas_d.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nTajima'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.\n\n## Tajima's D\nTajima's D is defined as follows:\n$\\theta_\\text{Tajima}=\\frac{\\theta_{\\pi}%20-%20\\theta_{W}}{\\sqrt{\\text{Var}(\\theta_{\\pi}-\\theta_{W})}}$\n\nIf $\\theta_\\text{Tajima}<0$, there are many rare variants, indicating an **expanding** population.\n\nWhereas $0<\\theta_\\text{Tajima}$, indicates an **declining** population as there are many intermediate variants.\n\nA result is consideres significant if $\\theta_\\text{Tajima}<-2$ or $2<\\theta_\\text{Tajima}$.\n\n## Pi-Estimator\nThe \u03c0 estimator is the average number of pairwise differences between any two sequences:\n\n$\\theta_{\\pi}=\\frac{\\text{Nr. of pairwise differences}}{\\binom{n}{2}}$\n\n## Watterson-Estimator\nThe Watterson estimator is the expected number of segregating sites.\n\n$\\theta_{W}=\\frac{\\text{Nr. of segregating sites}}{\\Sigma_{i=1}^{n-1}\\frac{1}{i}}$\n\n## Installation\nUsing pip / pip3:\n```bash\npip install tajimas_d\n```\n\nUsing conda:\n```bash\nconda install -c bioconda tajimas_d\n```\n\nOr by source:\n```bash\ngit clone git@github.com:not-a-feature/tajimas_d.git\ncd tajimas_d\npip install .\n```\n\n## How to use\n\n```python\nfrom tajimas_d import tajimas_d, watterson_estimator, pi_estimator\n\nsequences = [\"AAAA\", \"AAAT\", \"AAGT\", \"AAGT\"]\n\ntheta_tajima = tajimas_d(sequences)\ntheta_pi = pi_estimator(sequences)\ntheta_w = watterson_estimator(sequences)\n```\n\n\n## Standalone version\nThe standalone version requires `miniFasta>=2.2` to be installed.\n\n```\nusage: tajimas_d [-h] -f PATH [-p] [-t] [-w]\n\ntajimas_d: Compute Tajima's D, the Pi- or Watterson-Estimator for multiple\nsequences.\n\noptional arguments:\n -h, --help show this help message and exit\n -f PATH, --file PATH Path to fasta file with all sequences.\n -p, --pi Compute the Pi-Estimator score.\n -t, --tajima Compute the Pi-Estimator score. (default)\n -w, --watterson Compute the Watterson-Estimator score.\n\n```\n\n## License\n\nCopyright (C) 2024 by Jules Kreuer - @not_a_feature\n\nThis piece of software is published unter the GNU General Public License v3.0\nTLDR:\n\n| Permissions | Conditions | Limitations |\n| ---------------- | ---------------------------- | ----------- |\n| \u2713 Commercial use | Disclose source | \u2715 Liability |\n| \u2713 Distribution | License and copyright notice | \u2715 Warranty |\n| \u2713 Modification | Same license | |\n| \u2713 Patent use | State changes | |\n| \u2713 Private use | | |\n\nGo to [LICENSE.md](https://github.com/not-a-feature/tajimas_d/blob/main/LICENSE) to see the full version.\n",
"bugtrack_url": null,
"license": "gpl-3.0",
"summary": "Computes Tajimas D, the Pi- or Watterson-Estimator for multiple sequences.",
"version": "2.0.2",
"project_urls": {
"Homepage": "https://github.com/not-a-feature/tajimas_d/"
},
"split_keywords": [
"tajima",
" tajimas d",
" pi",
" watterson",
" estimator",
" population",
" bioinformatics",
" genetics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8bcf195fbbc26bdd004c3e5cce8fc3d831a071d3438e934ae2ea692c3260c085",
"md5": "3f553aaa53b216f5c68951c4a4a99dce",
"sha256": "a802fbb3997733284420f0dc803907485209ffcd5ac1b4b05b80c3fd42737060"
},
"downloads": -1,
"filename": "tajimas_d-2.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f553aaa53b216f5c68951c4a4a99dce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 18064,
"upload_time": "2024-04-25T08:25:58",
"upload_time_iso_8601": "2024-04-25T08:25:58.897201Z",
"url": "https://files.pythonhosted.org/packages/8b/cf/195fbbc26bdd004c3e5cce8fc3d831a071d3438e934ae2ea692c3260c085/tajimas_d-2.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b3beef4d477e12d5d55560ead8ea60da52ce159f321deec19853f818da42ba85",
"md5": "2b2940dc8f0314e75d8f03f24c058748",
"sha256": "6cb73fac3ac5c4c6543aba25a37efcacfd892c1de228283d4a73463eecbdd487"
},
"downloads": -1,
"filename": "tajimas_d-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "2b2940dc8f0314e75d8f03f24c058748",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 18459,
"upload_time": "2024-04-25T08:25:59",
"upload_time_iso_8601": "2024-04-25T08:25:59.977422Z",
"url": "https://files.pythonhosted.org/packages/b3/be/ef4d477e12d5d55560ead8ea60da52ce159f321deec19853f818da42ba85/tajimas_d-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-25 08:25:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "not-a-feature",
"github_project": "tajimas_d",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "tajimas-d"
}