Skip to main content

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
alphabet
alp---et

specify an alignment scoring matrix

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

with specified penalties

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

Python Usage

Alignment

>>> import nwalign as nw
>>> nw.global_align("CEELECANTH", "PELICAN", matrix='PAM250')
('CEELE-CANTH', '-PEL-ICAN--')

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

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

Scoring

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')
11

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

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

nwalign-0.3.1.tar.gz (50.2 kB view details)

Uploaded Source

File details

Details for the file nwalign-0.3.1.tar.gz.

File metadata

  • Download URL: nwalign-0.3.1.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nwalign-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bdbf1948df8421ef744ebf2993341df1f8431bbe41f4ce31241fff88d4d8e781
MD5 80b9f4ca5646a0103d87156a12b072bc
BLAKE2b-256 33f996fdb624719c4122d559af37275c9af258ca9b1b93411e16ef0ec4899c3f

See more details on using hashes here.

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