
Hi - I'm new to writing Chimera code; I've started poking around in the sample scripts and the modules but and I find it a bit slow to find my way around. For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects. I'm sure if I spend more time, through trial and error and dir() and grep, I'll eventually figure it out, but I wonder if there isn't a more principled approach - a document on the big picture of how the code is structured, and/or a searchable list of all functions? What's the best strategy to start reading and coding Chimera scripts? Thanks! Boris

Hi Boris, We recommend sending Chimera programming questions to chimera-dev@cgl.ucsf.edu. In the meanwhile, this recent general post might help somewhat: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/2014/001155.html> 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 Nov 14, 2014, at 8:27 PM, Boris Steipe <boris.steipe@utoronto.ca> wrote:
Hi - I'm new to writing Chimera code; I've started poking around in the sample scripts and the modules but and I find it a bit slow to find my way around. For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects. I'm sure if I spend more time, through trial and error and dir() and grep, I'll eventually figure it out, but I wonder if there isn't a more principled approach - a document on the big picture of how the code is structured, and/or a searchable list of all functions? What's the best strategy to start reading and coding Chimera scripts?
Thanks! Boris _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Hi Boris, Unfortunately Python programming in Chimera is not well documented. The “sel” variable means Selection, they are defined in chimera/share/selection/__init__.py. An example using Chimera selections is giving in the chimera-dev mailing list post http://plato.cgl.ucsf.edu/pipermail/chimera-dev/2014/001157.html with Python code http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/atomdist.py Tom On Nov 14, 2014, at 8:27 PM, Boris Steipe wrote:
Hi -
I'm new to writing Chimera code; I've started poking around in the sample scripts and the modules but and I find it a bit slow to find my way around. For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects. I'm sure if I spend more time, through trial and error and dir() and grep, I'll eventually figure it out, but I wonder if there isn't a more principled approach - a document on the big picture of how the code is structured, and/or a searchable list of all functions? What's the best strategy to start reading and coding Chimera scripts?
Thanks! Boris _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thanks Tom - I solved what I needed to. In addition to what you and Elaine had mentioned, Forbes Burkowki's book and scripts were very helpful. It's a steep learning curve overall - but great when it works! Cheers, Boris On Nov 17, 2014, at 6:37 PM, Tom Goddard <goddard@sonic.net> wrote:
Hi Boris,
Unfortunately Python programming in Chimera is not well documented. The “sel” variable means Selection, they are defined in chimera/share/selection/__init__.py. An example using Chimera selections is giving in the chimera-dev mailing list post
http://plato.cgl.ucsf.edu/pipermail/chimera-dev/2014/001157.html
with Python code
http://plato.cgl.ucsf.edu/trac/chimera/attachment/wiki/Scripts/atomdist.py
Tom
On Nov 14, 2014, at 8:27 PM, Boris Steipe wrote:
Hi -
I'm new to writing Chimera code; I've started poking around in the sample scripts and the modules but and I find it a bit slow to find my way around. For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects. I'm sure if I spend more time, through trial and error and dir() and grep, I'll eventually figure it out, but I wonder if there isn't a more principled approach - a document on the big picture of how the code is structured, and/or a searchable list of all functions? What's the best strategy to start reading and coding Chimera scripts?
Thanks! Boris _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

On Nov 17, 2014, at 4:26 PM, Boris Steipe <boris.steipe@utoronto.ca> wrote:
For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects.
If we are talking about the the 'sel' argument given to many of the functions in Midas/__init__.py, that argument is usually "polymorphic", and can be any one of these: -- an atom specifier (e.g. "#1@ca") -- a list/tuple of Atoms/Residues/Molecules (homogeneous list/tuple though) -- a set of Atoms/Residues/Molecules (also homogenous, and unlike the list/tuple the set has to be at the right "level" for the function called [e.g. Atoms for distance]) -- a Selection/OSLSelection (which Tom mentioned) --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu

I guess I should also mention the the "atom specifier" can just be "sel" to get whatever is currently selected. --Eric On Nov 17, 2014, at 4:45 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
On Nov 17, 2014, at 4:26 PM, Boris Steipe <boris.steipe@utoronto.ca> wrote:
For example I would like to perform some simple calculations on the coordinates of a set of selected atoms, and I see many functions that take a "sel" argument, but I can't seem to find documentation on exactly what that argument is expected to contain, or the function that would return such a selection list (is it even a list) of objects.
If we are talking about the the 'sel' argument given to many of the functions in Midas/__init__.py, that argument is usually "polymorphic", and can be any one of these:
-- an atom specifier (e.g. "#1@ca") -- a list/tuple of Atoms/Residues/Molecules (homogeneous list/tuple though) -- a set of Atoms/Residues/Molecules (also homogenous, and unlike the list/tuple the set has to be at the right "level" for the function called [e.g. Atoms for distance]) -- a Selection/OSLSelection (which Tom mentioned)
--Eric
Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
participants (4)
-
Boris Steipe
-
Elaine Meng
-
Eric Pettersen
-
Tom Goddard