<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"CMU Serif Roman";
panose-1:2 0 6 3 0 0 0 0 0 0;}
@font-face
{font-family:"CMU Sans Serif Medium";
panose-1:2 0 6 3 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.apple-tab-span
{mso-style-name:apple-tab-span;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1141921687;
mso-list-type:hybrid;
mso-list-template-ids:1568458128 -582352650 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:20.25pt;
text-indent:-18.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:Calibri;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:56.25pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:92.25pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:128.25pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:164.25pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:200.25pt;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:236.25pt;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:272.25pt;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:308.25pt;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style>
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi Eric,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I’ve been giving this some more thought. Is there perhaps a way to brute force this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">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]`?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Broadly I was thinking something like this might work based on your code suggestion below:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
<span style="mso-fareast-language:EN-US">Split the open model to get individual models for the chains<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
<span style="mso-fareast-language:EN-US">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.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
<span style="mso-fareast-language:EN-US">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.<o:p></o:p></span></li><ul style="margin-top:0cm" type="circle">
<li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level2 lfo1">
<span style="mso-fareast-language:EN-US">If not, move on to the next model<o:p></o:p></span></li></ul>
<li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
<span style="mso-fareast-language:EN-US">If I can ‘force’ the attributes on to the residues etc, I can then trigger the rendering without needed to use MAV?<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">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’?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Many thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Joe<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Serif Roman";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><u><span style="font-size:10.0pt;font-family:"CMU Serif Roman";color:black">
<o:p></o:p></span></u></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:#941100">Dr. Joseph Healey Ph.D. M.Sc. B.Sc. (Hons) MRSB</span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:#941100"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Research Fellow<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Warwick Medical School</span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">University of Warwick</span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Coventry</span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">CV47AL<br>
Mob: +44 (0) 7536 042620 | Twitter: <a href="https://twitter.com/JRJHealey"><span style="color:#0563C1">@JRJHealey</span></a> | </span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:black"><a href="http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey"><span style="font-size:10.0pt;color:#0563C1">Website</span></a><o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Email:
<a href="mailto:J.Healey.1@warwick.ac.uk"><span style="color:#0563C1">J.Healey.1@warwick.ac.uk</span></a> | ORCID: orcid.org/0000-0002-9569-6738</span><span style="font-size:12.0pt;font-family:"CMU Sans Serif Medium";color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Eric Pettersen <pett@cgl.ucsf.edu><br>
<b>Reply to: </b>"chimera-users@cgl.ucsf.edu BB" <chimera-users@cgl.ucsf.edu><br>
<b>Date: </b>Wednesday, 27 November 2019 at 23:56<br>
<b>To: </b>"chimera-users@cgl.ucsf.edu BB" <chimera-users@cgl.ucsf.edu><br>
<b>Cc: </b>"Healey, Joseph" <J.Healey.1@warwick.ac.uk><br>
<b>Subject: </b>Re: [Chimera-users] Auto-associate define attribute/render by attribute<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Nov 27, 2019, at 1:07 PM, Elaine Meng <<a href="mailto:meng@cgl.ucsf.edu">meng@cgl.ucsf.edu</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica">Python is beyond my skill set, though… somebody else would have to advise on that.<o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">from MultAlignViewer.MAViewer import MAViewer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">mav = MAViewer(“full-path-to-sequence-file”)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If you don’t have a file, but you know you want to use the sequence of chain C, you could do this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">from chimera import openModels, Molecule<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">for m in openModels.list(modelTypes=[Molecule]):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">try:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">seq = m.sequence(‘C’)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">except KeyError:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">continue<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">from MultAlignViewer.MAViewer import MAViewer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">mav = MAViewer([seq])<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You then add your custom header file with:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">mav.readHeaderFile(“full-path-to-header-file”)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">After that, the residues will have the necessary attribute (prefixed with “mav”, so if the header attribute is ChouFasmanImmuno, the residue attribute is mavChouFasmanImmuno).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">—Eric<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><br>
<br>
<span class="apple-tab-span"><o:p></o:p></span></p>
<p class="MsoNormal">Eric Pettersen<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UCSF Computer Graphics Lab<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>