Preliminary "Ribbon" Support in Avogadro

I term it as "ribbon" because it really isn't a ribbon. I haven't figured out how to calculate the plane the ribbon lies on and right now it is a series of cylinders drawn from point to point. I hope you will agree that it already looks fairly effective and can certainly show the nature of the secondary structure of biological molecules.

Initial ribbon support in Avogadro

There is still a lot to do such as draw the tube in a more efficient manner as a continuous OpenGL construct and draw each residue separately. It would also be good to be able to draw ribbons but this may take a deeper understanding of ribbons and how they are visualised than I have. If there are any biologists out there who want to help me out then tips, or even better patches, would be great fully received ;-)

Trackbacks

it's a puzzle on : 10/23, Avogadro and Chemistry

Continue reading "10/23, Avogadro and Chemistry"
Last year, I commented on National Mole Day, celebrated on Oct. 23rd here in the United States (written 10/23). It?s a great day for chemistry ? it celebrates Avogadro?s number, which defines a mole of particles: 6.02 x 1023....

Comments

Display comments as Linear | Threaded

Benoit Jacob on :

Benoit JacobAwesome work Marcus. I can imagine how happy the users of Kalzium will be when they see ribbons in KDE 4.1.

Benoit Jacob on :

Benoit JacobAbout efficient drawing with a continuous construct: this can be achieved using a OpenGL indexed vertex array, of type GL_TRIANGLE_STRIP, First construct an array of vertices where each vertex appears once and only once (so, for each of the small cylinders you currently draw, take only the "bottom" vertices, while the "top" vertices will be replaced by the next cylinder's "bottom" vertices). Then construct the separate index array. It's an array of ints telling OpenGL in which order to use the vertices from the vertex array to draw the GL_TRIANGLE_STRIP. The trick here, allowing you to easily join a cylinder slice to the next one, is that it is perfectly allowed to draw flat triangles. This is actually a very standard practice. So you can e.g. repeat a vertex twice, or do a A-B-A sequence, leading to a flat triangle in the strip, which won't be drawn at all, but will allow you to easily assemble together the slices into a big GL_TRIANGLE_STRIP.

Oh I just had another idea: why not take the orthogonal point of view: instead of slicing the tube into small cylinders, you could slice it in the orthogonal way, in long "shoe laces". The advantages are that:
1) building the shoe laces GL_TRIANGLE_STRIP is much easier and doesn't require you to add flat triangles
2) the number of required shoe laces is independant of the length/complexity of the ribbon, it only depends on the required visual quality, and probably doesn't exceed 15 or 20.

The disadvantage is that your vertices are no longer sorted by locality, which may harm performance depending on the OpenGL implementation.

Marcus D. Hanwell on :

Marcus D. HanwellI have been experimenting and am starting to make progress - I haven't touched OpenGL in quite some time now and it is taking me some time to get back into it. I think I have figured out how to draw the tubes in a simple way at least now. I may be looking for you on IRC to ask for advice...

Thomas Margraf on :

Thomas MargrafI implemented the flat ribbon as a bezier-surface using the atoms of a protein's peptide bonds as control points.
You can check out some screenshots on www.thomasmargraf.org. The orientation of the band in alpha helices is a bit unusual, but if you use the surface normals of the peptide-bond plain to generate your control-points, you can get the more traditional look as well.
If I can help you at all, or if you want to have a look at my code, feel free to get in touch.

Marcus D. Hanwell on :

Marcus D. HanwellI have sent you an email too but what you have on your blog looks really good. I would certainly be interested in pointers, tips, code examples or even patches if you are interested in working on the ribbon engine.

I would love to get our support of biological molecules to a useful level but this is outside of my areas of expertise :-)

Geoff Hutchison on :

Geoff HutchisonI've definitely seen this sort of smoothed cylinder in biomolecule graphics. So it's one useful render mode for protein backbones.

See, I told you it was close enough to grab more expert opinion. :-)

Quintesse on :

QuintesseMaybe you can get in touch with these guys: http://3d-alignment.eu/

They seem to have done it for their Java application...

Linus ?stberg on :

Linus ?stbergThis is great. Please finish this support, I'll be very happy if I can finally ditch rasmol. I have never tested Avogadro, but any native software for viewing pdb files will be great.

As for ribbons, it shows alpha helices and beta sheet. Sometimes those secondary structures can be found inside the pdb file downloaded from rcsb, for example 5RSA. In those cases you will, if I'm not misstaken, just have to add some color between the amino acids mentioned and you will be done. If the structures are not in the file, it can be calculated, however tI don't know how at the moment.


I can be wrong though, as I have only studied those things as part of my education in bionmedicine.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5


You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.