Hello. I want to define restraints while modeling with ligand and I want to define different restraints. 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))
env = environ() env.io.hetatm = True env.io.water = True ...
---------------------------------------------------------------------------------------------
Then I get this error
-------------------------------------------------------------------------------------------- Traceback (most recent call last): File "model-ca.py", line 32, in ? a.make() File "C:\Program Files\Modeller9v1\modlib\modeller\automodel\automodel.py", line 108, in make self.homcsr(exit_stage) File "C:\Program Files\Modeller9v1\modlib\modeller\automodel\automodel.py", line 427, in homcsr self.mkhomcsr(selection(self), aln) File "C:\Program Files\Modeller9v1\modlib\modeller\automodel\automodel.py", line 537, in mkhomcsr self.special_restraints(aln) File "model-ca.py", line 19, in special_restraints atoms = [self.atoms[j] for j in ids1] File "C:\Program Files\Modeller9v1\modlib\modeller\coordinates.py", line 127, in __getitem__ (self.offset, self.length, self.suffix)) File "C:\Program Files\Modeller9v1\modlib\modeller\util\modutil.py", line 76, in handle_seq_indx int_indx = lookup_func(*args) File "C:\Program Files\Modeller9v1\modlib\modeller\coordinates.py", line 40, in _indxatm newindx = _modeller.indxatm2(indx+suffix, self.modpt) - 1 - offset _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. Do you have any suggestions? Thank you!
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
participants (2)
-
Dimitry.A.Suplatov
-
Modeller Caretaker