Example #1
0
def globalSearch (dist_thresold, p_file_dataset,  pr_result, debug = 1):
    
    
    pr_summary = pr_result + "Sum/"
    
    if debug : print "Directory summary", pr_summary
    
    
    # load structure in summary ---> if use need place option one PDB by ligand
    d_neighbor = loadFile.loadCloseStruct (pr_summary)
    
    if d_neighbor != None : 
        if debug : 
            print "Type of structure stock", type (d_neighbor["global"])
        return d_neighbor
     
    
    #start, logFile = log.initAction("search neighbors in " +path.basename(p_file_dataset))
    l_lig = loadFile.resultFilterPDBLigand(p_file_dataset)
    nb_lig = len(l_lig)
    
    # ##Count Structure
    d_neighbor = {}
    l_neighbor_global = []

    
    # ##Write summary file
    d_files_summary = writeFile.openFileSummary(pr_summary)# sumary result
    
    # inialization  !!!!!!! 
     
    i = 0
    while i < nb_lig :
        if debug: print "Ligand: " + str(l_lig[i]["name"]) + " " + str(i) + " " + str(nb_lig)
        nb_PDB = len(l_lig[i]["PDB"])
        
        # take only one PDB by ligand
            
        j = 0
        while j < nb_PDB : 
            name_PDB = l_lig[i]["PDB"][j]
            l_atom_ligand = loadFile.ExtractInfoPDBID(l_lig[i]["PDB"][j])[l_lig[i]["name"]][0] # change not tested
            
            # search neighbor for every atom in ligand selected
            globalNeighbors(dist_thresold, l_atom_ligand, name_PDB, l_neighbor_global)
            # search neighbor for interest 
            interestGroup(dist_thresold, l_atom_ligand, name_PDB, d_neighbor)
            
            j = j + 1
        i = i + 1
            
    
    
    writeFile.neighborStruct(d_neighbor, l_neighbor_global, d_files_summary)
    writeFile.closeFileSummary(d_files_summary)
    
    # case where load directly substructure => why do not load directly in dictionnary
    d_neighbor["global"] = l_neighbor_global
    return d_neighbor
Example #2
0
def searchLigandInDataSetFile (datasetFile, nameLigand):
    """Search ligand in dataset file (out dataset construction)
    in: dataset file, name of ligand
    out: index of ligand or 0"""
    
    listLigandsInPDB = loadFile.resultFilterPDBLigand(datasetFile)
    nbLigand = len(listLigandsInPDB)
    i = 0
    while i < nbLigand :
        if listLigandsInPDB[i]["name"] == nameLigand : 
            return i
        
        i = i + 1
        
    return 0
Example #3
0
def retrievePDBFile(fileDataset, dir_PDB):
    ligandWithPDB = loadFile.resultFilterPDBLigand(fileDataset)
    
    for ligandPDB in ligandWithPDB :
        for pdbName in ligandPDB["PDB"] :
            pdbFilePath = dir_PDB + pdbName + ".pdb"
            if not isfile(pdbFilePath) :
                adressePDB = "http://www.pdb.org/pdb/files/" + pdbName + ".pdb"
                try:
                    pathFilePDB = urlretrieve(adressePDB)
                    print pathFilePDB
        
                    cmd = "mv " + pathFilePDB[0] + " " + pdbFilePath
                    print cmd
                    system (cmd)
        
                except:
                    print "Impossible retrieve PDB file"
Example #4
0
def SearchNeighbor (pr_data, pr_result, dist_thresold = 5.0, debug = 1): 
    
    # write file with HETATM in PDB -> to used same function
    l_lig_model = ["ZMA", "UNK", "RES", "CAU", "P0G", "CY8", "1KS"] # goal of this list is to remove the modified amino acid
    ControlHETATOMModelFile (pr_data, pr_result, l_lig_control = l_lig_model)

    l_drug = listdir(pr_data)
    d_out = {}
    
    for drug in l_drug :
         
        # pr result
        pr_drug = pathManage.CreatePathDir(pr_result + str(drug) + "/")
        l_lig = loadFile.resultFilterPDBLigand(pr_drug + "ligInModel")
        
        if debug == 1 : 
            print "List ligand for drug->"
            print drug
            print len (l_lig)
            print l_lig
        
        
        if l_lig == [] : 
            print "ERROR: find HET in model -> l68 GPCRDockAnalysis"
            return {}
        else : 
            #file summary
            pr_summary = pr_drug + "Sum/"
            
            # load structure in summary ---> if use need place option one PDB by ligand
            d_neighbor = loadFile.loadCloseStruct (pr_summary,  control_empty_file = 0)
            
            if d_neighbor == None : 
                
                print "Write Sum File"
                #write summary file
                d_files_summary = writeFile.openFileSummary(pr_summary)
            
                # structure of stock
                
                d_neighbor = {}
                l_neighbor_global = []
            
            
                # search neighbor
                nb_lig = len (l_lig)
                i = 0
                
                while i < nb_lig : 
                    j = 0
                    nb_model = len (l_lig[i]["PDB"])
                    print nb_model
                    while j < nb_model : 
                        
                        l_atom_ligand = loadFile.ExtractInfoPDBID(l_lig[i]["PDB"][j])[l_lig[i]["name"]][0] # change not tested
                    
                        # search neighbor for every atom in ligand selected
                        searchPDB.globalNeighbors(dist_thresold, l_atom_ligand, l_lig[i]["PDB"][j], l_neighbor_global)
                        # search neighbor for interest 
                        searchPDB.interestGroup(dist_thresold, l_atom_ligand, l_lig[i]["PDB"][j], d_neighbor, more_flex = 1)
                    
                        j = j + 1
                    i = i + 1
                    
            
                writeFile.neighborStruct(d_neighbor, l_neighbor_global, d_files_summary)
                writeFile.closeFileSummary(d_files_summary)
            
                # case where load directly substructure => why do not load directly in dictionnary
                d_neighbor["global"] = l_neighbor_global
        
        
        #stock
        print "Stock neighbor l164:", d_neighbor.keys()
        if not drug in d_out.keys () :
            d_out[drug] = deepcopy(d_neighbor)
            
        
    return d_out