def has_protonated_double_bonded_ring_nitrogen(mol):
    for atom in mol.GetAtoms(
            oechem.OEAndAtom(
                oechem.OEAndAtom(oechem.OEIsNitrogen(),
                                 oechem.OEHasFormalCharge(1)),
                oechem.OEAtomIsInRing(),
            )):
        for bond in atom.GetBonds():
            if bond.GetOrder() == 2:
                return True

    return False
Beispiel #2
0
    def MarkBridgingAtoms(BRIDGE_ATOM_IDX, mol, torsionSet):
        NorOorS = oechem.OEOrAtom(
            oechem.OEOrAtom(oechem.OEIsNitrogen(), oechem.OEIsOxygen()),
            oechem.OEIsSulfur())
        for atom in mol.GetAtoms(
                oechem.OEAndAtom(oechem.OEHasMapIdx(2), NorOorS)):
            for nbr in atom.GetAtoms(oechem.OEIsHeavy()):
                if not torsionSet.HasAtom(nbr):
                    if nbr.GetMapIdx() == 0:
                        torsionSet.AddAtom(nbr)
                        if nbr.GetHvyDegree() == 1:
                            nbr.SetMapIdx(3)
                            continue

                        nbr.SetMapIdx(BRIDGE_ATOM_IDX)
Beispiel #3
0
def _OEFixConnectionNH(protein):
    """
    Temporary fix, thanks to Jesper!
    """
    for atom in protein.GetAtoms(
            oechem.OEAndAtom(oespruce.OEIsModeledAtom(),
                             oechem.OEIsNitrogen())):
        if oechem.OEGetPDBAtomIndex(atom) == oechem.OEPDBAtomName_N:
            expected_h_count = 1
            if oechem.OEGetResidueIndex(atom) == oechem.OEResidueIndex_PRO:
                expected_h_count = 0
            if atom.GetTotalHCount() != expected_h_count:
                oechem.OESuppressHydrogens(atom)
                atom.SetImplicitHCount(1)
                oechem.OEAddExplicitHydrogens(protein, atom)
                for nbr in atom.GetAtoms(oechem.OEIsHydrogen()):
                    oechem.OESet3DHydrogenGeom(protein, nbr)
def has_undesirable_elements(mol):
    '''
    returns True if molecule contains any element other than
    H, C, N, O, F, S, Cl, or P
    @param mol:
    @type mol: OEGraphMol
    @return: bool
    '''
    atomsHC = oechem.OEOrAtom(oechem.OEIsHydrogen(), oechem.OEIsCarbon())
    atomsNO = oechem.OEOrAtom(oechem.OEIsNitrogen(), oechem.OEIsOxygen())
    atomsFS = oechem.OEOrAtom(oechem.OEHasAtomicNum(9), oechem.OEIsSulfur())
    atomsHCNO = oechem.OEOrAtom(atomsHC, atomsNO)
    atomsHCNOFS = oechem.OEOrAtom(atomsHCNO, atomsFS)
    atomsHCNOFSCl = oechem.OEOrAtom(atomsHCNOFS, oechem.OEHasAtomicNum(17))
    atomsHCNOFSClP = oechem.OEOrAtom(atomsHCNOFSCl, oechem.OEIsPhosphorus())

    undesirable_atom = mol.GetAtom(oechem.OENotAtom(atomsHCNOFSClP))
    if undesirable_atom is not None:
        return True

    return False
# or its use.

# @ <SNIPPET>
from __future__ import print_function
from openeye import oechem

mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1cnc(O)cc1CCCBr")

print("Number of chain atoms =", end=" ")
print(oechem.OECount(mol, oechem.OENotAtom(oechem.OEAtomIsInRing())))

print("Number of aromatic nitrogens =", end=" ")
print(
    oechem.OECount(
        mol, oechem.OEAndAtom(oechem.OEIsNitrogen(),
                              oechem.OEIsAromaticAtom())))

print("Number of non-carbons =", end=" ")
print(
    oechem.OECount(mol,
                   oechem.OENotAtom(oechem.OEHasAtomicNum(oechem.OEElemNo_C))))

print("Number of nitrogen and oxygen atoms =", end=" ")
print(
    oechem.OECount(
        mol,
        oechem.OEOrAtom(oechem.OEHasAtomicNum(oechem.OEElemNo_N),
                        oechem.OEHasAtomicNum(oechem.OEElemNo_O))))
# @ </SNIPPET>
def has_nitrogen_with_negative_formal_charge(mol):
    for atom in mol.GetAtoms(oechem.OEIsNitrogen()):
        if atom.GetFormalCharge() < 0:
            return True

    return False
# @ <SNIPPET>
from __future__ import print_function
from openeye import oechem

# @ <SNIPPET-OESHORTESTPATH>
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1ccc2c(c1)cccn2")

atomA = mol.GetAtom(oechem.OEHasAtomIdx(2))
atomB = mol.GetAtom(oechem.OEHasAtomIdx(8))

print("shortest path =", end=" ")
for atom in oechem.OEShortestPath(atomA, atomB):
    print(str(atom), end=" ")
print("\n")
# @ </SNIPPET-OESHORTESTPATH>

# @ <SNIPPET-OESHORTESTPATH-EXCLUDE>
mol = oechem.OEGraphMol()
oechem.OESmilesToMol(mol, "c1ccc2c(c1)cccn2")

atomA = mol.GetAtom(oechem.OEHasAtomIdx(2))
atomB = mol.GetAtom(oechem.OEHasAtomIdx(8))

print("shortest path =", end=" ")
for atom in oechem.OEShortestPath(atomA, atomB, oechem.OEIsNitrogen()):
    print(str(atom), end=" ")
print("\n")
# @ </SNIPPET-OESHORTESTPATH-EXCLUDE>
# @ </SNIPPET>