Why Modeller gives me an error?
Hello. I need to optimize amino acids located 5A from the ligand for this purpose I use this code:
#residues to optimize:
select=selection(mdl1) select1=select.only_het_residues() select2=select1.select_sphere(5) select3=select2.only_std_residues() select4=select3.by_residue()
mdl1.restraints.unpick_all() mdl1.restraints.pick(select4)
select4.energy()
select4.randomize_xyz(deviation=4.0)
mdl1.env.edat.nonbonded_sel_atoms=2 optimize(select4, sched)
mdl1.env.edat.nonbonded_sel_atoms=1 optimize(select4, sched)
select4.energy() mdl1.write(file=model_name+'_docked_opt'+str(i)+'.pdb')
This works for most structures but for a few I have this error:
mdl.restraints.pick(select4) File "C:\Program Files (x86)\Modeller9.21\modlib\modeller\restraints.py", line 94, in pick raise ValueError("selection refers to a different model") ValueError: selection refers to a different model
On 12/18/19 7:01 AM, Studia Studia wrote: > Hello. I need to optimize amino acids located 5A from the ligand for > this purpose I use this code: ... > This works for most structures but for a few I have this error: > > mdl.restraints.pick(select4) > File "C:\Program Files > (x86)\Modeller9.21\modlib\modeller\restraints.py", line 94, in pick > raise ValueError("selection refers to a different model") > ValueError: selection refers to a different model
For some of your structures there are no amino acids within 5A of the ligand, so the selection is empty. I'll improve the wording of the error message here. You'll need to check for an empty selection and handle such structures accordingly (perhaps just skip them), e.g.
if len(select4) > 0: mdl1.restraints.pick(select4) select4.energy() ... mdl1.write(file=model_name+'_docked_opt'+str(i)+'.pdb') else: print("Skipping structure")
Ben Webb, Modeller Caretaker
participants (2)
-
Modeller Caretaker
-
Studia Studia