Opened 6 years ago
#3010 assigned enhancement
Speed up ribbon helix tubes
| Reported by: | Tom Goddard | Owned by: | Tom Goddard |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Depiction | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
Ribbon helix tube display is much slower than normal ribbons. For PDB 6owg (180,000 atoms) normal ribbons take 1.6 seconds while tube mode ("cartoon style modeHelix tube") takes 4.7 seconds, about 3 times longer.
Would be nice to optimize ribbon tube display. A look at the code shows a couple difficulties in moving the slow Python calculation of the helix axis and bend from Python to C++. The current code (in atomic/sse.py) uses an eigenvector calculation for longer helices (numpy.linalg.svd) and does a minimization of radius variance from cylinder axis to CA atoms using scipy.optimize.minimize(). Also it uses the ChimeraX rigid body alignment code to match template alpha-helix CA positions.
Probably the cylinder parameters could be computed in a simpler way that would be able to run much faster. But it would require detailed testing on many structures to verify good quality results.
The current cylinders work on helices as small as 3 residues and uses just CA atom positions. The 3 atoms form a triangle. The only way to handle this case well is going to be to know the pitch of an ideal alpha helix and orient the helix relative to these 3 CA atoms based on that template. Basically the cylinder axis intersects a fixed point in the CA triangle with fixed orientation. If the 3 residue CA triangles are relatively consistent the cylinder axis could just be defined in terms of two CA-CA basis vectors.
Building off that 3 residue case, every consecutive 3 residues in a longer helix could assign a helix axis point and direction. And average of all the directions could be used. Then position that axis to get a best fit line through the center points (project CA onto axis for each 3-CA stretch). This gives a straight line helix. Current code bends the helix into a torus if the helix is at least 13 residues long. Simpler and faster the straight helix can be bent by adding sine/cosine half wavelength terms, basically fit the center points using a lowest frequency (one term) Fourier expansion. This would just involve inner-products of the center path with the sine/cosine Fourier vectors to get the best fit bent path. CA centers would be considered equi-spaced in parameter t.
Would need to test these ideas and compare the quality of cylinder fit to CA atoms with current code.
Tube cylinders are mostly used for publication images so optimizing speed is not a high priority.