[Chimera-users] Setting the vertex density in a script

Hurt, Darrell (NIH/NIAID) [E] darrellh at niaid.nih.gov
Thu Jun 5 12:24:58 PDT 2014


Hi Tom,

It isn't that I didn't like your solution — I just was too dumb to understand it!  :)

After thinking about your solution a bit more, here's what I understand now: increasing the max voxels parameter will automatically make Chimera drop the step down a level (by a factor of 2). In this way, I don't have to code anything; instead, I just set the parameter and I'm good to go. And for models that have less voxels than the max voxels parameter, the step will automatically be 1. So I get everything I want with one little switch.

Is that right?

Once again, the genius of the Chimera team never fails to amaze me.

Cheers,
Darrell

--
Darrell Hurt, Ph.D.
Section Head, Computational Biology
Bioinformatics and Computational Biosciences Branch (BCBB)
OCICB/OSMO/OD/NIAID/NIH

31 Center Drive, Room 3B62B, MSC 2135
Bethesda, MD 20892-2135
Office: 301-402-0095
Mobile: 301-758-3559
Web: BCBB Home Page<http://www.niaid.nih.gov/about/organization/odoffices/omo/ocicb/Pages/bcbb.aspx#niaid_inlineNav_Anchor>
Twitter: @niaidbioit<https://twitter.com/niaidbioit>

Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.

From: Tom Goddard <goddard at sonic.net<mailto:goddard at sonic.net>>
Date: Thursday, June 5, 2014 2:11 PM
To: Darrell Hurt <darrellh at niaid.nih.gov<mailto:darrellh at niaid.nih.gov>>
Cc: "chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu> BB" <chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu>>
Subject: Re: [Chimera-users] Setting the vertex density in a script

Hi Darrell,

  You don’t like my solution of just increasing the adjust step max voxels parameter?  Making it 8 times larger is equivalent to dropping the step one level (a factor of 2).  If you don’t want your code to depend on that preference file setting, you can python code like

step = v.region[2]   # Current volume step, tuple of 3 integers one for each axis

to get the current step then use that to execute a volume command

si,sj,sk = [max(1,s/2) for s in step]  # Cut step in half
runCommand(‘volume #%d step %d,%d,%d’ % (v.id, si, sj, sk))

or directly through Python

v.new_region(ijk_step = (si,sj,sk), adjust_step = False)

  For the surfaces use Python m.numAtoms where m is a molecule to get the number of atoms in that molecule, then try the surface command and fallback to the molmap command.

Tom


On Jun 5, 2014, at 10:52 AM, Hurt, Darrell (NIH/NIAID) [E] <darrellh at niaid.nih.gov<mailto:darrellh at niaid.nih.gov>> wrote:

Hi Tom,

Thanks for the quick reply. When Chimera loads a volumetric data set, it somehow determines an appropriate step size (I guess from the max number of voxels setting). This is great and it works very well. What I want to do is quickly load some volumetric data, set a threshold value, drop the step size down one notch (if it isn't already at "1"), and then export the resulting mesh as an X3D file. And I want to do this using a script for automation.

As for molecular surfaces, I guess the best way to go about this would be to first try the "surface" command (MSMS). If that fails, then I would fall back to the "molmap" command. This one also should be scriptable for automation purposes. I can do the fall back with the "try" command in Python. The scaling of the vertex density is important for generating surfaces for small molecules (see attached image for surface of a small molecule that is too coarse) as well as large molecules. I would not change the vertex density value much more than somewhere between 1 and 3 (maybe 5 for very small molecules).

Also, I'm still interested to know if there is a way using a Python script to somehow put into a variable the number of atoms in a loaded object.

Oh wait — looks like Eric might have just provided that in a separate email…

Thanks for all your help!
Darrell

--
Darrell Hurt, Ph.D.
Section Head, Computational Biology
Bioinformatics and Computational Biosciences Branch (BCBB)
OCICB/OSMO/OD/NIAID/NIH

31 Center Drive, Room 3B62B, MSC 2135
Bethesda, MD 20892-2135
Office: 301-402-0095
Mobile: 301-758-3559
Web: BCBB Home Page<http://www.niaid.nih.gov/about/organization/odoffices/omo/ocicb/Pages/bcbb.aspx#niaid_inlineNav_Anchor>
Twitter: @niaidbioit<https://twitter.com/niaidbioit>

Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.

From: Tom Goddard <goddard at sonic.net<mailto:goddard at sonic.net><mailto:goddard at sonic.net>>
Date: Thursday, June 5, 2014 1:14 PM
To: Darrell Hurt <darrellh at niaid.nih.gov<mailto:darrellh at niaid.nih.gov><mailto:darrellh at niaid.nih.gov>>
Cc: "chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu><mailto:chimera-users at cgl.ucsf.edu> BB" <chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu><mailto:chimera-users at cgl.ucsf.edu>>
Subject: Re: [Chimera-users] Setting the vertex density in a script

Hi Darrell,

 To get smaller step size when opening a density map I’d suggest using the Volume Viewer dialog setting “Adjust step to show at most <N> Mvoxels” under menu Features / Data Display Options.  This is the parameter that is setting the initial step size that you think is too coarse.  If you want to go to a factor of 2 lower step size, then you might multiply the current N Mvoxel limit by 8.  Then you can save that setting in your Chimera preferences using menu Features / Save Default Dialog Settings.

 For adjusting the vertex density of molecular surfaces to scale with number of atoms are you talking about solvent excluded surfaces (menu Actions / Surface or surface command) or grid surfaces (molmap command)?  The solvent excluded surface calculation fails for most large structures so I can’t see that working.  If you mean molmap surfaces, let me know, and I’ll pass on a bit of Python that can do the scaling.

Tom


On Jun 5, 2014, at 9:55 AM, Hurt, Darrell (NIH/NIAID) [E] wrote:

Hi Chimera friends,
To save memory and reduce exported geometry sizes, I want to use a script to automatically scale the vertex density of generated molecular surfaces by the size of the molecule. Is there a way to grab the size (number of atoms?) of the loaded molecule(s) and use that with some simple math to set the vertex density value? I know this will reduce surface fidelity, but for very large molecules, the mesh size becomes unwieldy.
On a separate, but related note, when loading a volumetric file like electron microscopy data, the "step" size in the Volume Viewer automatically adjusts (1, 2, 4, 8, 16) to optimize visual performance and memory. I'm using a script to import volumetric data and then "Export Scene…". For that export, I want to drop down the step to the next lowest step to get a smoother mesh. I can just set the step value to the minimum with something like "volume #0 step 1 limitVoxelCount false", but this risks maxing out the memory and crashing for very large data sets. Is there a way to use a script to get the current step value and then lower by one step for my export?
Thanks,
Darrell
--
Darrell Hurt, Ph.D.
Section Head, Computational Biology
Bioinformatics and Computational Biosciences Branch (BCBB)
OCICB/OSMO/OD/NIAID/NIH
31 Center Drive, Room 3B62B, MSC 2135
Bethesda, MD 20892-2135
Office: 301-402-0095
Mobile: 301-758-3559
Web: BCBB Home Page<http://www.niaid.nih.gov/about/organization/odoffices/omo/ocicb/Pages/bcbb.aspx#niaid_inlineNav_Anchor>
Twitter: @niaidbioit<https://twitter.com/niaidbioit>
Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.
_______________________________________________
Chimera-users mailing list
Chimera-users at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu><mailto:Chimera-users at cgl.ucsf.edu>
http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users


<HMDB00073-surf-coulombic.png>




More information about the Chimera-users mailing list