Skip to main content

Dependency free, Cython-compatible scoring matrices to use with biological sequences.

Project description

🧬🔠 scoring-matrices Stars

Dependency free, Cython-compatible scoring matrices to use with biological sequences.

Actions Coverage License PyPI Bioconda AUR Wheel Python Versions Python Implementations Source Issues Docs Changelog Downloads

🗺️ Overview

Scoring Matrices are matrices used to score the matches and mismatches between two characters are the same position in a sequence alignment. Some of these matrices are derived from substitution matrices, which uses evolutionary modeling.

The scoring-matrices package is a dependency-free, batteries included library to handle and distribute common substitution matrices:

  • no external dependencies: The matrices are distributed as-is: you don't need the whole Biopython ecosystem, or even NumPy.
  • Cython compatibility: The ScoringMatrix is a Cython class that can be inherited, and the matrix data can be accessed as either a raw pointer, or a typed memoryview.
  • most common matrices: The package distributes most common matrices, such as those used by the NCBI BLAST+ suite, including:
    • PAM matrices by Dayhoff et al. (1978).
    • BLOSUM matrices by Henikoff & Henikoff (1992).
    • VTML matrices by Muller et al. (2002).
    • BENNER matrices by Benner et al. (1994).

🔧 Installing

scoring-matrices is available for all modern Python versions (3.6+).

💡 Usage

Python

  • Import the ScoringMatrix class from the installed module:
    from scoring_matrices import ScoringMatrix
    
  • Load one of the built-in matrices:
    blosum62 = ScoringMatrix.from_name("BLOSUM62")
    
  • Get individual matrix weights either by index or by alphabet letter:
    x = blosum62[0, 0]
    y = blosum62['A', 'A']
    
  • Get a row of the matrix either by index or by alphabet letter:
    row_x = blosum62[0]
    row_y = blosum62['A']
    

Cython

  • Access the matrix weights as raw pointers to constant data:
    from scoring_matrices cimport ScoringMatrix
    
    cdef ScoringMatrix blosum = ScoringMatrix.from_name("BLOSUM62")
    cdef const float*  data   = blosum.data()    # dense array
    cdef const float** matrix = blosum.matrix()  # array of pointers
    
  • Access the ScoringMatrix weights as a typed memoryview using the buffer protocol in more recents versions of Python:
    from scoring_matrices cimport ScoringMatrix
    
    cdef ScoringMatrix     blosum  = ScoringMatrix.from_name("BLOSUM62")
    cdef const float[:, :] weights = blosum
    

💭 Feedback

⚠️ Issue Tracker

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

🏗️ Contributing

Contributions are more than welcome! See CONTRIBUTING.md for more details.

📋 Changelog

This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.

⚖️ License

This library is provided under the MIT License. Matrices were collected from the MMseqs2, Biopython and NCBI BLAST+ sources and are believed to be in the public domain.

This project was developed by Martin Larralde during his PhD project at the Leiden University Medical Center in the Zeller team.

Project details


Download files

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

Source Distribution

scoring-matrices-0.2.0.tar.gz (44.1 kB view hashes)

Uploaded Source

Built Distributions

scoring_matrices-0.2.0-pp310-pypy310_pp73-win_amd64.whl (99.7 kB view hashes)

Uploaded PyPy Windows x86-64

scoring_matrices-0.2.0-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (107.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

scoring_matrices-0.2.0-pp310-pypy310_pp73-macosx_10_12_x86_64.whl (97.8 kB view hashes)

Uploaded PyPy macOS 10.12+ x86-64

scoring_matrices-0.2.0-pp39-pypy39_pp73-win_amd64.whl (99.7 kB view hashes)

Uploaded PyPy Windows x86-64

scoring_matrices-0.2.0-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (107.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

scoring_matrices-0.2.0-pp39-pypy39_pp73-macosx_10_12_x86_64.whl (97.8 kB view hashes)

Uploaded PyPy macOS 10.12+ x86-64

scoring_matrices-0.2.0-pp38-pypy38_pp73-win_amd64.whl (99.6 kB view hashes)

Uploaded PyPy Windows x86-64

scoring_matrices-0.2.0-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (108.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

scoring_matrices-0.2.0-pp38-pypy38_pp73-macosx_10_12_x86_64.whl (97.7 kB view hashes)

Uploaded PyPy macOS 10.12+ x86-64

scoring_matrices-0.2.0-pp37-pypy37_pp73-win_amd64.whl (99.5 kB view hashes)

Uploaded PyPy Windows x86-64

scoring_matrices-0.2.0-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (108.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

scoring_matrices-0.2.0-pp37-pypy37_pp73-macosx_10_12_x86_64.whl (97.7 kB view hashes)

Uploaded PyPy macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp312-cp312-win_amd64.whl (111.8 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

scoring_matrices-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (460.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (451.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (114.5 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

scoring_matrices-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl (117.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp311-cp311-win_amd64.whl (111.8 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

scoring_matrices-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (473.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (465.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (115.5 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

scoring_matrices-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl (118.2 kB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp310-cp310-win_amd64.whl (111.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

scoring_matrices-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (434.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (426.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (114.2 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

scoring_matrices-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl (116.7 kB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp39-cp39-win_amd64.whl (112.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

scoring_matrices-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (437.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (427.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp39-cp39-macosx_11_0_arm64.whl (116.0 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

scoring_matrices-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl (118.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp38-cp38-win_amd64.whl (112.4 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

scoring_matrices-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (431.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp38-cp38-macosx_11_0_arm64.whl (115.4 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

scoring_matrices-0.2.0-cp38-cp38-macosx_10_12_x86_64.whl (117.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp37-cp37m-win_amd64.whl (113.2 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

scoring_matrices-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (406.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (396.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp37-cp37m-macosx_10_12_x86_64.whl (118.3 kB view hashes)

Uploaded CPython 3.7m macOS 10.12+ x86-64

scoring_matrices-0.2.0-cp36-cp36m-win_amd64.whl (121.0 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

scoring_matrices-0.2.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (376.7 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

scoring_matrices-0.2.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (371.5 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ ARM64

scoring_matrices-0.2.0-cp36-cp36m-macosx_10_12_x86_64.whl (115.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.12+ x86-64

Supported by

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