[Chimera-users] get near/far clip positions?

Eric Pettersen pett at cgl.ucsf.edu
Mon Sep 25 16:10:57 PDT 2017


> On Sep 25, 2017, at 10:42 AM, Oliver Clarke <olibclarke at gmail.com> wrote:
> 
> Hi Elaine,
> 
> Hmmm good idea! The only issue is what I would like to be able to do is to calculate the required thickness of each slab from the distance between the hither and yon clip planes. 
> 
> That way I can have a little script that will split the scene into say ten depth slabs, regardless of whether I am zoomed in on a ligand or out on a whole receptor. I can do this manually of course, but it is a little tedious and I am lazy, so I’d like to automate it :)
> 
> I suspect it is possible using Python, but I don’t know how to obtain the distance between the near and far clip planes programmatically.

I not really the expert on this part of Chimera, but here’s some hints.

chimera.viewer.clipping and chimera.viewer.depthCue are booleans that control whether clipping and depth cueing are on/off.  If clipping is on, then chimera.viewer.camera.nearFar is a two-tuple of the position of the near and far clipping planes in the scene (along the scene Z axis, which runs in/out of the screen).  The difference of those two values (near - far) is the separation of the clip planes, and you can set that nearFar attribute to a new two-tuple in order to move through the scene in sections.

> Also re python on an unrelated matter, if there is a way to obtain the vector corresponding to the difference between two equivalent Calpha pairs in different conformations of the same protein, I’d love to know how to do that in a script. It would be useful for quantifying local flexibility, by monitoring how the local arrangement of C-alphas changes between the two conformations (as opposed to rigid displacement of domains).

This is essentially the same as your later mail to the list?  I’ll respond to that mail…

—Eric

	Eric Pettersen
	UCSF Computer Graphics Lab

> 
> Cheers
> Oli
> 
> 
>> On Sep 25, 2017, at 1:26 PM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
>> 
>> Hi Oli,
>> At least from the Chimera-comands perspective (the programming experts may have a different Python approach), I think it would be easier do it with per-model clipping instead.  The “mclip” command allows specifying the absolute position of the plane in model coordinates, and you could use slab mode with thickness 25 A.  You would just have to specify all the models so that it’s effectively global (in other words, the same per-model clipping on each model).
>> 
>> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/mclip.html>
>> 
>> You can turn depth cueing off separately with  “~set depthCue”
>> <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/set.html#depthcue>
>> 
>> Best,
>> Elaine
>> ----------
>> Elaine C. Meng, Ph.D. 
>> UCSF Chimera(X) team
>> Department of Pharmaceutical Chemistry
>> University of California, San Francisco
>> 
>>> On Sep 25, 2017, at 8:01 AM, Oliver Clarke <olibclarke at gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> I would like to write a script to progressively go through the current scene in n depth steps, saving an image with depth cueing off at each step. I want to do this so I can manually apply depth cueing and DoF effects in post processing.
>>> 
>>> For example, if the near and far clip position are at 0 and 100, and I want to split the scene into 4 depth slabs, I’d like to take images with (near,far)=(0,25),(25,50),(50,75),(75,100).
>>> 
>>> Is there any way in the scripting interface to get the positions of the global clipping planes, so I can calculate how thick each slab should be?
>>> 
>>> Cheers
>>> Oli
>>> 
>>> Script (example pseudocode):
>>> 
>>> scene tmp save
>>> 
>>> set depth cueing off
>>> 
>>> depth_steps=4
>>> 
>>> near_clip=0 (would like to get this position from current scene)
>>> 
>>> far_clip=100 (would like to get this position from current scene)
>>> 
>>> thickness=far_clip-near_clip
>>> 
>>> thickness_per_step=thickness/depth_steps
>>> 
>>> set far clipping plane to (near_clip+thickness_per_step)
>>> 
>>> for i in range (1,depth_steps+1):
>>> save image_%i
>>> section thickness_per_step
>>> 
>>> scene tmp reset.
>> 
> 
> 
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 





More information about the Chimera-users mailing list