Hi Thomas,

Thanks for your reply. I am currently using:
















*import __main____main__.pymol_argv = ['pymol','-qc']from pymol import cmd,
editorpymol.finish_launching()import globimport ospath =
os.path.dirname(pymol.__script__)pdb_files = glob.glob(os.path.join(path,
'*.pdb'))cmd.delete('all')for pdb in pdb_files:    cmd.load(pdb)
editor.attach_amino_acid("resi 10 and name N", 'ace')
editor.attach_amino_acid("resi 11 and name C", 'nme')    cmd.save(pdb)
cmd.delete('all')*

This seems to be working fine for me.

Shivani

On Thu, 14 Oct 2021 at 00:22, Thomas Holder <tho...@thomas-holder.de> wrote:

> 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 <shivanis0...@gmail.com> 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/pymol-users@lists.sourceforge.net
> > Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>
>
_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to