from modeller import * from modeller.automodel import * import sys log.verbose() env = Environ() env.io.atom_files_directory = ['.', '../atom_files'] # Build 3 models, and assess with both DOPE and GA341 a = AutoModel(env, alnfile = 'alignment.ali', knowns = '5fd1', sequence = '1fdx', assess_methods=(assess.DOPE, assess.GA341)) a.starting_model= 1 a.ending_model = 3 a.make() # Get a list of all successfully built models from a.outputs ok_models = [x for x in a.outputs if x['failure'] is None] # Rank the models by DOPE score key = 'DOPE score' if sys.version_info[:2] == (2,3): # Python 2.3's sort doesn't have a 'key' argument ok_models.sort(lambda a,b: cmp(a[key], b[key])) else: ok_models.sort(key=lambda a: a[key]) # Get top model m = ok_models[0] print("Top model: %s (DOPE score %.3f)" % (m['name'], m[key]))