This module implements some dynamic programming code to align
sequences. The algorithm is general and allows things like non-linear
gap penalties and position-dependent gap penalties. For a faster
but more restrictive algorithm, see the gotoh module.
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.
affine_penalty Use linear gap penalties.
no_penalty Use no gap penalties.
Imported modules
|
|
from support import *
|
Functions
|
|
_align
_default_score_cutoff_fn
_find_start
_make_score_matrix
_recover_alignments
align_global
align_local
|
|
_align
|
_align (
sequenceA,
sequenceB,
match_fn,
gap_A_fn,
gap_B_fn,
global_alignment,
penalize_end_gaps,
gap_char,
score_cutoff_fn,
forgiveness,
)
|
|
_default_score_cutoff_fn
|
_default_score_cutoff_fn (
score,
pos,
all_scores,
)
XXX Duplicated in fastpairwise.py. Merge.
|
|
_find_start
|
_find_start (
score_matrix,
sequenceA,
sequenceB,
gap_A_fn,
gap_B_fn,
global_alignment,
penalize_end_gaps,
)
|
|
_make_score_matrix
|
_make_score_matrix (
sequenceA,
sequenceB,
match_fn,
gap_A_fn,
gap_B_fn,
global_alignment,
penalize_end_gaps,
forgiveness,
)
|
|
_recover_alignments
|
_recover_alignments (
sequenceA,
sequenceB,
starts,
match_fn,
score_matrix,
traceback_matrix,
global_alignment,
penalize_end_gaps,
gap_char,
)
|
|
align_global
|
align_global (
sequenceA,
sequenceB,
gap_A_fn,
gap_B_fn,
match_fn=None,
**keywds,
)
align_global(sequenceA, sequenceB, gap_A_fn, gap_B_fn[, match_fn]) ->
alignments Do a global alignment on sequenceA and sequenceB. gap_A_fn and
gap_B_fn are callback functions that take the gap length, the
sequence, and the index of the start of the gap and returns a gap
penalty, which 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,
gap_A_fn,
gap_B_fn,
match_fn=None,
**keywds,
)
align_local(sequenceA, sequenceB, gap_A_fn, gap_B_fn[, match_fn]) ->
alignments Do a local alignment on sequenceA and sequenceB. gap_A_fn and
gap_B_fn are callback functions that take the gap length, the
sequence, and the index of the start of the gap and returns a gap
penalty, which 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.
|
|