def log_new_clusters(output_file, n, leader_list): print "log %d ligands. For change this number set the -n parameter" % n str_info = "\t%s\t \t%20s\t %20s\t %20s\n" % ("File", "Model", "T.Energy", "I.Energy") for i in range(0, n): str_info += "%s\t%20s\t%20s\t%20s\n" % ( leader_list[i].getFileBelow().split('/').pop(), leader_list[i].getID(), leader_list[i].getTotalEnergy(), leader_list[i].getInteractionEnergy()) out_log = file(output_file + ".log", "w") out_log.write(str_info) out_log.close() conv = OBConversion() conv.SetOutFormat("mol2") conv.WriteFile(leader_list[0], output_file + ".mol2") for i in range(1, n): conv.Write(leader_list[i]) conv.CloseOutFile()
def log_new_clusters(output_file, n, leader_list, ref=None): print "log %d ligands. For change this number set the -n parameter" % n str_info = "\t%s\t %20s\t %20s\t %20s \t%15s\n" % ( "File", "Model", "T.Energy", "I.Energy", "RMSD") if ref != None: mol_ref = loadReferenceMolecule(ref) if ref != None: for i in range(0, n): str_info += "%s\t%20s\t%20s\t%20s\t%15.3f\n" % ( leader_list[i].getFileBelow(), leader_list[i].getID(), leader_list[i].getTotalEnergy(), leader_list[i].getInteractionEnergy(), getRMSD(leader_list[i], mol_ref)) else: for i in range(0, n): str_info += "%s\t%20s\t%20s\t%20s\t%15.3f\n" % ( leader_list[i].getFileBelow(), leader_list[i].getID(), leader_list[i].getTotalEnergy(), leader_list[i].getInteractionEnergy(), getRMSD(leader_list[i], leader_list[0])) out_log = file(output_file + ".log", "w") out_log.write(str_info) out_log.close() conv = OBConversion() conv.SetOutFormat("mol2") conv.WriteFile(leader_list[0], output_file + ".mol2") for i in range(1, n): conv.Write(leader_list[i]) conv.CloseOutFile()