Ligand selection information

Hello. I'm fairly new to Chimera and Python programming, I'm still trying to pick up a lot of it as I go. I'm going through some data and am trying to get the information about a ligand in a protein. So in my script I'm using the runCommand function to get the info on the ligand, but I'd like a way to do so without writing it to a file. Here's what I have at the moment, writing the information to a file. runCommand('open 2izh') runCommand('sel ligand') runCommand("writesel ~/Desktop/testligand.txt") And here's an excerpt of the testligand.txt file: #1 BTN 300.B #1 HOH 1777.B #1 HOH 1778.B #1 BTN 300.D #2 ACY 801.B #2 SER 308.C #3 BTN 300.B Is there a way I can just access this information as a list or something so I don't have to write the file then open the file to see the info? I'd like to continue the script to sort out through some of this information but I'm dealing with a lot of pdb files so I'd prefer not to have write a file, open it, read it, then rewrite it and repeat a ton of times. Thanks so much, Korbin West

Hi Korbin, I'm not sure if you meant you just wanted to access the information programmatically, in which case somebody else who knows python should respond, but one possibility instead of writing a file is to send the information to the Reply Log. You can do that by specifying the writesel output filename as "-" (just the dash, no quotes). <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/writesel.html> I wouldn't expect the residues you listed to be considered "ligand" so I opened 2izh and tried it, which just gives me the two BTN residues. Best, Elaine ---------- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Oct 15, 2014, at 1:58 PM, Korbin West <khwest16@wabash.edu> wrote:
Hello.
I'm fairly new to Chimera and Python programming, I'm still trying to pick up a lot of it as I go. I'm going through some data and am trying to get the information about a ligand in a protein. So in my script I'm using the runCommand function to get the info on the ligand, but I'd like a way to do so without writing it to a file.
Here's what I have at the moment, writing the information to a file.
runCommand('open 2izh') runCommand('sel ligand') runCommand("writesel ~/Desktop/testligand.txt")
And here's an excerpt of the testligand.txt file:
#1 BTN 300.B #1 HOH 1777.B #1 HOH 1778.B #1 BTN 300.D #2 ACY 801.B #2 SER 308.C #3 BTN 300.B
Is there a way I can just access this information as a list or something so I don't have to write the file then open the file to see the info? I'd like to continue the script to sort out through some of this information but I'm dealing with a lot of pdb files so I'd prefer not to have write a file, open it, read it, then rewrite it and repeat a ton of times.
Thanks so much,
Korbin West

Hi Korbin, In Python you can get a list of the currently selected residues with: res_list = chimera.selection.currentResidues() That returns Residue objects, which are described some in the Chimera Programmer's Guide. In IDLE Python shell (Tools->General Controls->IDLE) you can also get some description of Residue capabilities with: help(chimera.Residue) You could also nose around the Chimera code (which is in your Chimera distribution) to see how things are done or ask questions here or on the chimera-dev mailing list (more "programmer-y" questions are better on the latter). I note that your "ligand" list contains waters, likely due to those waters having altlocs which confuses the classification code. This "confusion" only exists in the 1.9 production release or earlier. If you get the 1.10 daily build or the 1.10 release candidate then those waters will not be classified as ligand. --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Oct 15, 2014, at 1:58 PM, Korbin West <khwest16@wabash.edu> wrote:
Hello.
I'm fairly new to Chimera and Python programming, I'm still trying to pick up a lot of it as I go. I'm going through some data and am trying to get the information about a ligand in a protein. So in my script I'm using the runCommand function to get the info on the ligand, but I'd like a way to do so without writing it to a file.
Here's what I have at the moment, writing the information to a file.
runCommand('open 2izh') runCommand('sel ligand') runCommand("writesel ~/Desktop/testligand.txt")
And here's an excerpt of the testligand.txt file:
#1 BTN 300.B #1 HOH 1777.B #1 HOH 1778.B #1 BTN 300.D #2 ACY 801.B #2 SER 308.C #3 BTN 300.B
Is there a way I can just access this information as a list or something so I don't have to write the file then open the file to see the info? I'd like to continue the script to sort out through some of this information but I'm dealing with a lot of pdb files so I'd prefer not to have write a file, open it, read it, then rewrite it and repeat a ton of times.
Thanks so much,
Korbin West _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (3)
-
Elaine Meng
-
Eric Pettersen
-
Korbin West