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 comes with the most commonly used BLOSUM matrices built in. 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:

# One Header Line
   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.0.tar.gz (24.2 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.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blosum-1.1.0.tar.gz
  • Upload date:
  • Size: 24.2 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.0.tar.gz
Algorithm Hash digest
SHA256 d5dc23dec2a2ad219f2fa7411b5fdf52a60f3b2f79db66ff53d0892e23949aa5
MD5 4773623726f6ccdb56c89adcc2fab888
BLAKE2b-256 1fce4feaa516b9ccc6a571d1a6f5d990872fce88609d7478a4d1fc26689bf30c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blosum-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db93cb5dd0568ad866efa951feaa85eea9972aea42e3a8aef56089599f68f37b
MD5 c09cb4c9e05299bb5366d5f4a1796d3d
BLAKE2b-256 91be666f5f797c4efa8603b0ddaf6c9cff9968d6ab7ea8700dae267f4643d491

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

1.2.2

2 files

1.2.0

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

This release

1.1.0 This release

2 files

1.0.0

2 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