Spencer's example was in PyMOL command syntax (.pml script). To use it in a 
Python script, it would look like this:

from pymol import cmd, stored
stored.f = open("ss.txt", "w")
cmd.iterate("n. CA", "stored.f.write(resi + ':' + ss+'\n')")
stored.f.close()

Cheers,
  Thomas

On 13 Jan 2017, at 18:44, Academic Research <ac.resea...@icloud.com> wrote:

> Thank you for your replay.
> 
> Running the command from a python code is much better for me. But can you 
> elaborate more about the code? it still gives me a syntax error:
> 
> file.py
> import pymol
> f=open("ss.txt","w")
> iterate n. CA, f.write(resi + ':' + ss+"\n")
> f.close()
> 
> Result:
> File "1.py", line 3
> iterate n. CA, print ss #f.write(resi + ':' + ss+"\n")
>             ^
> SyntaxError: invalid syntax
> 
> 
> How can I fix it?
> Where do I call the .pdb file?
> 
> On Jan 13, 2017, at 02:59 pm, Spencer Bliven <spencer.bli...@gmail.com> wrote:
> 
>> This can be done using normal python file i/o:
>> 
>> f=open("ss.txt","w")
>> iterate n. CA, f.write(resi + ':' + ss+"\n")
>> f.close()
>> 
>> On Fri, Jan 13, 2017 at 10:38 AM, Academic Research <ac.resea...@icloud.com> 
>> wrote:
>> That would be good as well, How?
>> 
>> keep in mind, my protein is synthetic, it is not from the PDB database, and 
>> the .pdb file only contains ATOMS, no header or anything else.
>> 
>> On Jan 13, 2017, at 12:37 pm, Albert <mailmd2...@gmail.com> wrote:
>> 
>>> I think you can obtain it from your Linux  terminal 
>>> 
>>> 
>>> 
>>> On 01/13/2017 10:34 AM, Academic Research wrote:
>>>> Pymol Professionals I need your help,
>>>> 
>>>> I have the following command:
>>>> 
>>>> iterate n. CA, print resi + ':'
>>>>  + ss
>>>> 
>>>> I use this command in pymol to print out each residue number and its 
>>>> corresponding secondary structure. The command prints out the result in 
>>>> pymol itself.
>>>> 
>>>> My question is: How can I save the output from this command into a file?
>>>> 
>>>> AC Research

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to