[Chimera-users] python script

Hernando J Sosa hernando.sosa at einstein.yu.edu
Thu Oct 25 13:35:45 PDT 2018


An additional question:
Is it possible to retrieve the  atomic coordinates after a transformation (e.g. after an align/superposition  operation) rather than the original coordinate values?

e.g. I am currently using the following commands  to retrieve the coordinates (x,y,z) of  the CA atom in model,residue,chain
atom    = chimera.selection.OSLSelection("#%d:%d.%c at CA" % (model,residue,chain)).vertices()
(x,y,z)  = atom[0].coord()

However, this retrieves  the original coordinates not the coordinates after a transformation.

Thanks

Hernando

Hernando Sosa
Dept. of Physiology and Biophysics
Albert Einstein College of Medicine
1300 Morris Park Av.
Bronx NY 10461
phone (718) 430-3456
FAX (718) 430-8819
email hernando.sosa at einstein.yu.edu<mailto:hernando.sosa at einstein.yu.edu>

From: Chimera-users [mailto:chimera-users-bounces at cgl.ucsf.edu] On Behalf Of Hernando J Sosa
Sent: Thursday, October 25, 2018 12:50 PM
To: chimera-users BB
Subject: [Chimera-users] python script

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 at 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 at 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 at CA”).vertices()
            center = chimera.Point([a.coord() for a in atoms])
            x, y, z = center.data()

Option 2)
            rc(“sel #0:.A at 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 at einstein.yu.edu<mailto:hernando.sosa at 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 at 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 at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu>
Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20181025/929d8a4b/attachment.html>


More information about the Chimera-users mailing list