Opened 8 years ago

Closed 9 days ago

Last modified 8 days ago

#1242 closed enhancement (fixed)

Straight helix tubes

Reported by: Elaine Meng Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Depiction Version:
Keywords: Cc: Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by Eric Pettersen)

Want to show straight helix tubes in cartoon display style.

Change History (15)

comment:1 by Elaine Meng, 5 years ago

Owner: changed from Conrad Huang to Tom Goddard

comment:2 by Eric Pettersen, 5 years ago

Reporter: changed from eustermann@… to Elaine Meng

Reporter email address no longer valid

comment:3 by Elaine Meng, 4 years ago

Has been requested a few times, such as today:

From: 王超(Chao Wang) via ChimeraX-users <chimerax-users@…>
Subject: [chimerax-users] Can I change the curved cylinder into a straight one?
Date: August 26, 2022 at 7:47:06 PM PDT
To: "chimerax-users" <chimerax-users@…>
Reply-To: 王超(Chao Wang) <wangc@…>

Dear All,
After displaying helix in cylinder mode, I found that it is curved by default. I would like to ask whether it can be changed to a straight shape with two ends as fulcrums or other straight way?
Thanks,
Chao.

see also ticket #2489 control helix curvature

comment:4 by Tom Goddard, 4 years ago

Cc: Tom Goddard added
Owner: changed from Tom Goddard to Eric Pettersen

The ribbon code can easily show helices as straight cylinders. It may not produce the best cylinder end points resulting in somewhat weird appearance where the coil at the end of the cylinder joins on the side of the cylinder instead of the end cap. That doesn't seem to happen too often.

The main work to allow straight helix cylinders is that the C++ Structure class needs to support that mode. There would need to be a new ribbon style, Structure.ribbon_mode_style = RIBBON_MODE_CYLINDER, saved in sessions, and the cartoon style command would need to accept that for the modeHelix option. Then a few lines changed in the ribbon calculation code could use it.

I'll reassign to Eric to add this to the C++ Structure code and session saving if he thinks it is worth doing. If it is done, reassign to me and I can fix the cartoon command and make the calculation produce the straight cylinders.

Last edited 4 years ago by Tom Goddard (previous) (diff)

comment:5 by Eric Pettersen, 4 years ago

Status: assignedaccepted

comment:6 by Elaine Meng, 4 years ago

As a temporary workaround (until we have the better solution in the cartoon command) you could try "define axis" with "perHelix true" and some padding value to show straight cylinders for helices, and then hide the ribbon. The main problem with this workaround is that the other parts of the ribbon do not connect well to the straight cylinders in some places.

Example:
open 2gbp
hide atoms
define axis perhelix true padding 2.0
hide helix ribbon

Also if you only care about one specific helix, you can hide all of the other straight cylinders and only hide the ribbon for the specific residues in that helix.

comment:7 by Tom Goddard, 4 years ago

If you want to modify the Python code in your ChimeraX distribution you can change one line and it will always produce straight helix tubes. The line is 154 in file

ChimeraX.app/Contents/lib/python3.9/site-packages/chimerax/atomic/sse.py

on Mac (different location on Windows and Linux, ask if you can't find it) change

MIN_CURVE_LENGTH = 13

to

MIN_CURVE_LENGTH = 1300

This parameter controls the minimum length of a tube helix in residues that will be fit to a curve.

comment:8 by Eric Pettersen, 4 weeks ago

Cc: Eric Pettersen added; Tom Goddard removed
Description: modified (diff)
Owner: changed from Eric Pettersen to Tom Goddard
Status: acceptedassigned

The underlying support for straight helix cylinders has now been added: https://github.com/RBVI/ChimeraX/commit/d638dbd31d211d89ebaf8fa572f0bfa61c57b707

comment:9 by Tom Goddard, 9 days ago

Resolution: fixed
Status: assignedclosed

Done.

Eric added a per-model helix mode called cylinder which is a straight tube. I added it to the cartoon style command

cartoon style modehelix cylinder

and made the rendering code compute and show the straight cylinders. The default radius is set as the mean distance from cylinder center line to C-alpha atoms. That is also the default radius for curved tubes. But with straight cylinders it can result it fat cylinders if the helix is far from straight. To avoid the fat cylinders you can also set the cartoon style radius option to an explicit radius

cartoon style modehelix cylinder radius 2.5

or set it back to the mean C-alpha distance with

cartoon style modehelix cylinder radius auto

comment:10 by Elaine Meng, 8 days ago

I updated the cartoon style docs, also changing my "cylinders" alias example to "tubes" now that actual cylinders are a separate possibility.
<https://www.cgl.ucsf.edu/home/meng/chimerax/docs/user/commands/cartoon.html#style>

However, this begs the question: should the Preset name "Cylinders/Stubs" (in Presets menu) similarly be changed to "Tubes/Stubs"?  I know there is some issue of losing scripting backwards compatibility but not sure how much usage that got, as opposed to just choosing the item from the menu, and with cylinders now an option, maybe tubes is clearer.  Willing to go along with whichever y'all prefer.  There could also be a "Cylinders/Stubs" that uses the cylinders instead of tubes, but maybe that is worse for back compatibility if it still works but looks different than previously.

comment:11 by Elaine Meng, 8 days ago

One more question: according to docs, the auto-radius for tubes was capped at 2.5; is that also the case for cylinders?  If not, probably should be.

comment:12 by Tom Goddard, 8 days ago

I think I would leave the preset menu and command as cylinders rather than tubes.

The auto radius for tubes is a minimum of 2.5, there is no maximum. The auto radius for straight has neither a minimum nor a maximum. Let me know if you want it to have 2.5 as a minimum as well.

comment:13 by Elaine Meng, 8 days ago

OK fine with me to leave the presets as is.  When I was talking about my command example it was an alias not a preset, I did change that to "tubes" from "cylinders" since it is indeed using tubes.

I can't believe that 2.5 is a minimum.  That is really fat.  When I test this by using "cartoon style modeH tube" and then follow that with "cartoon style modeH tube radius 2.5" they get fatter, which does not sync with the first command's minimum being 2.5.

I am pretty sure the 2.5 is to prevent them from being too fat, in which case it would be appropriate for both tube and helix modes.

comment:14 by Elaine Meng, 8 days ago

...appropriate for both tube and *cylinder* helix modes, I mean, unless you think a higher cap is needed for the latter.

comment:15 by Tom Goddard, 8 days ago

You are right Elaine. I misread the code. The auto-radius maximum is 2.5 for tubes. I have just now made that the maximum for cylinders too.

Note: See TracTickets for help on using tickets.