[Chimera-users] Auto-associate define attribute/render by attribute

Healey, Joseph J.Healey.1 at warwick.ac.uk
Fri Nov 29 08:22:28 PST 2019

Hi Eric,

I’ve been giving this some more thought. Is there perhaps a way to brute force this?

My thinking at the moment is, given that I’ll know the sequence, positions, and scores I want to use, all I really need to do is somehow set the attributes of the relevant object, perhaps circumventing MAV altogether? My main question is then, how are attributes for the models currently stored? Does `mavAttributeName` become an actual attribute of the `molecule.residue[n]`?

Broadly I was thinking something like this might work based on your code suggestion below:

  *   Split the open model to get individual models for the chains
  *   Iterate the list of models, and test whether their .sequence() matches the sequence I expect (perhaps via alignment if not perfect matches). I could read the attribute file in alongside this in base python, which perhaps means I don’t need to use the defined format too, and therefore can encode the seq/score/position all in one go.
  *   If it does, assign the relevant attribute name/score to the residue/model (depending on how exactly the attributes are stored at the moment). As simple as Molecule.Residue.mavAttributeName? Though of course there wouldn’t necessarily need to be a “mav” in there.
     *   If not, move on to the next model
  *   If I can ‘force’ the attributes on to the residues etc, I can then trigger the rendering without needed to use MAV?

Presumably there’s a way to ‘inject’ the namespace with an object equivalent to that which MAV/DefineAttribute would achieve, and I can do the association ‘manually’?

Many thanks,


Dr. Joseph Healey Ph.D. M.Sc. B.Sc. (Hons) MRSB
Research Fellow
Warwick Medical School
University of Warwick
Mob: +44 (0) 7536 042620  | Twitter: @JRJHealey<https://twitter.com/JRJHealey>  |  Website<http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey>
Email: J.Healey.1 at warwick.ac.uk<mailto:J.Healey.1 at warwick.ac.uk> | ORCID: orcid.org/0000-0002-9569-6738

From: Eric Pettersen <pett at cgl.ucsf.edu>
Reply to: "chimera-users at cgl.ucsf.edu BB" <chimera-users at cgl.ucsf.edu>
Date: Wednesday, 27 November 2019 at 23:56
To: "chimera-users at cgl.ucsf.edu BB" <chimera-users at cgl.ucsf.edu>
Cc: "Healey, Joseph" <J.Healey.1 at warwick.ac.uk>
Subject: Re: [Chimera-users] Auto-associate define attribute/render by attribute

On Nov 27, 2019, at 1:07 PM, Elaine Meng <meng at cgl.ucsf.edu<mailto:meng at cgl.ucsf.edu>> wrote:

Python is beyond my skill set, though… somebody else would have to advise on that.

The first thing I should say is that Multalign Viewer is only available as a graphical tool, so you will only be able to script this for a Chimera that is running its graphical interface, not in any headless “batch” mode.  Okay, with that out of the way, the first job is to get a Python instance of Multalign Viewer showing the sequence you want with the chains you want associated.  Unlike ChimeraX, which associates on a per-chain basis, Chimera associates on a per-structure basis, so you will have to first split your structure apart by chains (with the “split” command).  If you have the pertinent sequence in a file, you could do this:

from MultAlignViewer.MAViewer import MAViewer
mav = MAViewer(“full-path-to-sequence-file”)

If you don’t have a file, but you know you want to use the sequence of chain C, you could do this:

from chimera import openModels, Molecule
for m in openModels.list(modelTypes=[Molecule]):
seq = m.sequence(‘C’)
except KeyError:
from MultAlignViewer.MAViewer import MAViewer
mav = MAViewer([seq])

You then add your custom header file with:


After that, the residues will have the necessary attribute (prefixed with “mav”, so if the header attribute is ChouFasmanImmuno, the residue attribute is mavChouFasmanImmuno).


Eric Pettersen
UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20191129/b10db265/attachment-0001.html>

More information about the Chimera-users mailing list