Question: How to "linearize" or "unfold" a PDB format structure to secondary structure?
gravatar for Michael Dondrup
17 months ago by
Bergen, Norway
Michael Dondrup48k wrote:

Hi all, I need a quick hack for the following problem:

I have a protein structure (generated by i-Tasser) in PDB format. I would like to transform the 3D model into a linearized form representing only the secondary structure, as a long flat chain of secondary structures from C to N terminus along the linear backbone. Of course, contained helices and sheets should still be rendered correctly. So this might be called reversing the 3D-folding of the structure.

The output would preferentially be in PDB format again. Is there possibly an easy way to do that?

Please let me know if the description of the task is unclear.

Background: I wish to create a little protein movie in Chimera using its morph tool, where the 2D cartoon structure morphs into the 3D ribbon structure. I tried to quickly flatten the structure manually, but that is not really convenient. I also have the i-Tasser output, if that helps.

The structure, just in case you need it.

Here is a little movie trying to explain what I want to achieve. As you can see, the linear model is far from perfect.

And here is the final movie.

ADD COMMENTlink modified 17 months ago • written 17 months ago by Michael Dondrup48k

I think it would be possible in principle to do this as discussed below. Thinking about it further, you wouldnt need to bother faffing about with parsing a DSSP file as chimera tracks secondary structure. You can use an approach like I did here:

For each atom, figure out if it belongs to a helix, or sheet, if not, set its dihedrals as The suggests below (assuming the maths in that link checks out). This I'm not sure how to do, but the good folks over on the UCSF User forum would know easily enough.

ADD REPLYlink written 17 months ago by Joe18k

I just posted the final movie

ADD REPLYlink written 17 months ago by Michael Dondrup48k

Could give me a bit more ideas about how to adjust the angles correctly? Is it ok to set them all to some default except for Coil? I really appreciate your input.

ADD REPLYlink written 17 months ago by Michael Dondrup48k

This is just off the top of my head but I don't consider myself particularly expert here.

To generate a perfectly linear molecule, you'd need to find all the 'turn' regions (i.e. non helix and non sheet). I think you'd then need to set the phi angle to (for instance) 90˚, then the psi angle to -90˚ (or whatever the actual number is, but they'd need to be opposing I think).

I'm not sure about the maths in The's answer below, but if they're coming from a paper that knows more about it than me that might be the way to go.

I can ask a friend of mine about this though. enter image description here

ADD REPLYlink written 17 months ago by Joe18k
gravatar for The
17 months ago by
United States
The160 wrote:

Can this help, with default values? I guess it outputs the model in PDB format as well

"We set the default for the backbone dihedral angles to the extended conformation (ϕ = −120∘, ψ = 140∘, ω = 180∘)."

PeptideBuilder: A simple Python library to generate model peptides Github repository

ADD COMMENTlink written 17 months ago by The160

Thank you very much. I will try to figure it out. I have only until Thursday to prepare the vid so it might get tough. I will give you feedback once I am finished.

ADD REPLYlink written 17 months ago by Michael Dondrup48k

I think this approach would work in principle, but you'd need to only alter the dihedrals for the regions which aren't a-helix or b-sheet, else the secondary structure would also be destroyed. I think it might be possible to parse a DSSP file for this information though.

ADD REPLYlink written 17 months ago by Joe18k

yes, as Michael wants to preserve the well defined secondary structure elements

ADD REPLYlink written 17 months ago by The160

Ok, so here is my first update, I installed Peptide builder and it works(?). I assume it's Python 2.7:

conda create --name py2 python=2.7
source activate py2
pip install git+

Try to load the package:

   Python 2.7.15 | packaged by conda-forge | (default, Jul  2 2019, 00:42:22)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PeptideBuilder
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdondrup/miniconda/envs/py2/lib/python2.7/site-packages/PeptideBuilder/", line 10, in <module>
    from .PeptideBuilder import *
  File "/Users/mdondrup/miniconda/envs/py2/lib/python2.7/site-packages/PeptideBuilder/", line 22, in <module>
    from Bio.PDB.Vector import *
ImportError: No module named Vector

So, in, comment out:

 from Bio.PDB.Vector import *

There doesn't seem to be a Vector module but Vector is a type imported already ???..... Package loads.

Running the script after commenting out from Bio.PDB.Vector import * and changing print i to print (i), the script produces some output.

Now, modifying def build_linear_model(pdb_filename): looks promising.....

My 'first python script':

from __future__ import print_function
from Bio.PDB import *
from Bio.PDB import PDBParser
from Bio.PDB import Superimposer
from Bio.PDB.Atom import *
from Bio.PDB.Residue import *
from Bio.PDB.Chain import *
from Bio.PDB.Model import *
from Bio.PDB.Structure import *
from Bio.PDB.Entity import*
import math
from PeptideBuilder import Geometry
import PeptideBuilder
import numpy
from os import path


def build_linear_model_from_sequence(seq):

    for res in seq:
    for i in range(1,len(model_structure_geo)):
        model_structure=PeptideBuilder.add_residue(model_structure, model_structure_geo[i])

    return model_structure                

def make_pdb_file(struct, file_nom):
    outfile = PDBIO()
    return file_nom        

make_pdb_file(build_linear_model_from_sequence(myseq), outfile)

Added secondary structure annotation from the original PDB structure by copy-paste...

Output looks good (red helix, green strand), now the angles...? enter image description here

Still, I am not sure how to adjust the angles propperly

ADD REPLYlink modified 17 months ago • written 17 months ago by Michael Dondrup48k

That looks pretty good so far!

Here's an update from a friend of mine (the developer of PyChimera):

Firstly, you can use PeptideBuilder in the Build Structure options (or without Chimera as you have already done). Just a matter of typing in the sequence it seems, but I'm not sure what happens with secondary structure in this case.

Jaime had attempted something similar here, perhaps this will be of use:

Inside chimera, the approach would look something like:

for r in m.residues:
    r._oldphi, r._oldpsi = r.phi, r.psi
        if r.phi is not None:
            r.phi -= r.phi
        if r.psi is not None:
            r.psi -= r.psi
ADD REPLYlink written 17 months ago by Joe18k

After trying this for a while, I had to give the ProteinBuilder up. For whatever reason, Chimera imports only the first 431 residues of my 500+ protein. I tried to find out why, but Peptidebuilder generated all residues, they just couldn't be imported. As I am running out of time, I will try to generate the peptide and try to set the angles manually for all residues in Chimera's structure builder.

ADD REPLYlink written 17 months ago by Michael Dondrup48k
gravatar for Joe
17 months ago by
United Kingdom
Joe18k wrote:

Here's an approach, but far from perfect, though does produce a perfectly linear model (but can be quite slow). Uses the PeptideBuilder again. The angles are also not quite right, so the secondary structure is a bit off. There might be other options to explore in the peptideBuilder though. Maybe it helps?

Can't take credit for this, was all Jaime's input, I just consolidated it.

From inside chimera (or using PyChimera):

import chimera
from BuildStructure import placePeptide

m = chimera.openModels.list()[0]

Using Ubiquitin (1UBQ) as an example: ubq

seq = str(m.sequence("A"))
angles = [(0, 0) for _ in range(len(seq))]

p = placePeptide(seq, angles)

Which will add another model to the view: ubqstrno

We can then try copying over the secondary structure attributes, but this isn't perfect at the moment. It seems the angles are not as simple as (0, 0)


n = openModels.list()[1]

for r1, r2 in zip(m.residues, n.residues):
    r2.ssId = r1.ssId
    r2.isHelix = r1.isHelix
    r2.isSheet = r1.isSheet
    r2.isStrand = r1.isStrand

Close! - but needs more tinkering as I said...

Here's the secondary structure colour coded for clarity:


Update, a slight improvement in SS can be obtained with using the angles 90 and -90, though there is still some rotation along the total length of the sequence, so the 'correct' angle for a perfectly linear molecule is likely slightly lower. I think the key to the molecule being linear however, is that the 2 angles must cancel out.

Result of angles = [(90, -90) for _ in range(len(seq))] as above.


ADD COMMENTlink modified 17 months ago • written 17 months ago by Joe18k
gravatar for Michael Dondrup
17 months ago by
Bergen, Norway
Michael Dondrup48k wrote:

I finally tried a manual approach first via Chimera's peptide builder.

  • I entered the residue sequences,
  • then changed the angles for all residues to -1, 1
  • then I took the secondary structure prediction and manually used the default angle settings for helix and parallel strand and assigned them to the residues
  • the resulting peptide has ok looking alpha helices, but strands were not shown
  • I then exported the peptide to PDB and added the secondary structure annotation from the 3D model and re-imported the file

That seems to do the job but is a nuisance. Therefore, if we can just use the default angles in jrj.healy's answer, the outcome should be nice.

ADD COMMENTlink written 17 months ago by Michael Dondrup48k

Do you have some info on the defaults Michael? I’d be up for testing it myself.

ADD REPLYlink written 17 months ago by Joe18k

So, here are the defaults in Chimera:

                        ϕ     Ψ
𝛂-helix               -57   -47
parallel-β sheet     -119   113
antipar.-β sheet     -139   135
3/10- helix           -49   -26
π-helix               -57   -70
ADD REPLYlink modified 17 months ago • written 17 months ago by Michael Dondrup48k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1486 users visited in the last hour