biotite.sequence.align.get_pairwise_sequence_identity

biotite.sequence.align.get_pairwise_sequence_identity(alignment, mode='not_terminal')[source]

Calculate the pairwise sequence identity for an alignment.

The identity is equal to the matches divided by a measure for the length of the alignment that depends on the mode parameter.

Parameters
alignmentAlignment, length=n

The alignment to calculate the pairwise sequence identity for.

mode{‘all’, ‘not_terminal’, ‘shortest’}, optional

The calculation mode for alignment length.

  • all - The number of matches divided by the number of all alignment columns.

  • not_terminal - The number of matches divided by the number of alignment columns that are not terminal gaps in any of the two considered sequences.

  • shortest - The number of matches divided by the length of the shortest one of the two sequences.

Default is not_terminal.

Returns
identityndarray, dtype=float, shape=(n,n)

The pairwise sequence identity, ranging between 0 and 1.