connect_via_residue_names#

biotite.structure.connect_via_residue_names(atoms, atom_mask=None, inter_residue=True)[source]#

Create a BondList for a given atom array (stack), based on the deposited bonds for each residue in the RCSB components.cif dataset.

Bonds between two adjacent residues are created for the atoms expected to connect these residues, i.e. 'C' and 'N' for peptides and "O3'" and 'P' for nucleotides.

Parameters:
atomsAtomArray, shape=(n,) or AtomArrayStack, shape=(m,n)

The structure to create the BondList for.

inter_residuebool, optional

If true, connections between consecutive amino acids and nucleotides are also added.

custom_bond_dictdict (str -> dict ((str, str) -> int)), optional

A dictionary of dictionaries: The outer dictionary maps residue names to inner dictionaries. The inner dictionary maps tuples of two atom names to their respective BondType (represented as integer). If given, these bonds are used instead of the bonds read from components.cif.

Returns:
BondList

The created bond list. No bonds are added for residues that are not found in components.cif.

Notes

This method can only find bonds for residues in the RCSB Chemical Component Dictionary, unless custom_bond_dict is set. Although this includes most molecules one encounters, this will fail for exotic molecules, e.g. specialized inhibitors.

To supplement custom_bond_dict with bonds for residues from the Chemical Component Dictionary you can use bonds_in_residue().

>>> import pprint
>>> custom_bond_dict = {
...     "XYZ": {
...         ("A", "B"): BondType.SINGLE,
...         ("B", "C"): BondType.SINGLE
...     }
... }
>>> # Supplement with bonds for common residues
>>> custom_bond_dict["ALA"] = bonds_in_residue("ALA")
>>> pp = pprint.PrettyPrinter(width=40)
>>> pp.pprint(custom_bond_dict)
{'ALA': {('C', 'O'): <BondType.DOUBLE: 2>,
         ('C', 'OXT'): <BondType.SINGLE: 1>,
         ('CA', 'C'): <BondType.SINGLE: 1>,
         ('CA', 'CB'): <BondType.SINGLE: 1>,
         ('CA', 'HA'): <BondType.SINGLE: 1>,
         ('CB', 'HB1'): <BondType.SINGLE: 1>,
         ('CB', 'HB2'): <BondType.SINGLE: 1>,
         ('CB', 'HB3'): <BondType.SINGLE: 1>,
         ('N', 'CA'): <BondType.SINGLE: 1>,
         ('N', 'H'): <BondType.SINGLE: 1>,
         ('N', 'H2'): <BondType.SINGLE: 1>,
         ('OXT', 'HXT'): <BondType.SINGLE: 1>},
 'XYZ': {('A', 'B'): <BondType.SINGLE: 1>,
         ('B', 'C'): <BondType.SINGLE: 1>}}