Dear Chimera,
I am writing a Chimera python script and need to get a list of the chains and residue numbers of specific opened models . What would be the command/syntax
to do that? or can you point me to a code example where something like this is done.
Thanks
Hernando
From: Chimera-users [mailto:chimera-users-bounces@cgl.ucsf.edu]
On Behalf Of Hernando J Sosa
Sent: Monday, June 11, 2018 2:46 PM
To: Eric Pettersen
Cc: chimera-users BB
Subject: Re: [Chimera-users] python script
Thanks Eric,
These alternatives is what I was looking for.
Best
Hernando
From: Eric Pettersen [mailto:pett@cgl.ucsf.edu]
Sent: Friday, June 08, 2018 7:27 PM
To: Hernando J Sosa
Cc: chimera-users BB
Subject: Re: [Chimera-users] python script
Hi Hernando,
Perhaps runCommand should return a value but it doesn’t. The reasoning there was that the argument to runCommand could be anything, including several commands separated by semi-colons, so
in some cases it’s confusing what the return value should be. In any case that ship has sailed and you have to do something else to get the value. In most cases it calling the underlying function that performs the command and using it’s return value, but
looking at the code that implements the “measure center” command I can see that it doesn’t return anything either.
So in the particular case of the example you provided, I can see two options for getting the value:
Option 1)
atoms = chimera.selection.OSLSelection(“#0:.A@CA”).vertices()
center = chimera.Point([a.coord() for a in atoms])
x, y, z = center.data()
Option 2)
rc(“sel #0:.A@CA”)
center = chimera.Point([a.coord() for a in chimera.selection.currentAtoms()])
x, y, z = center.data()
I hope this helps.
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
On Jun 8, 2018, at 11:10 AM, Hernando J Sosa <hernando.sosa@einstein.yu.edu> wrote:
Dear Chimera,
Is it possible to assign the result of running a chimera command in python to a string or something else? E.g doing something like:
from chimera import runCommand as rc
myresult = rc('measure center #0:.A@CA')
And then using the myresults somewhere else in the script after parsing for the relevant values?
Maybe there is a n easier way to accomplish this?
Thanks
Hernando
_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users