This module implements Gotoh's O(MN) algorithm for aligning
sequences.
Gotoh O. An improved algorithm for matching biological sequences. J
Mol Biol. 1982 Dec 15;162(3):705-8.
Please refer to the original paper for technical details on the
working of the algorithm.
Functions:
align_global Do a global alignment between two sequences.
align_local Do a local alignment between two sequences.
identity_match Calculate match scores based on identity.
dictionary_match Calculate match scores from a dictionary lookup.
Imported modules
|
|
from support import *
from types import *
|
Functions
|
|
_align
_default_score_cutoff_fn
_find_start
_make_score_matrix
_make_score_matrix_faster
_make_score_matrix_optimized
_recover_alignments
align_global
align_local
|
|
_align
|
_align (
sequenceA,
sequenceB,
match_fn,
gap_penalty_A,
gap_penalty_B,
count_first,
global_alignment,
penalize_end_gaps,
gap_char,
score_cutoff_fn,
forgiveness,
)
Exceptions
|
|
ValueError, "Gap penalties must be negative"
|
|
|
_default_score_cutoff_fn
|
_default_score_cutoff_fn (
score,
pos,
all_scores,
)
|
|
_find_start
|
_find_start (
score_matrix,
sequenceA,
sequenceB,
open_A,
extend_A,
open_B,
extend_B,
global_alignment,
penalize_end_gaps,
count_first,
)
|
|
_make_score_matrix
|
_make_score_matrix (
sequenceA,
sequenceB,
open_A,
extend_A,
open_B,
extend_B,
count_first,
global_alignment,
penalize_end_gaps,
match_fn,
forgiveness,
)
|
|
_make_score_matrix_faster
|
_make_score_matrix_faster ( *args )
|
|
_make_score_matrix_optimized
|
_make_score_matrix_optimized ( *args )
|
|
_recover_alignments
|
_recover_alignments (
sequenceA,
sequenceB,
starts,
score_matrix,
direction_matrix,
global_alignment,
gap_char,
)
|
|
align_global
|
align_global (
sequenceA,
sequenceB,
open,
extend,
match_fn=None,
**keywds,
)
align_global(sequenceA, sequenceB, open, extend[, match_fn]) ->
alignments Do a global alignment on sequenceA and sequenceB. open and extend
are the gap penalties to apply to the sequences. They should be
negative. match_fn is a callback function that takes two
characters and returns the score. By default, will give a score
of 1 for matches and 0 for mismatches.
alignments is a list of tuples (seqA, seqB, score, begin, end).
seqA and seqB are strings showing the alignment between the
sequences. score is the score of the alignment. begin and end
are indexes into seqA and seqB that indicate the where the
alignment occurs. Here, it should be the whole sequence.
|
|
align_local
|
align_local (
sequenceA,
sequenceB,
open,
extend,
match_fn=None,
**keywds,
)
align_local(sequenceA, sequenceB, open, extend[, match_fn]) ->
alignments Do a local alignment on sequenceA and sequenceB. open and extend
are the gap penalties to apply to the sequences. They should be
negative. match_fn is a callback function that takes two
characters and returns the score. By default, will give a score
of 1 for matches and 0 for mismatches.
alignments is a list of tuples (seqA, seqB, score, begin, end).
seqA and seqB are strings showing the alignment between the
sequences. score is the score of the alignment. begin and end
are indexes into seqA and seqB that indicate the local region
where the alignment occurs.
|
|