All Projects → scastlara → minineedle

scastlara / minineedle

Licence: GPL-3.0 license
Needleman-Wunsch and Smith-Waterman algorithms in python

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to minineedle

seqalign
Collection of sequence alignment algorithms.
Stars: ✭ 20 (-25.93%)
Mutual labels:  smith-waterman, needleman-wunsch
SneakySnake
SneakySnake🐍 is the first and the only pre-alignment filtering algorithm that works efficiently and fast on modern CPU, FPGA, and GPU architectures. It greatly (by more than two orders of magnitude) expedites sequence alignment calculation for both short and long reads. Described in the Bioinformatics (2020) by Alser et al. https://arxiv.org/abs…
Stars: ✭ 44 (+62.96%)
Mutual labels:  smith-waterman, needleman-wunsch
Core Layout
Flexbox & CSS-style Layout in Swift.
Stars: ✭ 215 (+696.3%)
Mutual labels:  alignment
indigo
Indigo: SNV and InDel Discovery in Chromatogram traces obtained from Sanger sequencing of PCR products
Stars: ✭ 26 (-3.7%)
Mutual labels:  alignment
Smartsystemmenu
SmartSystemMenu extends system menu of all windows in the system
Stars: ✭ 209 (+674.07%)
Mutual labels:  alignment
Rmsd
Calculate Root-mean-square deviation (RMSD) of two molecules, using rotation, in xyz or pdb format
Stars: ✭ 215 (+696.3%)
Mutual labels:  alignment
THINGSvision
Python package for extracting and analyzing image representations from state-of-the-art neural networks for computer vision
Stars: ✭ 106 (+292.59%)
Mutual labels:  alignment
tracy
Basecalling, alignment, assembly and deconvolution of Sanger Chromatogram trace files
Stars: ✭ 73 (+170.37%)
Mutual labels:  alignment
cacao
Callable Cancer Loci - assessment of sequencing coverage for actionable and pathogenic loci in cancer
Stars: ✭ 21 (-22.22%)
Mutual labels:  alignment
strutil
Golang metrics for calculating string similarity and other string utility functions
Stars: ✭ 114 (+322.22%)
Mutual labels:  smith-waterman
diagonalsw
C/C++ implementation of the Smith-Waterman algorithm by using SIMD operations (e.g SSE4.1)
Stars: ✭ 21 (-22.22%)
Mutual labels:  smith-waterman
Pedestrian alignment
TCSVT2018 Pedestrian Alignment Network for Large-scale Person Re-identification
Stars: ✭ 223 (+725.93%)
Mutual labels:  alignment
JQCollectionViewAlignLayout
A custom layout object based on flow layout. Added supports for horizontal, vertical alignment and RTL direction of collection view items.(available for both UICollectionView and NSCollectionView)
Stars: ✭ 69 (+155.56%)
Mutual labels:  alignment
Ngmlr
NGMLR is a long-read mapper designed to align PacBio or Oxford Nanopore (standard and ultra-long) to a reference genome with a focus on reads that span structural variations
Stars: ✭ 215 (+696.3%)
Mutual labels:  alignment
Scan2cad
[CVPR'19] Dataset and code used in the research project Scan2CAD: Learning CAD Model Alignment in RGB-D Scans
Stars: ✭ 249 (+822.22%)
Mutual labels:  alignment
Genomeworks
SDK for GPU accelerated genome assembly and analysis
Stars: ✭ 215 (+696.3%)
Mutual labels:  alignment
Peppa-Facial-Landmark-PyTorch
Facial Landmark Detection based on PyTorch
Stars: ✭ 172 (+537.04%)
Mutual labels:  alignment
ChromAlignNet
Deep neural network for the alignment of GC-MS peaks
Stars: ✭ 29 (+7.41%)
Mutual labels:  alignment
unicode display width
Displayed width of UTF-8 strings in Modern C++
Stars: ✭ 30 (+11.11%)
Mutual labels:  alignment
ultra
uLTRA is a long-read splice aligner with high accuracy from using a guiding annotation
Stars: ✭ 47 (+74.07%)
Mutual labels:  alignment

Build Status PyPI version

Needleman-Wunsch and Smith-Waterman algorithms in python for any iterable objects.

Algorithms

Needleman-Wunsch

The Needleman–Wunsch algorithm is an algorithm used in bioinformatics to align protein or nucleotide sequences. It was one of the first applications of dynamic programming to compare biological sequences. The algorithm was developed by Saul B. Needleman and Christian D. Wunsch and published in 1970. The algorithm essentially divides a large problem (e.g. the full sequence) into a series of smaller problems and uses the solutions to the smaller problems to reconstruct a solution to the larger problem. It is also sometimes referred to as the optimal matching algorithm and the global alignment technique. The Needleman–Wunsch algorithm is still widely used for optimal global alignment, particularly when the quality of the global alignment is of the utmost importance.

-- From the Wikipedia article

Smith-Waterman

The Smith–Waterman algorithm performs local sequence alignment; that is, for determining similar regions between two strings of nucleic acid sequences or protein sequences. Instead of looking at the entire sequence, the Smith–Waterman algorithm compares segments of all possible lengths and optimizes the similarity measure.

-- From the Wikipedia article

Usage

from minineedle import needle, smith, core

# Use miniseq objects
# Load sequences as miniseq FASTA object
import miniseq
fasta = miniseq.FASTA(filename="myfasta.fa")
seq1, seq2 = fasta[0], fasta[1]

# Or use strings, lists, etc
# seq1, seq2 = "ACTG", "ATCTG"
# seq1, seq2 = ["A","C","T","G"], ["A","T","C","T","G"]

# Create the instance
alignment = needle.NeedlemanWunsch(seq1, seq2)
# or
# alignment = smith.SmithWaterman(seq1, seq2)

# Make the alignment
alignment.align()

# Get the score
alignment.get_score()

# Get the sequences aligned as lists
al1, al2 = alignment.get_aligned_sequences("list")

# Get the sequences as strings
al1, al2 = alignment.get_aligned_sequences("str")

# Change the matrix and run again
alignment.change_matrix(core.ScoreMatrix(match=4, miss=-4, gap=-2))
alignment.align()

# Print the sequences aligned
print(alignment)

# Change gap character
alignment.gap_character = "-gap-"
print(alignment)

# Sort a list of alignments by score
first_al  = needle.NeedlemanWunsch(seq1, seq2)
second_al = needle.NeedlemanWunsch(seq3, seq4)

for align in sorted([first_al, second_al], reverse=True):
    print(align)

Install

pip install minineedle

Classes

NeedlemanWunsch

Needleman-Wunsch alignment class. It has the following attributes:

  • seq1
  • seq2
  • alseq1
  • alseq2
  • nmatrix
  • pmatrix
  • smatrix
  • score
  • identity
  • gap_character

To create the instance you have to provide two iterable objects with elements that can be compared with "==".

SmithWaterman

Smith-Waterman alignment class. It has the following attributes:

  • seq1
  • seq2
  • alseq1
  • alseq2
  • nmatrix
  • pmatrix
  • smatrix
  • score
  • identity

To create the instance you have to provide two iterable objects with elements that can be compared with "==".

ScoreMatrix

With this class you can define your own score matrices. It has three attributes:

  • match
  • miss
  • gap

Methods

align()

Performs the alignment.

get_score()

Returns the score of the alignment. It runs align() if it has not been done yet.

change_matrix(newmatrix)

Takes a ScoreMatrix object and updates the matrix for the alignment. You still have to run it calling align().

get identity()

Returns the % of identity (rounded with 2 decimal points).

get_almatrix()

Return the alignment matrix as a list of lists.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].