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