opencadd.structure.superposition.sequences.sequence_alignment

opencadd.structure.superposition.sequences.sequence_alignment(seq1: str, seq2: str, matrix: str, gap: int, local: bool = False) str[source]

Perform a global alignment, based on the Needleman-Wunsch algorithm

Parameters
  • seq1,seq2 (str) – The sequences to be aligned

  • matrix (SubstitutionMatrix) – The substitution matrix used for scoring

  • gap (int or (tuple, dtype=int)) – Int the value will be interpreted as general gap penalty. Tupel is provided, an affine gap penalty is used. The first integer in the tuple is the gap opening penalty, the second integer is the gap extension penalty. The values need to be negative.

  • local (bool, optional, default=False) – Whether to use local alignment (Smith-Waterman) or global (Needleman-Wunsch)

Returns

An optimal alignment of two sequences

Return type

str