From: Thomas H. <th...@th...> - 2021-10-13 19:21:22
|
Hi Shivani, Your selection needs to be object-specific, e.g. like this: for filename in glob("*.pdb"): cmd.load(filename) obj = filename[:-4] editor.attach_amino_acid(obj + " and resi 10 and name N", 'ace') Hope that helps. Cheers, Thomas > On Oct 9, 2021, at 21:18, shivani sharma <shi...@gm...> wrote: > > Hi everyone, > > I am trying to cap (with ace and nme) various *.pdbs. I made a folder, where I have placed *.py file and *.pdb files. When I load the run following script: > > from pymol import cmd, editor > from glob import glob > for filename in glob("*.pdb"): > cmd.load(filename) > editor.attach_amino_acid("resi 10 and name N", 'ace') > editor.attach_amino_acid("resi 11 and name C", 'nme') > > It is opening all files but capping only one of the files and giving me back an error: > Traceback (most recent call last): > File "pyformol.py", line 6, in <module> > editor.attach_amino_acid("resi 10 and name N", 'ace') > File "C:\Users\Shivani\AppData\Local\Schrodinger\PyMOL2\lib\site-packages\pymol\editor.py", line 129, in attach_amino_acid > raise pymol.CmdException("invalid connection point: must be one atom, name N or C.") > pymol.CmdException: Error: invalid connection point: must be one atom, name N or C. > > This seems like a looping error. I haven't been able to find much about "glob". Could someone suggest an easy way out? I want to create a loop where ace and nme should be added to all the dipeptides and save them as separate pdb files. > > Shivani > _______________________________________________ > PyMOL-users mailing list > Archives: http://www.mail-archive.com/pym...@li... > Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe |