python_pdb.aligners module

Functions for aligning protein strcutures.

python_pdb.aligners.align_entities(mobile_coords: ndarray, target_coords: ndarray, entity_to_move: Type[Entity]) Type[Entity]

Align entities structure in 3D space.

Parameters:
  • mobile – coordinates of atoms in movable region that will align to target.

  • target – coordinates of atoms to align mobile region on to.

  • entity_to_move – the entity to move based on the alignment of mobile and target region.

Returns:

A new view of the entity (Structure, Model, etc) aligned with the target region.

The return type will be an entity with the same level as the entity_to_move, or if that is not provided than the same as the mobile region.

python_pdb.aligners.align_pandas_structure(mobile_coords: ndarray, target_coords: ndarray, df_to_move: DataFrame) DataFrame

Align entities structure in 3D space.

Parameters:
  • mobile – coordinates of atoms in movable region that will align to target.

  • target – coordinates of atoms to align mobile region on to.

  • df_to_move – the dataframe to update coordinates based on the alignment of mobile and target region.

Returns:

A new dataframe with updated coordinates.

python_pdb.aligners.align_sequences(seq1: str, seq2: str, match_score: float = 1.0, mismatch_score: float = -1.0, indel_score: float = -1.0) tuple

Align two sequences using the Needleman-Wunch algorithm.

See here https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm for more details.

Parameters:
  • seq1 – first string to compare

  • seq2 – second string to compare

  • match_score – score awarded for a match (Default: 1.0)

  • mismatch_score – score awarded for a mismtach (Default: -1.0)

  • indel_score – score awarded for an insertion or a deletion (Default: -1.0)

Returns:

tuple containing the alignment (represented as a list with tuple for each pair) followed by the score given to the alignment.