[chimerax-users] Set atom coordinates by command?

Tom Goddard goddard at sonic.net
Mon Oct 26 11:00:18 PDT 2020


For making a scatter plot in 3D from atoms you can use the ChimeraX marker command.  It places sphere markers which in fact are just atoms

	mark #3 position 10,2.8,4 radius 1.5 color yellow

Also since markers are just atoms, the "marker change" command can change the position of an atom

	mark change #1/B:9 at CA position -2.6,4.1,3

Docs for the marker command

	https://www.rbvi.ucsf.edu/chimerax/docs/user/commands/marker.html <https://www.rbvi.ucsf.edu/chimerax/docs/user/commands/marker.html>

  Tom


> On Oct 26, 2020, at 10:30 AM, Boris Steipe <boris.steipe at utoronto.ca> wrote:
> 
> I too had assumed it would be possible to use setattr and the REST interface in the way Gunnar asked about, with an XYZ triplet - for generic 3D scatterplots. The workaround you described will certainly work. I just wanted to mention that doing this directly might indeed be useful. The REST interface opens so many creative options when coming from other languages, e.g. from R.
> 
> Cheers,
> Boris
> 
> --
> Boris Steipe MD, PhD
> 
> Associate Professor, Department of Biochemistry and
> Department of Molecular Genetics
> Temerty Faculty of Medicine
> University of Toronto
> 
> 
> 
>> On 2020-10-27, at 02:52, Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>> wrote:
>> 
>> EXTERNAL EMAIL:  Treat content with extra caution. 
>> Well, it's a hack but if you know the starting coordinates of the atom you can use three "move" commands (one per axis) to position it.  If you don't know the coordinates, you can use the setattr trick you discovered to set the coordinates to (0,0,0) and then use the move commands.
>> 
>> --Eric
>> 
>>> On Oct 24, 2020, at 1:08 AM, Jeschke Gunnar <gunnar.jeschke at phys.chem.ethz.ch <mailto:gunnar.jeschke at phys.chem.ethz.ch>> wrote:
>>> 
>>> Hi Eric,
>>> 
>>> thanks. No problem at all. 
>>> 
>>> I will eventually use the Python shell, but for the moment I am content with communicating via REST, which works just fine for visualization purposes. 
>>> I justed wanted to know what I can and cannot implement in this interface.
>>> 
>>> Kind regards
>>> 
>>> Gunnar
>>> 
>>> ---
>>> 
>>> It's about time: The Great Barrington Declaration
>>> 
>>> gbdeclaration.org <http://gbdeclaration.org/>
>>> 
>>> Prof. Dr. Gunnar Jeschke
>>> ETH Zurich
>>> Department of Chemistry and Applied Biosciences
>>> Vladimir-Prelog-Weg 2
>>> CH-8093 Zurich Switzerland
>>> 
>>> www.epr.ethz.ch <http://www.epr.ethz.ch/>
>>> ________________________________________
>>> From: Eric Pettersen [pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>]
>>> Sent: Friday, October 23, 2020 5:56 PM
>>> To: Jeschke  Gunnar
>>> Cc: chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>
>>> Subject: Re: [chimerax-users] Set atom coordinates by command?
>>> 
>>> Hi Gunnar,
>>> The setattr command can't do this.  It would not be too hard to add it to setattr, but it doesn't seem to be something anyone would commonly want to do, though I'm willing to listen to arguments otherwise.
>>> This is pretty easy to do in ChimeraX's Python shell though (Tools→General→Shell).  The following code (typed/pasted) to the shell  would set all selected atoms' coordinates to 1,2,3:
>>> 
>>> from chimerax.atomic import selected_atoms as sel_atoms
>>> 
>>> for a in sel_atoms(session):
>>>   a.coord = (1, 2, 3)
>>> 
>>> If you're not familiar with Python, indentation is significant, so that last line needs to be indented as shown.
>>> 
>>> --Eric
>>> 
>>> Eric Pettersen
>>> UCSF Computer Graphics Lab
>>> 
>>> On Oct 23, 2020, at 12:52 AM, Jeschke Gunnar <gunnar.jeschke at phys.chem.ethz.ch <mailto:gunnar.jeschke at phys.chem.ethz.ch><mailto:gunnar.jeschke at phys.chem.ethz.ch <mailto:gunnar.jeschke at phys.chem.ethz.ch>>> wrote:
>>> 
>>> Hi all,
>>> 
>>> is there a way to set atom coordinates by a command?
>>> 
>>> setattr spec atoms coord value
>>> 
>>> appears to accept only one double argument and sets x, y, and z to this number. Neither space-separated nor comma-separate lists of three values appear to work.
>>> 
>>> Kind regards
>>> 
>>> Gunnar
>>> 
>>> ---
>>> 
>>> Prof. Dr. Gunnar Jeschke
>>> ETH Zurich
>>> Department of Chemistry and Applied Biosciences
>>> Vladimir-Prelog-Weg 2
>>> CH-8093 Zurich Switzerland
>>> 
>>> www.epr.ethz.ch <http://www.epr.ethz.ch/><http://www.epr.ethz.ch <http://www.epr.ethz.ch/>>
>>> _______________________________________________
>>> ChimeraX-users mailing list
>>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>>> Manage subscription:
>>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>
>>> 
>>> 
>>> _______________________________________________
>>> ChimeraX-users mailing list
>>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>>> Manage subscription:
>>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>
>> 
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>
> 
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users <https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20201026/9c84e00c/attachment.html>


More information about the ChimeraX-users mailing list