Hi Ben, I try to make a distance restraint between two atoms (protein and cofator) in a homodimer protein. However, I face another error: [flavios@localhost]$ mod9.13 model-mult-simmetry-bond.py Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 'import site' failed; use -v for traceback Traceback (most recent call last): File "model-mult-simmetry-bond.py", line 40, in ? a.make() File "/usr/lib/modeller9.13/modlib/modeller/automodel/automodel.py", line 108, in make self.multiple_models(atmsel) File "/usr/lib/modeller9.13/modlib/modeller/automodel/automodel.py", line 212, in multiple_models self.outputs.append(self.single_model(atmsel, num)) File "/usr/lib/modeller9.13/modlib/modeller/automodel/automodel.py", line 308, in single_model self.model_analysis(atmsel, filename, out, num) File "/usr/lib/modeller9.13/modlib/modeller/automodel/automodel.py", line 350, in model_analysis self.user_after_single_model() File "model-mult-simmetry-bond.py", line 34, in user_after_single_model rsr.add(forms.gaussian(group=physical.xy_distance, feature=features.distance(at['NZ:38'], at['C4:382']), mean=1.5, stdev=0.1)) NameError: global name 'rsr' is not defined
I am certain that it must be an script error, but I do not know how to fix (I am not familiar with python script). My script is:
# Homology modeling with single template from modeller import * # Load standard Modeller classes from modeller.automodel import * # Load the automodel class
log.verbose() # request verbose output env = environ() # create a new MODELLER environment to build this model in
# directories for input atom files env.io.atom_files_directory = ['.', '../atom_files']
# Read in HETATM records from template PDBs env.io.hetatm = True env.io.water = True
class MyModel(automodel): def special_restraints(self, aln): rsr = self.restraints at = self.atoms # Constrain the A, B, C and D 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') self.restraints.symmetry.append(symmetry(s1, s2, 1))
def user_after_single_model(self): # Report on symmetry violations greater than 1A after building # each model: self.restraints.symmetry.report(1.0)
#Restrain between LYS and PLP (st. dev.=0.1) #Use a harmonic potential and X-Y distance group. rsr.add(forms.gaussian(group=physical.xy_distance, feature=features.distance(at['NZ:38'], at['C4:382']), mean=1.5, stdev=0.1)) rsr.add(forms.gaussian(group=physical.xy_distance, feature=features.distance(at['NZ:424'], at['C4:768']), mean=1.5, stdev=0.1))
a=MyModel(env, alnfile='AlRacem-mult.ali', knowns=('4A3Q', '1BD0'), sequence='AlRacem', assess_methods=(assess.DOPE, assess.GA341)) a.starting_model = 1 a.ending_model = 10 a.make()
# Get a list of all successfully built models from a.outputs ok_models = filter(lambda x: x['failure'] is None, a.outputs)
# Rank the models by DOPE score key = 'DOPE score' ok_models.sort(lambda a,b: cmp(a[key], b[key]))
# Get top model m = ok_models[0]
print "Top model 1: %s (DOPE score %.3f)" % (m['name'], m[key]) m = ok_models[1]
print "Top model 2: %s (DOPE score %.3f)" % (m['name'], m[key]) m = ok_models[2]
print "Top model 3: %s (DOPE score %.3f)" % (m['name'], m[key]) m = ok_models[3]
print "Top model 4: %s (DOPE score %.3f)" % (m['name'], m[key]) m = ok_models[4]
print "Top model 5: %s (DOPE score %.3f)" % (m['name'], m[key])
------------------------------------- Flavio Augusto Vicente Seixas Laboratory of Structural Biochemistry Department of Biochemistry Universidade Estadual de Maringá, PR, Brazil http://www.uem.br
On 8/13/14, 10:43 AM, flavio seixas wrote: > NameError: global name 'rsr' is not defined > > > I am certain that it must be an script error, but I do not know how to > fix (I am not familiar with python script).
There is a great Python tutorial at www.python.org. You have an elementary error in your script - you have to put your custom restraints in the special_restraints() method - i.e. move the two lines starting with rsr.add(... to immediately after the line starting with self.restraints.symmetry.append(...
BTW, if you really have two chains in your model, you'll need to specify the chain ID for each atom in your restraints or Modeller won't be able to find it, e.g. NZ:38:A rather than NZ:38.
Ben Webb, Modeller Caretaker
participants (2)
-
flavio seixas
-
Modeller Caretaker