Skip to content

A fast implementation of optimal pairwise alignments with python

License

Notifications You must be signed in to change notification settings

DessimozLab/pyopa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

554eccd · Apr 24, 2025
Apr 24, 2025
Apr 22, 2022
Nov 8, 2018
May 14, 2016
Apr 24, 2025
Nov 14, 2018
Sep 9, 2014
Apr 22, 2022
Nov 14, 2018
Apr 22, 2022
Nov 8, 2018
Apr 24, 2025
May 14, 2016
Apr 24, 2025
Jul 28, 2023
Apr 24, 2025

Repository files navigation

PyOPA - Optimal Pairwise Alignments

This python package provides a fast implementation to compute

  • optimal pairwise alignments of molecular sequences
  • ML distance estimates of pairwise alignments.

The implementation uses Farrar's algorithm <http://bioinformatics.oxfordjournals.org/content/23/2/156.abstract>_ to compute the optimal pairwise alignment using SSE vectorization operations. This package implements the Smith-Waterman and Needleman-Wunsch algorithm to compute the local and global sequence alignments.

Installation

You can install the package using pip:

pip install pyopa

We provide wheels for Linux, MacOS (x86_64) and (arm64) for cpython.

Example

import pyopa
log_pam1_env = pyopa.read_env_json(os.path.join(pyopa.matrix_dir(), 'logPAM1.json'))
s1 = pyopa.Sequence('GCANLVSRLENNSRLLNRDLIAVKINADVYKDPNAGALRL')
s2 = pyopa.Sequence('GCANPSTLETNSQLVNRELIAVKINPRVYKGPNLGAFRL')

# super fast check whether the alignment reaches a given min-score
min_score = 100
pam250_env = pyopa.generate_env(log_pam1_env, 250, min_score)
pyopa.align_short(s1, s2, pam250_env)