def isRotatableBond(bond): inRing = oechem.OEBondIsInRing() return (not inRing(bond)) and ( isAmideRotor(bond) or \ isMethylRotor(bond) or \ isEtherRotor(bond) )
def ring_connectivity(self): """ Returns ------- ring_connectivity: int number of bonds on the atom that are a part of a ring """ return len([b for b in self.atom.GetBonds(oechem.OEBondIsInRing())])
def OEAddLabel_Predicate(disp): ringhighlight = oedepict.OEHighlightByBallAndStick(oechem.OELightGreen) oedepict.OEAddHighlighting(disp, ringhighlight, oechem.OEAtomIsInRing(), oechem.OEBondIsInRing()) ringlabel = oedepict.OEHighlightLabel("ring", oechem.OELightGreen) oedepict.OEAddLabel(disp, ringlabel, oechem.OEAtomIsInRing()) chainhighlight = oedepict.OEHighlightByBallAndStick(oechem.OEBlueTint) oedepict.OEAddHighlighting(disp, chainhighlight, oechem.OEAtomIsInChain(), oechem.OEBondIsInChain()) chainlabel = oedepict.OEHighlightLabel("chain", oechem.OEBlueTint) oedepict.OEAddLabel(disp, chainlabel, oechem.OEAtomIsInChain())
def OEAddLabel_OEAtomBondSet(disp): mol = disp.GetMolecule() ringset = oechem.OEAtomBondSet(mol.GetAtoms(oechem.OEAtomIsInRing()), mol.GetBonds(oechem.OEBondIsInRing())) ringhighlight = oedepict.OEHighlightByBallAndStick(oechem.OELightGreen) oedepict.OEAddHighlighting(disp, ringhighlight, ringset) ringlabel = oedepict.OEHighlightLabel("ring", oechem.OELightGreen) oedepict.OEAddLabel(disp, ringlabel, ringset) chainset = oechem.OEAtomBondSet(mol.GetAtoms(oechem.OEAtomIsInChain()), mol.GetBonds(oechem.OEBondIsInChain())) chainhighlight = oedepict.OEHighlightByBallAndStick(oechem.OEBlueTint) oedepict.OEAddHighlighting(disp, chainhighlight, chainset) chainlabel = oedepict.OEHighlightLabel("chain", oechem.OEBlueTint) oedepict.OEAddLabel(disp, chainlabel, chainset)
def GetAdjacentTorsions(mol, refTorsion): ''' Returns all torsions that are 0 or 1 path length away from the reference torsion @param mol: OEGraphMol @param refTorsion: OETorsion @return: int ''' adjTorsions = [] PATH_LENGTH_THRESHOLD = 1 torset = { str(refTorsion.b.GetIdx()) + "_" + str(refTorsion.c.GetIdx()): True } torset[str(refTorsion.c.GetIdx()) + "_" + str(refTorsion.b.GetIdx())] = True pred = oechem.OEAndBond(oechem.OEHasOrder(1), oechem.OENotBond(oechem.OEBondIsInRing())) for adjTorsion in oechem.OEGetTorsions(mol, pred): # skip nitrile order_ab = adjTorsion.a.GetBond(adjTorsion.b).GetOrder() order_cd = adjTorsion.c.GetBond(adjTorsion.d).GetOrder() if order_ab == 3 or order_cd == 3: continue # skip torsions involving terminal -N-H if adjTorsion.a.IsHydrogen() and adjTorsion.b.IsNitrogen(): continue if adjTorsion.d.IsHydrogen() and adjTorsion.c.IsNitrogen(): continue key1 = str(adjTorsion.b.GetIdx()) + "_" + str( adjTorsion.c.GetIdx()) key2 = str(adjTorsion.c.GetIdx()) + "_" + str( adjTorsion.b.GetIdx()) if key1 in torset or key2 in torset: continue pathLen = TorsionGenerator.GetMinPathLength(refTorsion, adjTorsion) if pathLen <= PATH_LENGTH_THRESHOLD: adjTorsions.append(adjTorsion) torset[key1] = True torset[key2] = True return adjTorsions
def ring_connectivity(self): return len([b for b in self.atom.GetBonds(oechem.OEBondIsInRing())])
#!/usr/bin/env python # (C) 2017 OpenEye Scientific Software Inc. All rights reserved. # # TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is # provided to current licensees or subscribers of OpenEye products or # SaaS offerings (each a "Customer"). # Customer is hereby permitted to use, copy, and modify the Sample Code, # subject to these terms. OpenEye claims no rights to Customer's # modifications. Modification of Sample Code is at Customer's sole and # exclusive risk. Sample Code may require Customer to have a then # current license or subscription to the applicable OpenEye offering. # THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT # NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be # liable for any damages or liability in connection with the Sample Code # or its use. # @ <SNIPPET> from __future__ import print_function from openeye import oechem mol = oechem.OEGraphMol() oechem.OESmilesToMol(mol, "CC(=O)Nc1c[nH]cc1") print("Number of ring bonds =", oechem.OECount(mol, oechem.OEBondIsInRing())) print("Number of rotor bonds =", oechem.OECount(mol, oechem.OEIsRotor())) # @ </SNIPPET>
# exclusive risk. Sample Code may require Customer to have a then # current license or subscription to the applicable OpenEye offering. # THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT # NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be # liable for any damages or liability in connection with the Sample Code # or its use. # @ <SNIPPET> from __future__ import print_function from openeye import oechem mol = oechem.OEGraphMol() oechem.OESmilesToMol(mol, "N#CCC1CCNC=C1") print("Number of non-rotatable bonds =", end=" ") print(oechem.OECount(mol, oechem.OENotBond(oechem.OEIsRotor()))) print("Number of ring double bonds =", end=" ") print( oechem.OECount( mol, oechem.OEAndBond(oechem.OEBondIsInRing(), oechem.OEHasOrder(2)))) print("Number of double or triple bonds =", end=" ") print( oechem.OECount(mol, oechem.OEOrBond(oechem.OEHasOrder(2), oechem.OEHasOrder(3)))) # @ </SNIPPET>