Skip to main content

blosum

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

Test Badge Python Version Badge Download Badge

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 with the 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) 2021 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blosum-1.1.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blosum-1.1.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file blosum-1.1.1.tar.gz.

File metadata

  • Download URL: blosum-1.1.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.19.4 CPython/3.8.10

File hashes

Hashes for blosum-1.1.1.tar.gz
Algorithm Hash digest
SHA256 0b293e9c7b5eb1d5126ad83ef212d1d6d4629e2c36c19b40538d203702b83f62
MD5 34b8bc0e36b65166078151f94833801f
BLAKE2b-256 01b5a4fe8170e3c540a19846f104a7be3894b7e1491c56974bfb56969cc03427

See more details on using hashes here.

File details

Details for the file blosum-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: blosum-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.19.4 CPython/3.8.10

File hashes

Hashes for blosum-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d38193132227354e7284e8a37097b42e5b5adaa7b94f9f9fd1dbb0134d6a2b67
MD5 a109e694fcaa11a8d01a737e6f429bb9
BLAKE2b-256 f2845dd41d8c36adcd59dd6fa71b01025138cd8f41de7893a511543332df3ed4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page