Exemple #1
0
def angleGuanidium(central_atom, atom_check, l_atom_lig) : 
    
    l_N_temp = []
    
    l_atom_connect_central, l_atom_element = retrieveAtom.atomConnect(l_atom_lig, central_atom["serial"])
    
    for atom_N in l_atom_connect_central[1:] : 
        l_atom_connect_N, l_element_N = retrieveAtom.atomConnect(l_atom_lig, atom_N["serial"])
        
        
        if l_element_N == ["N", "C"] : 
            if not l_atom_connect_N[0] in l_N_temp : 
                l_N_temp.append (deepcopy(l_atom_connect_N[0]))


    if len(l_N_temp) == 2 :
        at_considered = CenterPoint(l_N_temp[0], l_N_temp[-1])

    elif len(l_N_temp) > 2 : 
        for N_temp in l_N_temp : 
            if distanceTwoatoms(central_atom, N_temp) > 3.0 : 
                del N_temp 
        if len(l_N_temp) == 2 :
            at_considered = CenterPoint(l_N_temp[0], l_N_temp[-1])
    else : 
        return "ERROR"
        
    return [angleVector(central_atom, at_considered, atom_check)]
Exemple #2
0
def imidazole(l_atom2, l_atom_lig):
    """search imidazole global
    in: list atom connected of nitrogen, list atom ligand
    out: boolean"""
    
    
    connect1 = toolSubstructure.matrixElement(l_atom2)
#     print connect1
    # append first atom
    
    if connect1 == ["N", "C", "C"]:
        l_atom3, conect2 = retrieveAtom.atomConnect(l_atom_lig, l_atom2[1]["serial"])
        l_atom32, conect22 = retrieveAtom.atomConnect(l_atom_lig, l_atom2[2]["serial"])

        # sort list to reduce if condition
        conect2.sort ()
        conect22.sort ()
        
        if conect2 == ["C", "C", "N", "N"] or conect2 == ["C", "N", "N"]:
            l_serial_check = [l_atom2[0]["serial"], l_atom3[0]["serial"]]
            if imidazoleATOM3(l_atom3, l_serial_check, l_atom_lig)[0] == 1:
#                 print "l344"
                return [1, l_serial_check]

        elif conect22 == ["C", "C", "N", "N"] or conect22 == ["C", "N", "N"]:
            l_serial_check = [l_atom2[0]["serial"], l_atom32[0]["serial"]]
            if imidazoleATOM3(l_atom32, l_serial_check, l_atom_lig)[0] == 1:
#                 print "l350"
                return [1, l_serial_check]

    return [0, []]
Exemple #3
0
def angleAcidCarboxylic(central_atom, atom_check, l_atom_lig) : 
    
    l_atom_connect, matrix_connect = retrieveAtom.atomConnect(l_atom_lig, central_atom["serial"])
    l_O_temp = []
    
    for atom_connect in l_atom_connect[1:] : 
        l_temp_connect, connect_matrix = retrieveAtom.atomConnect(l_atom_lig, atom_connect["serial"])
        if connect_matrix == ["O", "C"] : 
            l_O_temp.append (atom_connect)
    
    
    at_considered = CenterPoint(l_O_temp[0], l_O_temp[1])    
        
    
    return [angleVector(central_atom, at_considered, atom_check)]
Exemple #4
0
def riboseFromADPRiboseAtom3 (serialAtom3, listAtomLigand, serialInit, serialPrevious) : 
    """search ribose atom3 
    in: list atom connected of nitrogen, list atom ligand
    out: boolean"""
         
    listAtomConnect3, connect3 = retrieveAtom.atomConnect(listAtomLigand , serialAtom3)
    for atom in listAtomConnect3 : 
        if atom["element"] == "O" : 
            listAtomConnectO, connectO = retrieveAtom.atomConnect(listAtomLigand, atom["serial"])
            if connectO != ["O", "C"] : 
                return 0
        
    for atom in listAtomConnect3 :
        if atom["element"] == "C" and atom["serial"] != serialPrevious and atom["serial"] != serialAtom3: 
            atomConnect4, connectAtom4 = retrieveAtom.atomConnect(listAtomLigand, atom["serial"])
            if connectAtom4 == ["C", "O", "C", "C"] or connectAtom4 == ["C", "C", "O", "C"] or connectAtom4 == ["C", "C", "C", "O"] : 
                if riboseFromADPRiboseAtom4 (atom["serial"], listAtomLigand, serialInit, serialAtom3) == 1 : 
                    return 1
    return 0
Exemple #5
0
def globalNeighbors(distance, l_atom_ligand, pdb, struct_global_neighbor):
    """Retrieve neighbor in sphere
    in : distance arroud  atom, atom in ligand, name of pdb
    out : list of atoms"""
    

    for atom in l_atom_ligand:
        groupAtom, conect = retrieveAtom.atomConnect(l_atom_ligand, atom["serial"])
        atom = buildAtom(distance, groupAtom[0], pdb, "global", l_atom_ligand)
        struct_global_neighbor.append(atom)
Exemple #6
0
def riboseFromADPRiboseAtom4 (serial, listAtomLigand, serialInit, serialPrevious) : 
    """search ribose atom4 
    in: list atom connected of nitrogen, list atom ligand
    out: boolean"""    
    
    listAtomC, connectC = retrieveAtom.atomConnect(listAtomLigand, serial) 
    
    for atom in listAtomC[1:] : 
        if atom["element"] == "O" : 
            listAtomConnectO, connectO = retrieveAtom.atomConnect(listAtomLigand, atom["serial"])
            if connectO != ["O", "C"] : 
                return 0

    for atom in listAtomC :
        if atom["serial"] != serial and atom["serial"] != serialPrevious :  
            for serial in atom["connect"] : 
                if serial == serialInit : 
                    return 1
    
    return 0
Exemple #7
0
def riboseFromADPRibose (listAtomLigand):
    """search ribose global 
    in: list atom connected of nitrogen, list atom ligand
    out: boolean"""
            
    for atom in listAtomLigand : 
        if atom["element"] == "O" :
            listAtomConnectO, connectO = retrieveAtom.atomConnect(listAtomLigand, atom["serial"])
            if connectO == ["O", "C", "C"] : 
                serialInit = atom["serial"]
                listAtomConnectC1, connectC1 = retrieveAtom.atomConnect(listAtomLigand, atom["connect"][1])
                listAtomConnectC2, connectC2 = retrieveAtom.atomConnect(listAtomLigand, atom["connect"][2])
                
                if "C" in connectC1[1:] : 
                    if riboseFromADPRiboseAtom2(listAtomConnectC1, listAtomLigand, serialInit) == 1 : 
                        return 1
                if "C" in connectC2[1:] : 
                    if riboseFromADPRiboseAtom2(listAtomConnectC2, listAtomLigand, serialInit) == 1 : 
                        return 1
    
    return 0
Exemple #8
0
def acidCarboxylic(l_C2, l_atom_lig) : 
    
    l_serial = []
    connectO1 = toolSubstructure.matrixElement(l_C2)
    if connectO1 != ["O", "C"] : 
        return [0, []]
    else :
        l_serial.append (l_C2[0]["serial"]) 
        
        l_connect3, connectC2 = retrieveAtom.atomConnect(l_atom_lig, l_C2[1]["serial"])
        connectC2.sort()
        if connectC2 == ["C", "C", "O", "O"] :  
            l_serial.append (l_connect3[0]["serial"])
            
            for atom3 in l_connect3[1:] :
                if atom3["element"] == "O" and not atom3["serial"] in l_serial: 
                        l_O2, connectO2 = retrieveAtom.atomConnect(l_atom_lig, atom3["serial"])
                        if connectO2 == ["O", "C"] :
                            l_serial.append (atom3["serial"])
                        else : 
                            return [0, []]
                elif atom3["element"] == "C" and not atom3["serial"] in l_serial : 
                    l_atomC4, connectC4 = retrieveAtom.atomConnect(l_atom_lig, atom3["serial"])
#                     print connectC4, "Check"
                    connectC4_unique = sorted(set(connectC4),key=connectC4.index)
#                     print connectC4_unique
                    if connectC4_unique != ["C"] : 
                        return [0, []]
                    else :
                        for atom_conex in l_atomC4[1:] : 
                            if toolSubstructure.checkSingleBond(l_atomC4[0], atom_conex) == 0 : 
                                return [0, []]
                    
                    
                        
    # check 3 atom and not a hydroxyl group
    if len (l_serial) == 3 :
        return [1, l_serial]
    
    return [0, []]
Exemple #9
0
def interestGroup (max_distance, l_atom_lig, name_PDB, d_stock_neighbor, more_flex = 0):
    """Search different groups
    in : ligands in namePDB
    out : major nitrogen in the group of different structures
    change distance max for Guanidium + 1.5
    imidazole + 1.1
    and acid carboxylic + 1.3
    append more flex to GPCR study"""
    
    l_serialN = ListSerialElement(l_atom_lig, "N")
    l_serialO = ListSerialElement(l_atom_lig, "O")
    
    
    # different d_stock_neighbor
    for serialN in l_serialN:
        l_atom_connectN, conect = retrieveAtom.atomConnect(l_atom_lig, serialN)
        # check every substructure
        if imidazole(l_atom_connectN, l_atom_lig)[0] == 1:
            implementNeighborStruct (max_distance + 1.5, l_atom_connectN, name_PDB, l_atom_lig, "IMD", d_stock_neighbor)
        elif Guanidium(l_atom_connectN, l_atom_lig)[0] == 1:
            implementNeighborStruct (max_distance + 1.1, l_atom_connectN, name_PDB, l_atom_lig, "GAI", d_stock_neighbor)
#         elif diAmine(l_atom_connectN, l_atom_lig) == 1:
#             implementNeighborStruct (max_distance, l_atom_connectN, name_PDB, l_atom_lig, "Diamine", d_dia_temp)
#         elif pyridine(l_atom_connectN, l_atom_lig) == 1:
#             implementNeighborStruct (max_distance, l_atom_connectN, name_PDB, l_atom_lig, "Pyridine", d_stock_neighbor)
        elif cn(l_atom_connectN, l_atom_lig) == 1:
            implementNeighborStruct (max_distance, l_atom_connectN, name_PDB, l_atom_lig, "I", d_stock_neighbor)
        elif cnc(l_atom_connectN, l_atom_lig, more_flex = more_flex) == 1:
#             print "l562 -> search PDB"
            implementNeighborStruct (max_distance, l_atom_connectN, name_PDB, l_atom_lig, "II", d_stock_neighbor)
        elif cncc(l_atom_connectN, l_atom_lig, more_flex = more_flex) == 1:
            implementNeighborStruct (max_distance, l_atom_connectN, name_PDB, l_atom_lig, "III", d_stock_neighbor)
            
               
    for serialO in l_serialO :
        l_atom_connectO, conect = retrieveAtom.atomConnect(l_atom_lig, serialO)
        if acidCarboxylic(l_atom_connectO, l_atom_lig)[0] == 1:
            implementNeighborStruct (max_distance + 1.3, l_atom_connectO, name_PDB, l_atom_lig, "COO", d_stock_neighbor)
Exemple #10
0
def interestStructure (l_atom_lig, more_flex = 0, debug = 0):
    """For one serial_nitrogen atom search substructure
    in : list atom ligand
    out : list of substructures found (list string)"""

    l_serial_N = ListSerialElement (l_atom_lig, "N")
    l_serial_O = ListSerialElement (l_atom_lig, "O")
    
    if debug : 
        print l_serial_O
        print l_serial_N
    
    l_substruct = []

    for serial_nitrogen in l_serial_N:
        l_atom_connectN, connect = retrieveAtom.atomConnect(l_atom_lig, serial_nitrogen)
        if imidazole(l_atom_connectN, l_atom_lig)[0] == 1:
            l_substruct.append("IMD")
        elif Guanidium(l_atom_connectN, l_atom_lig)[0] == 1 : 
            l_substruct.append("GAI")    
#         elif diAmine(l_atom_connectN, l_atom_lig) == 1 : 
#             l_substruct.append("Diamine")     
#         elif pyridine(l_atom_connectN, l_atom_lig) == 1 : 
#             l_substruct.append("Pyridine")    
        elif cn (l_atom_connectN, l_atom_lig) == 1:
            l_substruct.append("I")
        elif cnc(l_atom_connectN, l_atom_lig, more_flex = more_flex) == 1:
            l_substruct.append("II")
        elif cncc(l_atom_connectN, l_atom_lig, more_flex = more_flex) == 1:
            l_substruct.append("III")
       

    for serial_oxygen in l_serial_O:
        l_atom_connectO, connect = retrieveAtom.atomConnect(l_atom_lig, serial_oxygen)
        if acidCarboxylic(l_atom_connectO, l_atom_lig)[0] == 1:
            l_substruct.append("COO")
    
    return l_substruct
Exemple #11
0
def riboseFromADPRiboseAtom2 (listAtomConnectC, listAtomLigand, serialInit) :
    """search ribose atom2 
    in: list atom connected of nitrogen, list atom ligand
    out: boolean"""
        
    for atom in listAtomConnectC :
        if atom["element"] == "C" :
            listAtomC3, connectC = retrieveAtom.atomConnect(listAtomLigand, atom["serial"])
        
            if connectC == ["C", "O", "C", "C"] or connectC == ["C", "C", "O", "C"] or connectC == ["C", "C", "C", "O"] : 
                serialNext = listAtomC3[0]["serial"]
                if riboseFromADPRiboseAtom3 (serialNext, listAtomLigand, serialInit, atom["serial"]) == 1 : 
                    return 1
    return 0
Exemple #12
0
def CoplanarityIII (l_atom_lig) : 
    """For each matrix connect N, C, C, C the coplanar distance
    in: list atom in ligand, list distance coplar retrieve
    out: append distance in list distance coplanar"""
    
    l_out = []
    l_serialN = searchPDB.ListSerialElement(l_atom_lig, "N")
    for serialN in l_serialN:
        l_atom_connect, conect_matrix = retrieveAtom.atomConnect(l_atom_lig, serialN)
        
        if conect_matrix == ["N", "C", "C", "C"]:
            dist = calcul.coplanar(l_atom_connect[0], l_atom_lig)
            if dist != None :
                l_out.append (str(dist))

    return l_out
Exemple #13
0
def imidazoleATOM5(l_atom5, l_serial_check, l_atom_lig):
    """Check the atom 5 in cercle of imidazole
    in : atoms ligand in list, serial of first nitrogen, name of ligand
    out : boolean"""
    
    
    for atom5 in l_atom5 : 
        if atom5["element"] == "C" and not atom5["serial"] in l_serial_check:
            l_atom6, conect5 =  retrieveAtom.atomConnect(l_atom_lig, atom5["serial"])
            # check connect atom4 IMD
            conect5.sort()
            if conect5 == ["C","C", "C", "N"] or conect5 == ["C","C", "N"] : 
                for atom6 in l_atom6 : 
                    if atom6["element"] == "N" and atom6["serial"] in l_serial_check :
                        l_serial_check.append (l_atom6[0]["serial"])
                        return [1, l_serial_check]
    return [0, l_serial_check]
Exemple #14
0
def AngleNImd(atom_center, atom_check, l_atom_lig, debug = 0):
    """
    based one central atom, take C between the two N
    """
    
    for atom_lig in l_atom_lig :
        l_atom2, connect1 = retrieveAtom.atomConnect(l_atom_lig, atom_lig["serial"])
        
        if connect1 == ["N", "C", "C"] : 
            dist_N_center = distanceTwoatoms(l_atom2[0], atom_center) 
            
            if dist_N_center < 2.0 : 
                angle = Angle3Atoms(atom_check, atom_center, l_atom2[0])
                
                return [angle]
        
    return ["NA"]
Exemple #15
0
def CenterImidazole (l_atom_in, l_atom_lig) : 
    
    atomN1 = deepcopy(l_atom_in[0])
    
    
    for atom2 in l_atom_in[1:] :
        
        l_atom3, connect2 = retrieveAtom.atomConnect(l_atom_lig, atom2["serial"])
        connect2.sort ()
        
        if connect2 == ["C", "C", "N", "N"] or connect2 == ["C", "N", "N"] :         
            for atom3 in l_atom3[1:] :
                if atom3["element"] == "N" and atom3["serial"] != atomN1["serial"] : 
                    center_atom = CenterPoint(atomN1, atom3)
                    return center_atom
                
    print "ERROR"            
    return "ERROR"   
Exemple #16
0
def imidazoleATOM3(l_atom3, l_serial_check, l_atom_lig):
    """Check the atom3 3 in circle of imidazole
    in : atoms ligand in list, serial of first nitrogen, name of ligand
    out : boolean"""

    for atom3 in l_atom3:
        if atom3["element"] == "N":
            if not atom3["serial"] in l_serial_check : 
                l_atom4, conect3 = retrieveAtom.atomConnect(l_atom_lig, atom3["serial"])
                break

#     print conect3, "CN1, l367"
    if conect3 == ['N', 'C', 'C']:
        l_serial_check.append (l_atom4[0]["serial"])
#         print l_serial_check, "l370"
        if imidazoleATOM4(l_atom4, l_serial_check, l_atom_lig)[0] == 1:
            return [1, l_serial_check]

    return [0, l_serial_check]
Exemple #17
0
def CenterGuanidium (l_atom_connectN, l_atom_lig) : 
    
    
    l_atom_connect = []
    for atom_connectN in l_atom_connectN : 
        l_atom_connect.append (atom_connectN["element"])
    
    if l_atom_connect == ['N', 'C', 'C'] : 
        for C_atom in l_atom_connectN[1:] : 
            l_C_atom, l_connect = retrieveAtom.atomConnect(l_atom_lig, C_atom["serial"])
            if l_connect == ["C", "N", "N", "N"] : 
                return deepcopy(l_C_atom[0])
    
    
    if l_atom_connect == ["N", "C"] : 
        return deepcopy(l_atom_connectN[-1])
 
 
    print "ERROR"
    return "ERROR"
Exemple #18
0
def BondLengthCandX (l_atom_lig, X_element) : 
    
    l_dist = []
    l_serialX = searchPDB.ListSerialElement(l_atom_lig, str(X_element))
    
    for serialX in l_serialX : 
#         print serialX
        l_atom_connectX, connect = retrieveAtom.atomConnect(l_atom_lig, serialX)
        
        i = 0
        nb_connect = len (connect)
        while i < nb_connect : 
            if len(l_atom_connectX) >= 2 : 
                dist = calcul.distanceTwoatoms(l_atom_connectX[0], l_atom_connectX[1])
#                 print dist
                if dist != 100 : 
                    l_dist.append (str(dist))
            i = i + 1
    
    return l_dist
Exemple #19
0
def imidazoleATOM4(l_atom4, l_serial_check, l_atom_lig):
    """Check the atom4 4 in cercle of imidazole
    in : atoms ligand in list, serial of first nitrogen, name of ligand
    out : boolean"""
    
#     print l_serial_check, "l387"
    for atom4 in l_atom4:
        if atom4["element"] == "C":
            if not atom4["serial"] in l_serial_check : 
                l_atom5, conect4 = retrieveAtom.atomConnect(l_atom_lig, atom4["serial"])
                conect4.sort ()
                if conect4 == ["C", "C", "C", "N"] or conect4 == ["C", "C", "N"] : 
                    l_serial_check.append (l_atom5[0]["serial"])
                    imd, l_serial_check = imidazoleATOM5(l_atom5, l_serial_check, l_atom_lig)
#                     print l_serial_check, imd
                    if  imd == 1:
                        return [1, l_serial_check]
                    else :
                        l_serial_check.remove(l_atom5[0]["serial"])

    return [0, l_serial_check]
Exemple #20
0
def Guanidium(l_at_connect_N, l_atom_lig):
    """search Guanidium 
    in: list atom connected of nitrogen, list atom ligand
    out: 1 or 0"""
    
    connectN1 = toolSubstructure.matrixElement(l_at_connect_N)
    nb_NH = 0
    l_atom_out = []
    # atom lateral
    if connectN1 == ["N", "C"] :
        l_at_connect_c, connectC = retrieveAtom.atomConnect(l_atom_lig , l_at_connect_N[1]["serial"])
        if connectC == ["C", "N", "N", "N"] :
            l_atom_out.append (deepcopy(l_at_connect_c[0])) # append C
            groupAtomN1, conect_N1 = retrieveAtom.atomConnect(l_atom_lig , int (l_at_connect_c[0]["connect"][1]))
            groupAtomN2, conect_N2 = retrieveAtom.atomConnect(l_atom_lig , int (l_at_connect_c[0]["connect"][2]))
            groupAtomN3, conect_N3 = retrieveAtom.atomConnect(l_atom_lig , int (l_at_connect_c[0]["connect"][3]))
            l_conect = [conect_N1, conect_N2, conect_N3]
            l_group_atom =  [groupAtomN1, groupAtomN2, groupAtomN3]
            
            i = 0
            while i < 3 :  
                if l_conect[i] == ["N", "C"] : 
                    nb_NH = nb_NH + 1
                    i = i + 1
                elif l_conect[i] == ["N", "C", "C"]:  
                    if l_group_atom[i][1]["serial"] != l_at_connect_c[0]["serial"] : 
                        l_atom_out.append (deepcopy(l_group_atom[i][1]))
                    elif l_group_atom[i][2]["serial"] != l_at_connect_c[0]["serial"] : 
                        l_atom_out.append (deepcopy(l_group_atom[i][2]))
                    else : 
                        print "ERROR l158"
                        return [0, []]
                    i = i + 1
                else :
                    return [0, []]
                
            # check number primary connectN1 -> case GAI not take, change ?
            if nb_NH == 2  : 
                l_atom_out.append (deepcopy(groupAtomN1[0]))
                l_atom_out.append (deepcopy(groupAtomN2[0]))
                l_atom_out.append (deepcopy(groupAtomN3[0]))
                
        else :
            return [0, []]
    
    # atom central structure
    elif connectN1 == ["N", "C", "C"] : 
        for at_conect in l_at_connect_N[1:] : 
            l_group_at, conect_N = retrieveAtom.atomConnect(l_atom_lig , at_conect["serial"])
            if conect_N == ["C", "N", "N", "N"] :
                l_c_central = l_group_at
                l_atom_out.append (deepcopy(l_c_central[0]))
                for group_at in l_group_at[1:] : 
                    l_goup_N, connect_N = retrieveAtom.atomConnect(l_atom_lig , group_at["serial"])
                    if connect_N == ["N", "C"] : 
                        nb_NH = nb_NH + 1
            else : 
                l_atom_out.append (deepcopy(l_group_at[0]))

        if nb_NH >= 2 and len (l_atom_out) >= 2 :
            
            l_atom_out.append (deepcopy(l_c_central[1]))
            l_atom_out.append (deepcopy(l_c_central[2]))
            l_atom_out.append (deepcopy(l_c_central[3]))
        else : 
            return [0, []]
        
    
    
    if len (l_atom_out) != 5 : 
        return [0,[]]
    else : 
        # append 2 carbons
        l_C, connectC = retrieveAtom.atomConnect(l_atom_lig , l_atom_out[0]["serial"])
        if connectC == ["C", "N", "N", "N"] : 
            l_serial = [l_atom_out[1]["serial"], l_atom_out[0]["serial"]]
            atomC1 = l_atom_out[1]
        else : 
            l_serial = [l_atom_out[0]["serial"], l_atom_out[1]["serial"]]
            atomC1 = l_atom_out[0]
        
        # distance between C2 and N
        d1 = calcul.distanceTwoatoms(atomC1, l_atom_out[2])
        d2 = calcul.distanceTwoatoms(atomC1, l_atom_out[3])
        d3 = calcul.distanceTwoatoms(atomC1, l_atom_out[4])
        l_dist = [d1, d2, d3]
        l_dist.sort ()
        
        for dist in l_dist : 
            if dist == d1 : 
                l_serial.append (l_atom_out[2]["serial"])
            elif dist == d2 : 
                l_serial.append (l_atom_out[3]["serial"])
            else : 
                l_serial.append (l_atom_out[4]["serial"])
        
        return [1,l_serial]
    
    
    return [0, []]