Skip to main content

blosum

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

Test Badge Python Version Badge Download Badge install with bioconda 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 .

Or by conda:

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:

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:

Once loaded the matrix behaves like a defaultdict. To get a value use:

val = matrix["AY"]

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.

Release files for blosum 1.2.0

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.2.0
File Size Uploaded
blosum-1.2.0.tar.gz 24.6 kB Details

Built distribution (wheel)

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

Total release size: 46.8 kB

Release files / blosum-1.2.0.tar.gz

Download URL blosum-1.2.0.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f576d4abe7ef6931388904984540f71b9af3054525cfa8e89ef3eb8ff004509d
BLAKE2b-256 checksum
How to use checksums
ab0496c82f9f5c8a81562ac3c0d10f6fdb55a65ad56aadb6dd036cc21c7800d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

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

Download URL blosum-1.2.0-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14e492a92bb333b871f35e98d6f164924befeac22bbe8c2b312f336d4a19ddf2
BLAKE2b-256 checksum
How to use checksums
beaf28480f429a9e0e28a794b7a815da5e3708ba6621215b76e31a9b00126e96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

2.2.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.2.2

2 release files

This release

1.2.0 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

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