def SearchChemicalSubstruct (pr_data, pr_result, control = 0): # substructure search p_filout = pr_result + "findSruct" filout = open (p_filout, "w") l_ligand = listdir(pr_data) print l_ligand for ligand in l_ligand : print ligand l_file = listdir(pr_data + ligand + "/") for f in l_file : if ligand == "ZM241385" or ligand == "source": group = f else : group = f.split ("_")[-2] p_file_PDB = pr_data + ligand + "/" + f print p_file_PDB if control == 1 : ControlPDBFormat(p_file_PDB) l_atom = parsing.loadCoordSectionPDB(p_file_PDB, remove_H = 1) if ligand == "ZM241385" : ll_atom_lig = parsing.retrieveLigand(l_atom, "ZMA") else : ll_atom_lig = parsing.retrieveLigand(l_atom, "RES") for l_atom_lig in ll_atom_lig : l_subs = searchPDB.interestStructure(l_atom_lig, more_flex = 1) filout.write (str (ligand) + "\t" + str (f) + "\t" + str (group) + "\t" + " ".join(l_subs) + "\n") filout.close () # best group ergomine -> 2128 (2013) && 6882 (2013) # best group taladegid -> 7527 (2013) Vanderblit # best group eticlopride -> 1285 (2010) # ZM241385 => mod7msp
def ControlPDBFormat (p_PDB): """ Rewrite model PDB file """ l_res = ["ILE", "LEU", "LYS", "PHE", "TYR", "VAL", "SER", "MET", "ARG", "TRP", "PRO", "GLY", "GLU", "ASN", "HIS", "ALA", "ASP", "GLN", "THR", "CYS"] l_atom_PDB = parsing.loadCoordSectionPDB(p_PDB) filout = open (p_PDB, "w") l_atom_het = [] for atom_PDB in l_atom_PDB : if atom_PDB["resName"] in l_res : writePDBfile.coordinateSection(filout, [atom_PDB], "ATOM", header = 0) else : l_atom_het.append (deepcopy(atom_PDB)) writePDBfile.coordinateSection(filout, l_atom_het, recorder = "HETATM", header = 0, connect_matrix = 1) filout.close ()