hardyweinbergcalculator


Namehardyweinbergcalculator JSON
Version 0.3.6 PyPI version JSON
download
home_pagehttps://github.com/dellius-alexander/Hardy-Weinberg.git
SummaryHardy-Weinberg Equilibrium Calculator. Calculates the expected genotype frequencies based on the allele frequencies of a population in Hardy-Weinberg equilibrium.
upload_time2023-06-25 23:42:54
maintainerinfo@hyfisolutions.com
docs_urlNone
authorDellius Alexander
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Dellius Alexander Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords hardy-weinberg-equilibrium hardy-weinberg-equilibrium-calculator hardy-weinberg-calculator chi-square chi-square-test
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build test and deploy to package repository](https://github.com/dellius-alexander/Hardy-Weinberg/actions/workflows/deploy.yml/badge.svg)](https://github.com/dellius-alexander/Hardy-Weinberg/actions/workflows/deploy.yml)

---

# Hardy Weinberg Equilibrium


Hardy-Weinberg Equilibrium Calculator. Calculates the expected 
genotype frequencies based on the allele frequencies of a 
population in Hardy-Weinberg equilibrium.

## Installation

```bash
pip install hardyweinbergcalculator
```

## Usage

```text
usage: hwc [-h] [--version] [--verbose] [--debug] [--samples SAMPLES] [--p P] [--q Q] [--tpop TPOP] [--ppop PPOP] [--qpop QPOP] [--pq2pop PQ2POP] [--genes GENES [GENES ...]] [--json JSON [JSON ...]]

Hardy-Weinberg Equilibrium Calculator. Calculates the expected genotype frequencies based on the allele frequencies of a population in Hardy-Weinberg equilibrium. See: https://en.wikipedia.org/wiki/Hardy%E2%80%93Weinberg_principle


optional arguments:
  -h, --help         show this help message and exit
  --version          show program's version number and exit
  --verbose          Enable verbose logging. (default: False)
  --debug            Enable debug logging. (default: False)
  --samples SAMPLES  Number of samples to generate, if using random data generator. (default: None)
  --p P              Frequency of dominant allele. (default: None)
  --q Q              Frequency of recessive allele. (default: None)
  --tpop TPOP        Total population. (default: None)
  --ppop PPOP        Original population of dominant allele. (default: None)
  --qpop QPOP        Original population of recessive allele. (default: None)
  --pq2pop PQ2POP    Original population of heterozygous allele. (default: None)

Example: python3 -m hwc --ppop 10 --qpop 10 --pq2pop 200 --verbose
```

### Generate random data

```bash 
python3 -m hwc --samples 1000 --verbose
```

### Calculate from known data

```bash
python3 -m hwc --ppop 10 --qpop 10 --pq2pop 200 --verbose
```

## In your code

### Test for Hard-Weinberg Equilibrium from generated data

```python
from hwc import generate_population, HardyWeinberg

# Generate random data
population = generate_population(n=1000)
res = HardyWeinberg(genes=population)
print(res)
```

### Test for Hardy-Weinberg Equilibrium from known data

```python
from hwc import HardyWeinberg

# Known data
res = HardyWeinberg(
            homozygous_dominant_population=20,
            homozygous_recessive_population=44,
            heterozygous_population=95
            )
print(res)
```

### Results Data Object

The results returned from the Hardyweinberg test will ultimately look like this, in json format:

```json
{
    "2*pq": 0.4986501057404244,
    "chi_square_test": 20.439848879167698,
    "expected_heterozygous_population": 1132.434390136504,
    "expected_homozygous_dominant_population": 510.28280493174816,
    "expected_homozygous_recessive_population": 628.2828049317482,
    "genes": [],
    "heterozygous_population": 1025.0,
    "homozygous_dominant_population": 564.0,
    "homozygous_recessive_population": 682.0,
    "p": 0.47402025539409953,
    "p + q": 1.0,
    "p**2": 0.22469520252388733,
    "p**2 + 2*pq + q**2": 1.0,
    "q": 0.5259797446059005,
    "q**2": 0.2766546917356883,
    "total_population": 2271.0
}

```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dellius-alexander/Hardy-Weinberg.git",
    "name": "hardyweinbergcalculator",
    "maintainer": "info@hyfisolutions.com",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "info@hyfisolutions.com",
    "keywords": "hardy-weinberg-equilibrium,hardy-weinberg-equilibrium-calculator,hardy-weinberg-calculator,chi-square,chi-square-test",
    "author": "Dellius Alexander",
    "author_email": "info@hyfisolutions.com",
    "download_url": "https://files.pythonhosted.org/packages/3e/07/7b6bf2056a2ddb5302fcdebd862bd82ec827d0e34d1655410383037077e4/hardyweinbergcalculator-0.3.6.zip",
    "platform": null,
    "description": "[![Build test and deploy to package repository](https://github.com/dellius-alexander/Hardy-Weinberg/actions/workflows/deploy.yml/badge.svg)](https://github.com/dellius-alexander/Hardy-Weinberg/actions/workflows/deploy.yml)\n\n---\n\n# Hardy Weinberg Equilibrium\n\n\nHardy-Weinberg Equilibrium Calculator. Calculates the expected \ngenotype frequencies based on the allele frequencies of a \npopulation in Hardy-Weinberg equilibrium.\n\n## Installation\n\n```bash\npip install hardyweinbergcalculator\n```\n\n## Usage\n\n```text\nusage: hwc [-h] [--version] [--verbose] [--debug] [--samples SAMPLES] [--p P] [--q Q] [--tpop TPOP] [--ppop PPOP] [--qpop QPOP] [--pq2pop PQ2POP] [--genes GENES [GENES ...]] [--json JSON [JSON ...]]\n\nHardy-Weinberg Equilibrium Calculator. Calculates the expected genotype frequencies based on the allele frequencies of a population in Hardy-Weinberg equilibrium. See: https://en.wikipedia.org/wiki/Hardy%E2%80%93Weinberg_principle\n\n\noptional arguments:\n  -h, --help         show this help message and exit\n  --version          show program's version number and exit\n  --verbose          Enable verbose logging. (default: False)\n  --debug            Enable debug logging. (default: False)\n  --samples SAMPLES  Number of samples to generate, if using random data generator. (default: None)\n  --p P              Frequency of dominant allele. (default: None)\n  --q Q              Frequency of recessive allele. (default: None)\n  --tpop TPOP        Total population. (default: None)\n  --ppop PPOP        Original population of dominant allele. (default: None)\n  --qpop QPOP        Original population of recessive allele. (default: None)\n  --pq2pop PQ2POP    Original population of heterozygous allele. (default: None)\n\nExample: python3 -m hwc --ppop 10 --qpop 10 --pq2pop 200 --verbose\n```\n\n### Generate random data\n\n```bash \npython3 -m hwc --samples 1000 --verbose\n```\n\n### Calculate from known data\n\n```bash\npython3 -m hwc --ppop 10 --qpop 10 --pq2pop 200 --verbose\n```\n\n## In your code\n\n### Test for Hard-Weinberg Equilibrium from generated data\n\n```python\nfrom hwc import generate_population, HardyWeinberg\n\n# Generate random data\npopulation = generate_population(n=1000)\nres = HardyWeinberg(genes=population)\nprint(res)\n```\n\n### Test for Hardy-Weinberg Equilibrium from known data\n\n```python\nfrom hwc import HardyWeinberg\n\n# Known data\nres = HardyWeinberg(\n            homozygous_dominant_population=20,\n            homozygous_recessive_population=44,\n            heterozygous_population=95\n            )\nprint(res)\n```\n\n### Results Data Object\n\nThe results returned from the Hardyweinberg test will ultimately look like this, in json format:\n\n```json\n{\n    \"2*pq\": 0.4986501057404244,\n    \"chi_square_test\": 20.439848879167698,\n    \"expected_heterozygous_population\": 1132.434390136504,\n    \"expected_homozygous_dominant_population\": 510.28280493174816,\n    \"expected_homozygous_recessive_population\": 628.2828049317482,\n    \"genes\": [],\n    \"heterozygous_population\": 1025.0,\n    \"homozygous_dominant_population\": 564.0,\n    \"homozygous_recessive_population\": 682.0,\n    \"p\": 0.47402025539409953,\n    \"p + q\": 1.0,\n    \"p**2\": 0.22469520252388733,\n    \"p**2 + 2*pq + q**2\": 1.0,\n    \"q\": 0.5259797446059005,\n    \"q**2\": 0.2766546917356883,\n    \"total_population\": 2271.0\n}\n\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Dellius Alexander  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ",
    "summary": "Hardy-Weinberg Equilibrium Calculator. Calculates the expected genotype frequencies based on the allele frequencies of a population in Hardy-Weinberg equilibrium.",
    "version": "0.3.6",
    "project_urls": {
        "Homepage": "https://github.com/dellius-alexander/Hardy-Weinberg.git"
    },
    "split_keywords": [
        "hardy-weinberg-equilibrium",
        "hardy-weinberg-equilibrium-calculator",
        "hardy-weinberg-calculator",
        "chi-square",
        "chi-square-test"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "732bb22edaff197484dabb05c69f10bba76d89b5962bfb70a20373ce987b922c",
                "md5": "bcfcdd234f9395e63e59651faf7a156c",
                "sha256": "242f1130b2871a239766d270c5252a10368d27b4f4ab7a78b3b3914f48945ff2"
            },
            "downloads": -1,
            "filename": "hardyweinbergcalculator-0.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bcfcdd234f9395e63e59651faf7a156c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14757,
            "upload_time": "2023-06-25T23:42:53",
            "upload_time_iso_8601": "2023-06-25T23:42:53.012211Z",
            "url": "https://files.pythonhosted.org/packages/73/2b/b22edaff197484dabb05c69f10bba76d89b5962bfb70a20373ce987b922c/hardyweinbergcalculator-0.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e077b6bf2056a2ddb5302fcdebd862bd82ec827d0e34d1655410383037077e4",
                "md5": "875c263fef1a980bf5fcad8365112ea7",
                "sha256": "b63bc340bb90ba762abda1e06d370771ed4002c6296338ac630edcea2e6ce96c"
            },
            "downloads": -1,
            "filename": "hardyweinbergcalculator-0.3.6.zip",
            "has_sig": false,
            "md5_digest": "875c263fef1a980bf5fcad8365112ea7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 22308,
            "upload_time": "2023-06-25T23:42:54",
            "upload_time_iso_8601": "2023-06-25T23:42:54.125776Z",
            "url": "https://files.pythonhosted.org/packages/3e/07/7b6bf2056a2ddb5302fcdebd862bd82ec827d0e34d1655410383037077e4/hardyweinbergcalculator-0.3.6.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-25 23:42:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dellius-alexander",
    "github_project": "Hardy-Weinberg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "hardyweinbergcalculator"
}
        
Elapsed time: 1.61502s