Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Needleman-Wunsch global sequence alignment

Project description

This module provides a python module and a command-line interface to do global- sequence alignment using the Needleman-Wunsch algorithm. It uses cython and numpy for speed.

Command-Line Usage

the nwalign executable is installed to the PATH by setuptools

$ nwalign alphabet alpet

specify an alignment scoring matrix

$ nwalign --matrix /usr/share/ncbi/data/BLOSUM62 EEAEE EEEEG

with specified penalties

$ nwalign --gap_open -10 --gap_extend -4 --match 12 ASDFF ASFF

Python Usage


>>> import nwalign as nw
>>> nw.global_align("CEELECANTH", "PELICAN", matrix='PAM250')

# with a specified penalty for open and extend.
>>> nw.global_align("CEELECANTH", "PELICAN", gap_open=-10, gap_extend=-4, matrix='PAM250')

the matrix is specified as the full path to an scoring matrix as is distributed with the NCBI toolset.


get the score of an alignment. (the first 2 args are from an alignment and must have the same length.

>>> nw.score_alignment('CEELECANTH', '-PELICAN--', gap_open=-5,
...                     gap_extend=-2, matrix='PAM250')

>>> nw.score_alignment('CEELE-CANTH', '-PEL-ICAN--', gap_open=-5,
...                     gap_extend=-2, matrix='PAM250')

Project details

Download files

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

Files for nwalign, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size nwalign-0.3.1.tar.gz (50.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page