blosum


Nameblosum JSON
Version 2.0.3 PyPI version JSON
download
home_pagehttps://github.com/not-a-feature/blosum
SummaryA simple BLOSUM toolbox without dependencies.
upload_time2024-03-12 10:40:16
maintainer
docs_urlNone
authorJules Kreuer / not_a_feature
requires_python>=3.8
licensegpl-3.0
keywords blosum reader bio bioinformatics blosum62 blosum45 blosum50 blosum90
VCS
bugtrack_url
requirements os typing collections
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![blosum](https://github.com/not-a-feature/blosum/raw/main/blosum.png)

A small module for easy access to BLOSUM matrices without dependencies.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7084916.svg)](https://doi.org/10.5281/zenodo.7084916)
[![Citation Badge](https://api.juleskreuer.eu/citation-badge.php?doi=10.5281/zenodo.7748749)](https://juleskreuer.eu/projekte/citation-badge/)
![Test Badge](https://github.com/not-a-feature/blosum/actions/workflows/tests.yml/badge.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)<br>
![Download Badge](https://img.shields.io/pypi/dm/blosum.svg)
![Python Version Badge](https://img.shields.io/pypi/pyversions/blosum)
[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/blosum/README.html)

The BLOcks SUbstitution Matrices (BLOSUM) are used to score alignments between protein sequences and are therefore mainly used in bioinformatics.

Reading such matrices is not particularly difficult, yet most off the shelf packages are overloaded with strange dependencies.
And why do we need to implement the same reader again if there is a simple module for that.

`blosum` offers a robust and easy-to-expand implementation without relying on third-party libraries.


## Installation
Using pip  / pip3:
```bash
pip install blosum
```
Or by source:
```bash
git clone git@github.com:not-a-feature/blosum.git
cd blosum
pip install .
```

Or by conda:
```bash
conda install blosum
```
## How to use

### Default BLOSUM
This package provides the most commonly used BLOSUM matrices.
You can choose from BLOSUM 45, 50, 62, 80 and 90.

To load a matrix:
```python
import blosum as bl
matrix = bl.BLOSUM(62)
val = matrix["A"]["Y"]
```

### Custom matrix
In addition, own matrices can be loaded. For this, the path is given as an argument.

```python
import blosum as bl
matrix = bl.BLOSUM("path/to/blosum.file")
val = matrix["A"]["Y"]
```

The matrices are required to have following format:

```
# Comments should start with #
# Each value should be seperated by one or many whitespace
   A  R  N  D
A  5 -2 -1 -2
R -2  7  0 -1
N -1  0  6  2
D -2 -1  2  7
```

### Getting values:
Once loaded the `matrix` behaves like a `defaultdict`.
To get a value use:

```python
val = matrix["A"]["Y"]
```
To get a defaultdict of the row with a given key use:

```python
val_dict = matrix["A"]
```


If the key cannot be found, the default value `float("-inf")` is returned.
It is possible to set a custom default score:
```python
matrix = bl.BLOSUM(62, default=0)
```

## License
Copyright (C) 2023 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/blosum/blob/main/LICENSE) to see the full version.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/not-a-feature/blosum",
    "name": "blosum",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "BLOSUM,reader,bio,bioinformatics,blosum62,blosum45,blosum50,blosum90",
    "author": "Jules Kreuer / not_a_feature",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/02/56/fd0a8887506b1d28662c240c589fbc143c6c0fb9c90bd118d1b7c5211c70/blosum-2.0.3.tar.gz",
    "platform": "unix",
    "description": "![blosum](https://github.com/not-a-feature/blosum/raw/main/blosum.png)\n\nA small module for easy access to BLOSUM matrices without dependencies.\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7084916.svg)](https://doi.org/10.5281/zenodo.7084916)\n[![Citation Badge](https://api.juleskreuer.eu/citation-badge.php?doi=10.5281/zenodo.7748749)](https://juleskreuer.eu/projekte/citation-badge/)\n![Test Badge](https://github.com/not-a-feature/blosum/actions/workflows/tests.yml/badge.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)<br>\n![Download Badge](https://img.shields.io/pypi/dm/blosum.svg)\n![Python Version Badge](https://img.shields.io/pypi/pyversions/blosum)\n[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/blosum/README.html)\n\nThe BLOcks SUbstitution Matrices (BLOSUM) are used to score alignments between protein sequences and are therefore mainly used in bioinformatics.\n\nReading such matrices is not particularly difficult, yet most off the shelf packages are overloaded with strange dependencies.\nAnd why do we need to implement the same reader again if there is a simple module for that.\n\n`blosum` offers a robust and easy-to-expand implementation without relying on third-party libraries.\n\n\n## Installation\nUsing pip  / pip3:\n```bash\npip install blosum\n```\nOr by source:\n```bash\ngit clone git@github.com:not-a-feature/blosum.git\ncd blosum\npip install .\n```\n\nOr by conda:\n```bash\nconda install blosum\n```\n## How to use\n\n### Default BLOSUM\nThis package provides the most commonly used BLOSUM matrices.\nYou can choose from BLOSUM 45, 50, 62, 80 and 90.\n\nTo load a matrix:\n```python\nimport blosum as bl\nmatrix = bl.BLOSUM(62)\nval = matrix[\"A\"][\"Y\"]\n```\n\n### Custom matrix\nIn addition, own matrices can be loaded. For this, the path is given as an argument.\n\n```python\nimport blosum as bl\nmatrix = bl.BLOSUM(\"path/to/blosum.file\")\nval = matrix[\"A\"][\"Y\"]\n```\n\nThe matrices are required to have following format:\n\n```\n# Comments should start with #\n# Each value should be seperated by one or many whitespace\n   A  R  N  D\nA  5 -2 -1 -2\nR -2  7  0 -1\nN -1  0  6  2\nD -2 -1  2  7\n```\n\n### Getting values:\nOnce loaded the `matrix` behaves like a `defaultdict`.\nTo get a value use:\n\n```python\nval = matrix[\"A\"][\"Y\"]\n```\nTo get a defaultdict of the row with a given key use:\n\n```python\nval_dict = matrix[\"A\"]\n```\n\n\nIf the key cannot be found, the default value `float(\"-inf\")` is returned.\nIt is possible to set a custom default score:\n```python\nmatrix = bl.BLOSUM(62, default=0)\n```\n\n## License\nCopyright (C) 2023 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/blosum/blob/main/LICENSE) to see the full version.\n",
    "bugtrack_url": null,
    "license": "gpl-3.0",
    "summary": "A simple BLOSUM toolbox without dependencies.",
    "version": "2.0.3",
    "project_urls": {
        "Homepage": "https://github.com/not-a-feature/blosum"
    },
    "split_keywords": [
        "blosum",
        "reader",
        "bio",
        "bioinformatics",
        "blosum62",
        "blosum45",
        "blosum50",
        "blosum90"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27dab7507be8843f88164fe7e24e18ccd9065fbc65135290f3434261c0057e37",
                "md5": "075f37a9743165a46c5cab5c5f045d1b",
                "sha256": "2903425cdc67424c65290d0a9b6c466ecb8df7e89b6a2a2530a9001164a3cbae"
            },
            "downloads": -1,
            "filename": "blosum-2.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "075f37a9743165a46c5cab5c5f045d1b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21242,
            "upload_time": "2024-03-12T10:40:14",
            "upload_time_iso_8601": "2024-03-12T10:40:14.597841Z",
            "url": "https://files.pythonhosted.org/packages/27/da/b7507be8843f88164fe7e24e18ccd9065fbc65135290f3434261c0057e37/blosum-2.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0256fd0a8887506b1d28662c240c589fbc143c6c0fb9c90bd118d1b7c5211c70",
                "md5": "07a2db02dfb918c8b2003cf03c8af94a",
                "sha256": "6fee68975c04211fc7c298f58cbf1e5b021ea2879e51456d934238e89ea2ae9b"
            },
            "downloads": -1,
            "filename": "blosum-2.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "07a2db02dfb918c8b2003cf03c8af94a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23564,
            "upload_time": "2024-03-12T10:40:16",
            "upload_time_iso_8601": "2024-03-12T10:40:16.280402Z",
            "url": "https://files.pythonhosted.org/packages/02/56/fd0a8887506b1d28662c240c589fbc143c6c0fb9c90bd118d1b7c5211c70/blosum-2.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-12 10:40:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "not-a-feature",
    "github_project": "blosum",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "os",
            "specs": []
        },
        {
            "name": "typing",
            "specs": []
        },
        {
            "name": "collections",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "blosum"
}
        
Elapsed time: 0.20786s