Hi Korbin,
The format of the information is controlled by your preferences settings (specifically, the "atom spec display style" preference in the "Labels" category).  Therefore, I surmise that when you run through xterm you are either doing this on a different machine or using a different account than when you run it in IDLE (and therefore would have different [probably default] preferences).
To sidestep this issue, you can use the underlying function that str() on a Residue calls to explicitly specify the formatting.  The function is named chimeraLabel and if given the keyword argument style="simple" it will use the format that includes the residue name.  So the first lines of your loop would become:

from chimera.misc import chimeraLabel
for p in range(0,len(res_list)):
    x= chimeraLabel(res_list[p], style="simple")

BTW, it probably simpler and clearer to iterate through the residues in the list, rather than through the indexes into the list.  So I would change the above to:

from chimera.misc import chimeraLabel
for r in res_list:
x = chimeraLabel(r, style="simple")

--Eric

                        Eric Pettersen
                        UCSF Computer Graphics Lab
                        http://www.cgl.ucsf.edu

On Apr 21, 2015, at 1:46 PM, Korbin West <khwest16@wabash.edu> wrote:

Hi all,

I'm trying to determine uncommon ligands in pdb files using a python code, but have run into an odd dilemma.

In my code, I open a pdb in Chimera, select the ligand, and write out the residue list.  However, the formatting of this list changes depending on how I run the program.

If I run the program through xterm, it will print out only residue numbers. If I run the program though Chimera's Idle, however, I will get the residue codes and the residue numbers. 

For example, I ran this with 3VKG, you can see the results in the attached files, where I show a sample code of what I'm using, the xterm results and the Chimera results.

I want to do this for a large number of pdbs, so I'd like to do this --nogui through xterm, but I need the residue codes. Has anyone else ran into this problem or know of a work-around? Thanks in advance.

Best,

Korbin West
Wabash College
<residue_testing.py><testing_file_chimera.txt><testing_file_xterm.txt>_______________________________________________
Chimera-users mailing list
Chimera-users@cgl.ucsf.edu
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users