Dimitry.A.Suplatov wrote: > I use the following script > --------------------------------------------------------------------------------------------- > ... > class mymodel(automodel): > def special_restraints(self, aln): > rsr = self.restraints > for ids in (('OD1:282:B', 'CA:765:B'), > ('OD2:282:B', 'CA:765:B'), > ('OD1:285:B','CA:765:B'), > ('OD2:460:B', 'CA:765:B'), > ('OE2:152:A', 'CA:765:B')): > atoms = [self.atoms[i] for i in ids] > rsr.add(forms.upper_bound(group=physical.upper_distance, > feature=features.distance(*atoms), > mean=2.5, stdev=0.1)) > > def special_restraints(self, aln): > rsr2 = self.restraints > for ids1 in (('OE2:152:A', 'CA:765:B')): > atoms = [self.atoms[j] for j in ids1] > rsr2.add(forms.upper_bound(group=physical.upper_distance, > feature=features.distance(*atoms), > mean=2.3, stdev=0.1))
You can't define the same routine twice and expect both of them to work! Only the second one will get called - the first will be ignored. Just combine the two routines into one.
> Then I get this error > _modeller.error: indxatm_278E> No ":" in ATOM:RESID[:CHAINID] atom > identifier: O > > I am using python for the first time so that must be some problem with > the script.
Yes, it's because of the way Python handles tuples. In your script you have:
for ids1 in (('OE2:152:A', 'CA:765:B')): atoms = [self.atoms[j] for j in ids1]
i.e. your intention is to go through a list of pairs (just one pair in this case) and for each one assign 'atoms' to be a pair of atom objects. But in Python you can't define a one-element list that way - Python just ignores the second pair of parentheses. Instead, you need to do:
for ids1 in (('OE2:152:A', 'CA:765:B'),): atoms = [self.atoms[j] for j in ids1]
i.e. add a trailing comma. See http://docs.python.org/tut/node7.html#SECTION007300000000000000000
Ben Webb, Modeller Caretaker