Accessing output data after modeling is complete

After AutoModel.make() finishes building your model(s), the output data is accessible to your script as AutoModel.outputs. This variable is an ordinary Python list, one element for each model (so a.outputs[0] refers to the first model, and so on). Each list element is a Python dictionary of key:value pairs, the most important of which are:

If you are also building loop models, information for these is made available in LoopModel.loop.outputs.

Example: examples/automodel/model-outputs.py

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]))