from modeller.automodel import *
#from modeller import soap_protein_od
log.verbose()
# Override the 'special_restraints' and 'user_after_single_model' methods:
class MyModel(AutoModel):
def special_restraints(self, aln):
# Constrain the A and B chains to be identical (but only restrain
# the C-alpha atoms, to reduce the number of interatomic distances
# that need to be calculated):
s1 = Selection(self.chains['A']).only_atom_types('CA')
s2 = Selection(self.chains['B']).only_atom_types('CA')
s3 = Selection(self.chains['C']).only_atom_types('CA')
s4 = Selection(self.chains['D']).only_atom_types('CA')
s5 = Selection(self.chains['E']).only_atom_types('CA')
s6 = Selection(self.chains['F']).only_atom_types('CA')
self.restraints.symmetry.append(Symmetry(s1, s2, 1.0))
def user_after_single_model(self):
# Report on symmetry violations greater than 1A after building
# each model:
self.restraints.symmetry.report(1.0)
env = Environ()
# directories for input atom files
env.io.atom_files_directory = ['.', '../atom_files']
# Be sure to use 'MyModel' rather than 'AutoModel' here!
a = MyModel(env,
alnfile = 'aligned.ali' , # alignment filename
knowns = 'template', # codes of the templates
sequence = 'target',
assess_methods=(assess.DOPE)) # code of the target
a.starting_model= 1 # index of the first model
a.ending_model = 100 # index of the last model
# (determines how many models to calculate)
a.make() # do comparative modeling
# Get a list of all succesfully built models from a.output
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):
ok_models.sort(lambda a,b: cmp(a[key], b[key]))
else:
ok_models.sort(key=lambda a: a[key])