align_local_ungapped
#
- biotite.sequence.align.align_local_ungapped(seq1, seq2, matrix, seed, threshold, direction='both', score_only=False, check_matrix=True)[source]#
Perform a local alignment extending from given seed position without inserting gaps.
The alignment extends into one or both directions (controlled by direction) until the total alignment score falls more than threshold below the maximum score found (X-Drop). The returned alignment contains the range that yielded the maximum score.
- Parameters:
- seq1, seq2Sequence
The sequences to be aligned. The sequences do not need to have the same alphabets, as long as the two alphabets of matrix extend the alphabets of the two sequences.
- matrixSubstitutionMatrix
The substitution matrix used for scoring.
- seedtuple(int, int)
The indices in seq1 and seq2 where the local alignment starts. The indices must be non-negative.
- thresholdint
If the current score falls this value below the maximum score found, the alignment terminates.
- direction{‘both’, ‘upstream’, ‘downstream’}, optional
Controls in which direction the alignment extends starting from the seed. If
'upstream'
, the alignment starts before the seed and ends at the seed. If'downstream'
, the alignment starts at the seed and ends behind the seed. If'both'
(default) the alignment starts before the seed and ends behind the seed. The seed position itself is always included in the alignment.- score_onlybool, optional
If set to
True
, only the similarity score is returned instead of theAlignment
, decreasing the runtime substantially.- check_matrixbool, optional
If set to False, the matrix is not checked for compatibility with the alphabets of the sequences. Due to the small overall runtime of the function, this can increase performance substantially. However, unexpected results or crashes may occur, if an incompatible matrix is given.
- Returns:
- alignmentAlignment
The resulting ungapped alignment. Only returned, if score_only is
False
.- scoreint
The alignment similarity score. Only returned, if score_only is
True
.
See also
align_gapped
For gapped local alignments with the same X-Drop technique.
Examples
>>> seq1 = ProteinSequence("BIQTITE") >>> seq2 = ProteinSequence("PYRRHQTITE") >>> matrix = SubstitutionMatrix.std_protein_matrix() >>> alignment = align_local_ungapped(seq1, seq2, matrix, seed=(4,7), threshold=10) >>> print(alignment) QTITE QTITE >>> alignment = align_local_ungapped(seq1, seq2, matrix, (4,7), 10, direction="upstream") >>> print(alignment) QTI QTI >>> alignment = align_local_ungapped(seq1, seq2, matrix, (4,7), 10, direction="downstream") >>> print(alignment) ITE ITE >>> score = align_local_ungapped(seq1, seq2, matrix, (4,7), 10, score_only=True) >>> print(score) 24
Gallery#
Finding homologous regions in two genomes