chain.append(column[2]) if column[0] == "HETNAM": if column[1].isdigit() == False: lig_name.append(column[2]) if column[0] == 'REMARK': if column[1] == '2': if len(column) > 2: if column[2] == 'RESOLUTION.': resolution = column[3] print "RESOLUTION of pdb is " + str(resolution) + " Angstroms" print "list of ligands present:" + str(ligand) print "corresponding chains are:" + str(chain) print "Ligand name is " + str(lig_name) sys.stdout.flush() mol = mds.readMolecule( index) # read molecule from file do operation on molecule object mds.addHydrogens(mol) # add hydrogens to molecule object if len(ligand) == None: continue a = 0 for a in range(len(ligand)): if len(chain[a]) != 1: print "chain name is not character" chain[a] = chain[a][0] if len(ligand[a]) < 3: print " Ligand name is less than 3 characters" ligand[a] = ' ' + ligand[a] ligand_molecule = mds.extractLigand(mol, ligand[a], chain[a]) if ligand_molecule == None: print "ligand_molecule is none(not present)"
molecule_list = [] # read all the molecules in a directory and adds them to a list molecule_list = glob.glob(os.getcwd() + '/*.pdb') mds.enableDiagnosticOutput() # enable verbose output for index in molecule_list: print "start of molecule: " + os.path.basename(index) ligand = [] chain = [] lig_name = [] pdb_file = open(index, 'r') basic_info() sys.stdout.flush() # read molecule from file do operation on molecule object mol = mds.readMolecule(index) mds.addHydrogens(mol) # add hydrogens to molecule object if len(ligand) == None: continue a = 0 for a in range(len(ligand)): if len(chain[a]) != 1: print "chain name is not character" chain[a] = chain[a][0] if len(ligand[a]) < 3: print " Ligand name is less than 3 characters" ligand[a] = ' ' + ligand[a] ligand_molecule = mds.extractLigand(mol, ligand[a], chain[a]) if ligand_molecule == None:
#print "The score is " + str(score) logfile.write("The best pose is: " + str(pose)) logfile.write("The score is " + str(score)) print "XXXXXXXXXXXXXXXXXX" logfile.close() # read all the molecules in a directory and adds them to a list base_address = os.getcwd() + '/output/' receptor_address = os.getcwd() + '/pdb/' folder = [] folder = os.listdir(base_address) for x in folder: # read molecule from file do operation on molecule object receptor = mds.readMolecule(receptor_address + x + '_cleaned.mol2') os.chdir(base_address + '/' + x + '/') logfile = [] logfile = glob.glob(os.getcwd() + '/*.log') wb = xl.Workbook('best_poses.xlsx') ws = wb.add_worksheet() counter = 0 inter = xl.Workbook('interactions.xlsx') row = 1 col = 1 worksheet = inter.add_worksheet() counter2 = 0 interrow = 0 intercol = 0 for index in logfile: #worksheet = inter.add_worksheet()