[phenixbb] secondary structure presentation in VMD

Tristan Croll tic20 at cam.ac.uk
Mon Jan 22 03:06:58 PST 2018

Since I'm not actually all that familiar with PyMol scripting, here's 
how you can write out secondary structure annotations from ChimeraX and 
apply them in VMD for an arbitrarily-sized structure. First, open the 
model in ChimeraX and go to the Python console (Tools/General/Shell). 
Then copy/paste the below:

def write_secondary_structure(model, filename):
     from chimerax.core.atomic import Residue
     r = m.atoms.residues
     ss_types = r.ss_types
     type_dict = {
         Residue.SS_COIL:    'C',
         Residue.SS_HELIX:   'H',
         Residue.SS_STRAND:  'E'
     with open(filename, 'w') as f:
         print(','.join((type_dict[s] for s in r.ss_types)), file=f)

from chimerax.core.atomic import AtomicStructure
m = session.models.list(type=AtomicStructure)[0]
write_secondary_structure(m, 'structure.txt')

This will write out the secondary structure information to structure.txt 
using VMD's annotation format. Then, open your model in VMD, open the 
console (Extensions/Tk Console) and copy/paste the below:

proc apply_secondary_structure {model infile} {
     set infile [open $infile r]
     set fdata [read $infile]; puts "Read structure info"
     set f_structure [split [lindex $[split $fdata "\n"] 0] ","]; puts 
"Successfully split data"
     $model set structure $f_structure; puts "Applied structure to model"
     close $infile

set model [atomselect top all]
apply_secondary_structure $model structure.txt
$model delete

... and your cartoon should now look as expected.

On 2018-01-21 18:23, Tristan Croll wrote:
> I’m guessing this structure is on the large side? Unless something has
> changed since I last used it, VMD ignores secondary structure
> annotations in the PDB file. It calculates them instead using an old
> version of STRIDE, which fails beyond 9,999 residues (or possibly
> atoms? Can’t remember now). One can hack together a quick-fix solution
> fairly easily (basically split the structure into smaller pieces,
> calculate for each of those then copy the results back to the master
> structure). If you really want the secondary structure in VMD to match
> what Pymol sees, you could do it fairly easily with a little scripting
> in both packages. VMD gets/sets secondary structure as a simple Tcl
> array of characters, one per residue. So all you’d need to do in Pymol
> is a simple loop over all residues to get their secondary structure
> designation and write the corresponding character to a text file. Then
> load the text file in VMD, convert the string to a character array,
> and apply it to your model. A mite fiddly, but doable.
> Alternatively, have you tried ChimeraX? It’s really rather nice in
> what it can do.
> Hope this helps,
> Tristan
> Tristan Croll
> Research Fellow
> Cambridge Institute for Medical Research
> University of Cambridge CB2 0XY
>> On 21 Jan 2018, at 15:44, Paul Emsley <pemsley at mrc-lmb.cam.ac.uk> 
>> wrote:
>> Hi Charles,
>>> On 21/01/2018 15:04, CPMAS Chen wrote:
>>> This may be a little off-topic. I have posted this in VMD users mail 
>>> list. I want to try here too to see
>>> if anyone experienced similar issue.
>>> VMD and pymol gave different presentation on the secondary structure 
>>> of a protein.
>>> I correctly labelled all helices and sheets.
>> I wonder what that means. How did you label all helices and sheets and 
>> how did you know that you did it correctly?
>> Paul
>> _______________________________________________
>> phenixbb mailing list
>> phenixbb at phenix-online.org
>> http://phenix-online.org/mailman/listinfo/phenixbb
>> Unsubscribe: phenixbb-leave at phenix-online.org
> _______________________________________________
> phenixbb mailing list
> phenixbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/phenixbb
> Unsubscribe: phenixbb-leave at phenix-online.org

More information about the phenixbb mailing list