Hey Virginia,

You have one less indentation level in that line. Python then considers it out of the class MyModel and thus, rsr is not previously declared. Just hit tab/4 spaces behind rsr.add and it should work.

Best,

João

No dia 3 de Set de 2012 22:45, "virginia miguel" <virgimiguel@yahoo.com.ar> escreveu:
Hi everyone,

I am trying to build a chimera protein based on two known structures  that do not overlap, and I am trying to specify an angle restrain between the two domains that are model to give information of their relative orientation obtained experimentally  using this script:


# Homology modeling with multiple templates

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'

class MyModel(automodel):
    def special_restraints(self, aln):
        rsr = self.restraints
        at = self.atoms
        f = forms.gaussian(group=physical.angle,
                       feature=features.angle(a['CA:796'],
                                                            a['CA:822'],
                                                           a['CA:855']),
                       mean=2.827, stdev=0.010)
    rsr.add(f)



a = MyModel(env,
              alnfile   = 'align2.ali',                                                          # alignment filename
              knowns    = ('2OK2','1FW6','1E3M'),                                 # codes of the templates
              sequence  = 'PAOI')                                                           # code of the target
a.starting_model= 1                                                                        # index of the first model
a.ending_model = 50                                                                      # index of the last model
                                                                                                        # (determines how many models to calculate)
a.make()


but I get this error:


 File "model-multiple.py", line 12, in ?
    class MyModel(automodel):
  File "model-multiple.py", line 21, in MyModel
    rsr.add(f)
NameError: name 'rsr' is not defined



So I do not know what I am missing....if someone can help me!


Thank you in advance! Virginia.

I arise in the morning torn between a desire to improve the world and a
desire to enjoy the world. This makes it hard to plan the day. (E.B. White)

_______________________________________________
modeller_usage mailing list
modeller_usage@salilab.org
https://salilab.org/mailman/listinfo/modeller_usage