Logo
Toggle Menu
  • home
  • blog
  • about
    • about this site
    • contact
    • privacy policy
  • cinema 4d
    • plugins
    • creating c4d plugins
    • plugin cookbook
    • software
  • models
    • nodes
    • plants 1
    • other models - 1
    • other models - 2
  • osl
    • writing osl shaders
    • osl shaders for download

Creating a new plugin: 11

A confession

I took a short break from this plugin to think about where I was going with it. When I looked at it again, I first wanted to implement nucleotide chains and add a feature whereby the user could choose to display only amino acid chains, or only nucleotide chains (if any), or both. This caused a problem in that I was now maintaining two ways to create the bonds between atoms with several different modes - chain type, colour mode, which components to display and so on. This was too much to keep straight, and what began to happen was what every coder will experience at some point: adding a feature will affect another feature , which then needs correcting, which in turn affects the feature you just added..and so on. Or the code becomes entangled in a mess of conditional expressions (if..if else...if else...etc.).

To get round this, I reversed a decision I took earlier in part 10. This was originally to have two methods to create bond splines, one when colouring by bonds or by chains, and the other when colouring by residue. I had decided to keep both, but in the end I dropped the original bond creation method and now create bonds for each residue separately. Although this is less efficient, in that Cinema has to handle more objects in the scene, it simplifies the code considerably and any issue is only noticeable if the scene is animated. I think that's a fair trade-off in this case.

Nucleotides

So, to add nucleotide chains in addition to amino acids. It might be helpful to set the background for this first.

Some proteins can contain nucleic acid chains (such as RNA). So far, these are not being handled correctly by the plugin. Nucleic acid chains are contained in the same ATOM records as amino acids, but there are some key differences:

  1. The molecules making up the chain are nucleotides, not amino acids.
  2. The nucleotide names are different from amino acids (fairly obviously!).
  3. The atom names in the nucleotide are different, and the naming scheme is different, so there is no 'CA' atom, for example.
  4. Nucleotides are linked with a phosphodiester bond rather than a peptide bond.

The rest of the ATOM record can be dealt with in the same way as amino acids. The result of all this is that if a protein contains nucleotide chains, the atoms making up the nucleotide will be handled correctly and will display in the viewport, but the bonds between them will not be shown. We would see something like this:

Nucleotide chain without bonds

As you can see, this protein has four chains and two of them (red and blue) are amino acid chains, where the bonds are shown. The other two are nucleotide chains but although the atoms are shown, the bonds are not.

This is because the bond definitions don't yet appear in the bonds table used for bonds within amino acids, so those bonds have to be added to the table. There will be more bonds than for an amino acid because nucelotides are larger and more complex molecules, but there are only five of them rather than 22.

Once the table is updated with the list of bonds found in nucleotides, the same molecule shown above will now show this:

Same image but nucleotide bonds are now shown.

If only it was that simple

So far so good, but there are some outstanding issues. For RNA molecules, which are the ones we'd normally expect to see in conjunction with a protein, there are four nucleotides that could be seen in the chain. These are adenine, cytosine, guanine and uracil, which have the identifying letters A, C, G, and U respectively in the PDB file where the amino acid residue identifier ('HIS', 'LEU', etc.) is found. DNA isn't normally found with a protein in the same way, but it is possible that a PDB file might have DNA in with it, so we need to take that into account; the nucelotides in DNA are slightly different but use the same internal bond structure, and use the corresponding codes DA, DC, DG, and DT (because DNA contains thymine, not uracil). This doesn't actually cause a problem as long as the bond list contains the bonds for these molecules.

The atom naming system for nucleotides is different to that for amino acids. Each nucleotide has a base (the 'nucleobase') linked to a ribose molecule (this is a 5-atom ring) and the combination is then called a 'nucleoside'. Finally, the ribose molecule is linked to a phosphate group, the whole thing becoming a nucleotide. Only nucleotides can form chains to make up RNA or DNA, but nucleosides and/or nucleobases can be found as additional free-standing molecules in a PDB file. Fortunately these are given in HETATM records in the file, so we don't have to worry about them (yet!).

When it comes to bonds between nucleotides, it's not a peptide bond so checking for the 'N' and 'C' atoms which form such a bond won't work. Instead, it's a phosphodiester bond, which links an oxygen atom, named O3', of one nucleotide to a phosphorus atom in the next nucleotide. The principle remains the same: the first nucleotide in the chain won't have anything linked to its phosphorus atom and the last one in the chain won't have any link from its O3' atom.

Sorry about the biochemistry lesson but it's critical to understand how these molecules are formed and linked to interpret the PDB file correctly and produce a model.

So now we have nucleotide chains working correctly. At this point we can display any protein with chains of amino acids and nucleotides (if present). The next stage is to look at some some different display options. Instead of the ball-and-stick or wireframe modes (i.e. only showing bonds) what about if we showed each chain as a single spline - a 'backbone' approach? And are there other options we could implement? That's for next time.

Page last updated June 29th 2026

Blog articles

Creating a new plugin: 11 (June 29th 2026)

Creating a new plugin: 10 (June 12th 2026)

Creating a new plugin: 9 (June 7th 2026)

Creating a new plugin: 8 (June 4th 2026)

Creating a new plugin: 7 (May 31st 2026)

Creating a new plugin: 6 (May 28th 2026)

Creating a new plugin: 5 (May 26th 2026)

Creating a new plugin: 4 (May 23rd 2026)

Creating a new plugin: 3 (May 22nd 2026)

Creating a new plugin: 2 (May 20th 2026)

Creating a new plugin: 1 (May 17th 2026)

The 'Space' plugins (May 7th 2026)

Creating PBR materials (March 24th 2026)

Data Storage - Then and Now (March 6th 2026)

Old Poser assets (March 2nd 2026)

More Noise, please (January 18th 2026)

Using GIT in VS 2022 (December 26th 2025)

Handling missing plugins (December 12th 2025)

Plugin compatibility with R2026 (November 24th 2025)

Affinity is now free! (November 3rd 2025)

World Creator 2025.1 (October 10th 2025)

So that was Cinema R2026? (September 19th 2025)

How to browse 3D assets (August 24th 2025)

Using Unity assets in Cinema 4D (August 15th 2025)

Plant Factory->Cinema 4D->World Creator (August 12th 2025)

Viewing glTF files (August 9th 2025)

Tessellation part 2 (August 5th 2025)

Shader writing with OSL - 3 (July 11th 2025)

Tessellation (June 23rd 2025)

Creating plants for C4D (June 15th 2025)

Adobe alternatives (May 28th 2025)

Using Graswald assets in C4D (May 7th 2025)

Which Mac for plugin development? (May 3rd 2025)

Why do plugin writers do it? (April 11th 2025)

Updating StarScape (February 26th 2025)

Using Cinema 4D shaders in Redshift (January 31st 2025)

PHP and MySQL (December 19th 2024)

Shader writing with OSL - 2 (November 11th 2024)

Shader writing with OSL (October 29th 2024)

StarScape (September 25th 2024)

Converting plugins from C4D 2024 to 2025 (September 16th 2024)

Cinema 4D 2025 and macOS plugins (September 15th 2025)

© 2021-2025 Microbion. All Rights Reserved.