Skip to main content

blosum

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

Test Badge Python Version Badge Download Badge Code style: black

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:

pip install blosum

Or by source:

git clone git@github.com:not-a-feature/blosum.git
cd blosum
pip install .

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:

import blosum as bl
matrix = bl.BLOSUM(62)

Custom Matrix

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

import blosum as bl
matrix = bl.BLOSUM("path/to/blosum.file")

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.

To get a value use:

val = matrix["AY"]

Or get the dictionary representation of the BLOSUM matrix.

blosum_dict = dict(matrix)

If the key cannot be found, the default value is returned. It is float("-inf"). It is possible to set a custom default score:

matrix = bl.BLOSUM(62, default=0)

License

Copyright (C) 2022 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.

Dependencies

In addition to packages included in Python 3, this piece of software uses 3rd-party software packages for development purposes that are not required in the published version. Go to DEPENDENCIES.md to see all dependencies and licenses.

Metadata

Release files for blosum 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blosum 1.1.3
File Size Uploaded Provenance Actions
blosum-1.1.3.tar.gz 24.4 kB Without provenance Details for blosum-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blosum 1.1.3
File Interpreter ABI Platform Actions
blosum-1.1.3-py3-none-any.whl Python 3 none any Details for blosum-1.1.3-py3-none-any.whl

Total release size: 46.6 kB

Release files / blosum-1.1.3.tar.gz

Download URL blosum-1.1.3.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
aede7cf2046b895214989bd1b6b2d0bc064e5e42ed05f492a96f688935329b99
BLAKE2b-256 checksum
How to use checksums
274597aadb782a1bb52507990070aaacf61d07177a0df25deaf9e50865e3975b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / blosum-1.1.3-py3-none-any.whl

Download URL blosum-1.1.3-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e17be09083dce8a16020326f4ff0776ba6e1022a4a251342bb1647d366508b11
BLAKE2b-256 checksum
How to use checksums
8f26a67580e7839bd8b1ae6e1326cbdb407ec40533d78b666b47891b957af354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for blosum 1.1.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page