Package schrodinger :: Package structutils :: Module assignbondorders
[hide private]
[frames] | no frames]

Module assignbondorders


A module to assign bond orders based on molecular geometry.

Assigns double and triple bonds to structures based on molecular geometry
(bond length, bond angles, and dihedral angles). Useful when importing
ligands from PDBs into Maestro.   Please check the output structure for
errors and compare it to the molecular formula. If this script assigns
bond orders incorrectly to a reasonable structure, please email the
maestro file of the structure to help@schrodinger.com.

Functions:

There is a single public function:

    assignbondorders.assign_st(input_st, atoms=None, neutralize=False, problem_only=False,
                               skip_assigned_residues=True, _logger=None)
        Assigns bond orders to atom list [atoms] of structure input_st and
        returns a list of bonds that were adjusted. Bond orders are assigned for
        all atoms if the atoms list is empty or not specified.

Copyright (c) Schrodinger, LLC. All rights reserved.

Classes [hide private]
  AssignBondOrders
  CCDAtomNumberMismatchError
raise this error when atom numbers in CCD templates don't match HET
  SmilesGenerateError
raise this error when CANVAS fails to generate SMILES
Functions [hide private]
 
debug(txt)
For general debug messages
 
debuggroup(msg)
For debugging group bond assignments
 
debugbonders(msg)
For debugging aromatic ring assignments
 
debugbond(msg)
For debugging code that calculates bond "scores"
 
warning(msg)
 
get_single_bond_length(a1, a2)
Returns ideal length of a single-order bond between specified atoms.
 
get_neighbors(st, atom)
Returns a list of atoms that <atom> is bound to.
 
calculate_average_angle(st, atom_num)
Calculates the average of all bond angles around the input atom.
 
calculate_dihedral(st, a1, a2)
Calculates the average dihedral angle of the bond between the specified atoms.
 
order_ring_or_chain(st, atoms)
This function orders the atoms in the ring or chain by bonding order.
 
do_rings_share_atoms(r1, r2)
 
get_rings_in_group(ring, rings_to_check)
 
get_ring_atom_coords(st, ring_atoms)
Get the coordinates of the ring atoms as a numpy array.
 
get_edge_normals(ring_atom_coords)
Get vectors normal to the planes described by each ring-edge and the center of the ring.
 
calculate_planarity(st, ring_atoms)
Calculate the ring planarity.
 
_residue_atom_subset(res, atoms)
Return atoms of the residue residue which are also in the specified <atoms> list.
list of ints
get_canonical_ordering(st, atoms)
Return a canonical ordering of all atoms in the given structure, based on unique SMILES after removing all bond orders and formal charges.
 
_assign_from_smiles(st, atoms, smiles)
Assign the bond orders for the <atoms> in <st> based on the <smiles>.
str or None
_get_ccd_smiles(hetname)
Return the SMILES string for the given het name in the CCD database.
 
assign_st(st, atoms=None, neutralize=False, problem_only=False, skip_assigned_residues=True, use_ccd=False, _logger=None)
Perform the assign-bond-order algorithm on the supplied structure.
 
_genBondsDict(st, atoms)
Generates the state dictionary for the specified st.
 
orders_assigned(st, atoms=None, all=False)
Returns True if all bond orders are OK in the specified structure.
Variables [hide private]
  DEBUG = False
hash(x)
  logger = log.get_output_logger("schrodinger.structutils.assign...
  DEBUG_AROMATIC = True
hash(x)
  DEBUG_BOND_SCORE = True
hash(x)
  DEBUG_GROUP = True
hash(x)
  DOUBLE_BOND_THRESHOLD = 5.0
  MAX_VALENCE = [0, 1, 1, 1, 2, 6, 4, 4, 2, 1, 1, 1, 2, 8, 8, 8,...
  ATOM_RADII_DICT = {1: 0.23, 5: 0.83, 6: 0.68, 7: 0.68, 8: 0.68...
  CCD_FILE = '/scr/buildbot/savedbuilds/NB/2016-4/build-126/mmsh...
  CCD_CACHE = {}
  CCD_ATOM_PROPERTY = 's_ppw_CCD_assignment_status'
  ASSIGNED_AROMATIC = 0
hash(x)
  NOT_AROMATIC = 1
  NOT_ASSIGNED = 2
  __package__ = 'schrodinger.structutils'
Function Details [hide private]

get_single_bond_length(a1, a2)

 

Returns ideal length of a single-order bond between specified atoms. If either of the atoms is non-common, returns 0.0.

calculate_average_angle(st, atom_num)

 

Calculates the average of all bond angles around the input atom. Returns 0 if the angle can not be calculated. Close to 109 degrees = tetrahedral Close to 120 degrees = planar Close to 180 degrees = linear

calculate_dihedral(st, a1, a2)

 

Calculates the average dihedral angle of the bond between the specified atoms. Close to 0 (zero) is likely to be double bond.

get_ring_atom_coords(st, ring_atoms)

 

Get the coordinates of the ring atoms as a numpy array.

If st has periodic boundary conditions (PBC), the coordinates returned will all be in the frame of reference of the first atom in ring_atoms.

get_edge_normals(ring_atom_coords)

 

Get vectors normal to the planes described by each ring-edge and the center of the ring.

Assumes that atoms are in order.

calculate_planarity(st, ring_atoms)

 

Calculate the ring planarity.

Very planar rings have a planarity of < 1.

Assumes that atoms are in order.

_residue_atom_subset(res, atoms)

 

Return atoms of the residue residue which are also in the specified <atoms> list. Will return an empty list if this residue already has bond orders assigned.

get_canonical_ordering(st, atoms)

 

Return a canonical ordering of all atoms in the given structure, based on unique SMILES after removing all bond orders and formal charges. Hydrogens must not be present in the <atoms> list.

Parameters:
  • st (structure.Structure) - Structure containing the het.
  • atoms (list of ints) - List of atom indices to get the ordering for.
Returns: list of ints
List of original atom indices in canonical order.

_assign_from_smiles(st, atoms, smiles)

 

Assign the bond orders for the <atoms> in <st> based on the <smiles>.

@param st: Structure containing the het.
@type st: L{structure.Structure}

@param atoms: Atoms in the het group.
@type atoms: list of ints

@return: Bonds that were assigned, as a list of (atom1 index, atom2 index,
         bond order).
@rtype: list of (int, int, int)

@raises RuntimeError if het could not be assigned from CCD record for
    any reason.

_get_ccd_smiles(hetname)

 

Return the SMILES string for the given het name in the CCD database.

Parameters:
  • hetname (str) - 3-letter het name
Returns: str or None
SMILES string or None

assign_st(st, atoms=None, neutralize=False, problem_only=False, skip_assigned_residues=True, use_ccd=False, _logger=None)

 

Perform the assign-bond-order algorithm on the supplied structure.
If the atom list is specified, only those atoms are fixed.

@param st: Structure to assign bond orders in
@type st: L{structure.Structure)

@param atoms: List of atoms to assign. By default all atoms as assigned.
@type atoms: list of ints

@param neutralize: Whether to protonate carboxylic acids.
@type neutralize: bool

@param problem_only: Whether to assign only to atoms with PDB convert
    problem of 4 (orange atoms). Not compatible with <atoms> argument.
@type problem_only: bool

@param skip_assigned_residues: If True, bond orders are not assigned to
    residues that have double or triple bonds, even if that residue's atoms
    are in <atoms>.  Not compatible with <problem_only> option.
@type skip_assigned_residues: bool

@param use_ccd: Whether to use the Chemical Component Dictionary for hets
    that have records there.
@type use_ccd: bool

@param _logger: logger to send messages to
@type _logger: logger

@return: List of (atom1, atom2, order) for every bond whose order was
    altered.
@rtype: list of (int, int, int)

orders_assigned(st, atoms=None, all=False)

 

Returns True if all bond orders are OK in the specified structure. Can be given a list of atoms to check bond orders of. If not list is specified and all flag is set to True, all atoms are checked; otherwise only atoms with a PDB convert error (appear orange in Maestro) are checked. NOTE: atoms and all options are mutually exclusinve.


Variables Details [hide private]

logger

Value:
log.get_output_logger("schrodinger.structutils.assignbondorders")

MAX_VALENCE

Value:
[0,
 1,
 1,
 1,
 2,
 6,
 4,
 4,
...

ATOM_RADII_DICT

Value:
{1: 0.23,
 5: 0.83,
 6: 0.68,
 7: 0.68,
 8: 0.68,
 9: 0.64,
 14: 1.2,
 15: 1.05,
...

CCD_FILE

Value:
'/scr/buildbot/savedbuilds/NB/2016-4/build-126/mmshare-v3.6/data/mmpdb\
x/cif_components.zip'