Hi all,
translate does seem to work with CGOs if you use named arguments (note the
'object=' in the argument list):
cmd.translate([x,y,z], object='membrane')
Here's an example that you can copy and paste into pymol:
-----------
python
from pymol.cgo import *
from pymol import cmd
from pymol.vfont import plain
# create the axes object, draw axes with cylinders coloured red, green,
#blue for X, Y and Z
obj = [
CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,
CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.,
CYLINDER, 0., 0., 0., 0., 0., 10., 0.2, 1.0, 1.0, 1.0, 0., 0.0, 1.0,
]
# add labels to axes object (requires pymol version 0.8 or greater, I
# believe
cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[10.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,10.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,0.,10.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
# then we load it into PyMOL
cmd.load_cgo(obj,'axes')
# here we translate it
cmd.translate([1,0,0], object='axes')
---------
the axes should then be translated by 1 unit to the right.
Cheers,
Julian
On Wed, Feb 3, 2016 at 6:55 AM, Sampson, Jared M. <jms2...@cumc.columbia.edu
> wrote:
> Hi Annemarie -
>
> Fun problem. It looks like cmd.transform_selection() only works with
> "molecule" type objects, not with CGOs. You could try doing something like
> what's in the 3rd example in http://www.pymolwiki.org/index.php/Axes,
> calculating the new object matrix itself by transforming the current one,
> then applying it to the object using cmd.set_object_ttt().
>
> Alternatively, if you can reproducibly identify any vector that should be
> perpendicular to the membrane, you could use those points as the start and
> end points for your initial load_cgo command. For example, if your
> receptor happens to have a symmetric channel, something like this might
> work.
>
> ```
> # create pseudoatoms at the average positions of residues at the top and
> bottom of the chain
> pseudoatom top, <some_residue_at_top_of_channel> and n. CA and chain
> A+B+C+D
> pseudoatom bot, <some_residue_at_bottom_of_channel> and n. CA and chain
> A+B+C+D
>
> # Orient to the pseudoatoms and fine tune the positions along the viewport
> Y axis.
> # (Make sure you don't move the view until you're done positioning the
> pseudoatoms.)
> orient (top or bot)
> turn z, 90 # assuming `orient` put them along X and you want them along Y
> translate [0, 2, 0], top
> translate [0, -1.5, 0], bot
>
> # Get the coordinates of the two end points
> from pymol import stored
> stored.start = []
> stored.end = []
> iterate_state 1, top, stored.start = (x,y,z)
> iterate_state 1, bot, stored.end = (x,y,z)
>
> # Create the CGO cylinder (I made it semitransparent)
> from pymol.cgo import ALPHA, CYLINDER
> x1,y1,z1 = stored.start
> x2,y2,z2 = stored.end
> r1,g1,b1 = 1, 1, 0
> r2,g2,b2 = 1, 1, 0
> radius = 100
> cmd.load_cgo([ ALPHA, 0.5, CYLINDER, x1, y1, z1, x2, y2, z2, radius, r1,
> g1, b1, r2, g2, b2 ], "membrane")
>
> ```
>
> Not sure if that will be applicable to your use case, but hopefully it
> will at least give you an idea of one approach that could work.
>
> Hope that helps.
>
> Cheers,
> Jared
>
> --
> Jared Sampson
> Columbia University
>
>
> On Jan 29, 2016, at 4:33 PM, Honegger Annemarie <honeg...@bioc.uzh.ch>
> wrote:
>
> I am trying to show some cell surface receptors and to indicate their
> position relative to the membrane.
>
> I thought to indicate the plane of the membrane by a flat disk, a ago
> cylinder.
>
> x1,y1,z1 = 0, -1, 0 # start point
> r1,g1,b1 = 1, 1, 0 # color (yellow)
> x2,y2,z2 = 0, -2, 0 # end point
> r2,g2,b2 = 1, 1, 0 # color (yellow)
> radius = 100
> cmd.load_cgo( [ 9.0, x1, y1, z1, x2, y2, z2, radius, r1, g1, b1, r2, g2,
> b2 ], "membrane" )
>
> When I try to move this cylinder into the correct position
> with cmd.transform_selection,
> using the transformation parameters extracted from get_view (reordering
> them as needed)
> I get the error message "Selector-Error: Invalid selection name “membrane”
> “
>
> The same transform command works fine if I apply it to a pseudo atom
> originally generated with coordinates 0,0,0.
>
> Any suggestion how else I could indicate the membrane, or how I could
> place my ego object parallel
> to the screen yz plane? I have to be able to do this in a reproducible
> fashion, as I have to do this
> for a large number of constructs that bend my receptors relative to the
> membrane in various ways.
>
> Thanks for your help
> Annemarie
> _______________________________
>
> Dr. Annemarie Honegger PhD
> Department
> of Biochemistry
> Zürich University
> Winterthurerstrasse 190
> CH-8057 Zürich
> Switzerland
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140_______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net