Structure Comparison

This module defines functions for comparing and mapping polypeptide chains.

matchChains(atoms1, atoms2, **kwargs)[source]

Returns pairs of chains matched based on sequence similarity. Makes an all-to-all comparison of chains in atoms1 and atoms2. Chains are obtained from hierarchical views (HierView) of atom groups. This function returns a list of matching chains in a tuples that contain 4 items:

  • matching chain from atoms1 as a AtomMap instance,
  • matching chain from atoms2 as a AtomMap instance,
  • percent sequence identity of the match,
  • percent sequence overlap of the match.

List of matches are sorted in decreasing percent sequence identity order. AtomMap instances can be used to calculate RMSD values and superpose atom groups.

Parameters:
  • atoms1 (Chain, AtomGroup, Selection) – atoms that contain a chain
  • atoms2 (Chain, AtomGroup, Selection) – atoms that contain a chain
  • subset (string) – one of the following well-defined subsets of atoms: "calpha" (or "ca"), "backbone" (or "bb"), "heavy" (or "noh"), or "all", default is "calpha"
  • seqid (float) – percent sequence identity, default is 90
  • overlap (float) – percent overlap, default is 90
  • pwalign (bool) – perform pairwise sequence alignment

If subset is set to calpha or backbone, only alpha carbon atoms or backbone atoms will be paired. If set to all, all atoms common to matched residues will be returned.

This function tries to match chains based on residue numbers and names. All chains in atoms1 is compared to all chains in atoms2. This works well for different structures of the same protein. When it fails, Bio.pairwise2 is used for pairwise sequence alignment, and matching is performed based on the sequence alignment. User can control, whether sequence alignment is performed or not with pwalign keyword. If pwalign=True is passed, pairwise alignment is enforced.

matchAlign(mobile, target, **kwargs)[source]

Superpose mobile onto target based on best matching pair of chains. This function uses matchChains() for matching chains and returns a tuple that contains the following items:

  • mobile after it is superposed,
  • matching chain from mobile as a AtomMap instance,
  • matching chain from target as a AtomMap instance,
  • percent sequence identity of the match,
  • percent sequence overlap of the match.
Parameters:
  • mobile (Chain, AtomGroup, Selection) – atoms that contain a protein chain
  • target (Chain, AtomGroup, Selection) – atoms that contain a protein chain
  • tarsel (str) – target atoms that will be used for alignment, default is 'calpha'
  • allcsets (bool) – align all coordinate sets of mobile, default is True
  • seqid (float) – percent sequence identity, default is 90
  • overlap (float) – percent overlap, default is 90
  • pwalign (bool) – perform pairwise sequence alignment
mapOntoChain(atoms, chain, **kwargs)[source]

Map atoms onto chain. This function returns a list of mappings. Each mapping is a tuple that contains 4 items:

  • Mapped chain as an AtomMap instance,
  • chain as an AtomMap instance,
  • Percent sequence identitity,
  • Percent sequence overlap

Mappings are returned in decreasing percent sequence identity order. AtomMap that keeps mapped atom indices contains dummy atoms in place of unmapped atoms.

Parameters:
  • atoms (Chain, AtomGroup, Selection) – atoms that will be mapped to the target chain
  • chain (Chain) – chain to which atoms will be mapped
  • subset (string) – one of the following well-defined subsets of atoms: "calpha" (or "ca"), "backbone" (or "bb"), "heavy" (or "noh"), or "all", default is "calpha"
  • seqid (float) – percent sequence identity, default is 90
  • overlap (float) – percent overlap, default is 90
  • pwalign (bool) – perform pairwise sequence alignment

This function tries to map atoms to chain based on residue numbers and types. Each individual chain in atoms is compared to target chain. This works well for different structures of the same protein. When it fails, Bio.pairwise2 is used for sequence alignment, and mapping is performed based on the sequence alignment. User can control, whether sequence alignment is performed or not with pwalign keyword. If pwalign=True is passed, pairwise alignment is enforced.

getMatchScore()[source]

Returns match score used to align sequences.

setMatchScore(match_score)[source]

Set match score used to align sequences.

getMismatchScore()[source]

Returns mismatch score used to align sequences.

setMismatchScore(mismatch_score)[source]

Set mismatch score used to align sequences.

getGapPenalty()[source]

Returns gap opening penalty used for pairwise alignment.

setGapPenalty(gap_penalty)[source]

Set gap opening penalty used for pairwise alignment.

getGapExtPenalty()[source]

Returns gap extension penalty used for pairwise alignment.

setGapExtPenalty(gap_ext_penalty)[source]

Set gap extension penalty used for pairwise alignment.

getAlignmentMethod()[source]

Returns pairwise alignment method.

setAlignmentMethod(method)[source]

Set pairwise alignment method (global or local).