Ejemplo n.º 1
0
def WriteDataset (d_lig_PDB, pr_init, debug = 1) :                
    """
    Write folder with dataset 
    -> run quality criteria analysis
    
    """
    
    pr_quality = pathManage.parsingDataset(pr_init)     
    l_RX = []
    l_RFree = []           
    d_dataset = structure.resolutionFilter()
            
                
    for lig in d_lig_PDB.keys () :
        if debug == 1 : 
            print "===Write dataset-1==="
            print lig, "ligand"
            print d_lig_PDB[lig], "list of PDB"
        for PDB in d_lig_PDB[lig]:
            if debug == 1 :
                print "===Write dataset-2===" 
                print PDB, lig, "PDB + lig"
                print d_dataset, "append struct"
            quality = parsing.Quality(PDB)
            RX = quality[0]
            RFree = quality[1]
            BuilderDatasetDict(PDB, lig, RX, d_dataset)
            l_RX.append (RX)
            l_RFree.append (RFree)
    
    
    # quality
    p_rx = writeFile.listFloat(l_RX, pr_quality + "RX")
    p_rf = writeFile.listFloat(l_RFree, pr_quality + "RFree")
    
    runScriptR.histDistance(p_rx, "RX")
    runScriptR.histDistance(p_rf, "RFree")
    
    return writeFile.resultFilterLigandPDB(d_dataset, pr_init )
Ejemplo n.º 2
0
def GlobalBondLength (name_database, RX_thresold = 1.5):
    
    # directory
    pr_result = pathManage.result(name_database + "/CXbound" + str (RX_thresold))
    pr_database = pathManage.result(name_database)
    
    # filout with distance
    p_CN = pr_result + "distanceCN"
    p_CO = pr_result + "distanceCO"
    p_CC = pr_result + "distanceCC"
    p_coplar = pr_result + "distanceCoplar"
    
    
    filout_CN = open (p_CN, "w")
    filout_CO = open (p_CO, "w")
    filout_CC = open (p_CC, "w")
    filout_coplar = open (p_coplar, "w")
    
    # load PDB with logand
    if not path.exists(pr_database + "resultLigandInPDB") : 
        print "ERROR => file with ligand and PDB does not exist"
        return
    else : 
        d_lig_PDB = loadFile.LigandInPDB(pr_database + "resultLigandInPDB")
    
 
    nb_lig = len(d_lig_PDB.keys())
    print d_lig_PDB.keys()
    
    i = 0
    while (i < nb_lig):
        name_lig = d_lig_PDB.keys()[i]
        
        l_PDB = d_lig_PDB[name_lig]
        
        for PDB in l_PDB : 
            # controle RX
            RX = parsing.Quality(PDB)[0]
#             print RX
            
            if RX <= RX_thresold : 
                l_atom_lig = loadFile.ligandInPDBConnectMatrixLigand(PDB, name_lig)
                
                l_distCN = BondLengthCandX (l_atom_lig, "N")
                l_distCO = BondLengthCandX (l_atom_lig, "O")
                l_distCC = BondLengthCandX (l_atom_lig, "C")
                l_coplarIII = CoplanarityIII(l_atom_lig)
                
                if l_distCN != [] : 
                    filout_CN.write ("\n".join (l_distCN) + "\n")
                
                if l_distCO != [] : 
                    filout_CO.write ("\n".join (l_distCO) + "\n")    
                
                if l_distCC != [] : 
                    filout_CC.write ("\n".join (l_distCC) + "\n")                
                
                if l_coplarIII != [] : 
                    filout_coplar.write ("\n".join (l_coplarIII) + "\n")  
                
                # take only one PDB by ligand not more
                i = i + 1
                continue
            i = i + 1
        
    filout_CO.close ()
    filout_CN.close ()
    filout_CC.close ()
    filout_coplar.close ()
    
    runScriptR.histDistance(p_CN, "CN")
    runScriptR.histDistance(p_CO, "CO") 
    runScriptR.histDistance(p_CC, "CC") 
    runScriptR.histDistance(p_coplar, "coplar")