<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:"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;
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;}
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.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle21
{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:574172071;
mso-list-type:hybrid;
mso-list-template-ids:1637382930 -1601937828 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
{mso-level-text:%1;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1
{mso-list-id:1174151361;
mso-list-template-ids:-1587359360;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
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">That looks pretty similar to what I had come up with yeah (here I’m assuming an exact sequence to attribute correspondence over the full length of the chain). This is approximately the approach I
was using:<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">from chimera import openModels, Molecule<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">from chimera import runCommand as rc<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"># assume a list of values <= len(seq) read in from a file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">rc(“split”)<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">for m in openModels.list(modelTypes=[Molecule]):<span style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> # insert logic for pairing sequences/input files to chains by sequence matching<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> # some heuristic like Levenshtein distance will probably suffice for now or I can replace this with pairwise alignment from BioPython or something.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> for r, val in zip(m.residues, list_of_vals):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> setattr(r, ‘chouFasmanImmuno’, val)<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">rc(“rangecol chouFasmanImmuno ….”)<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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">On your notes:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<ol start="1" type="1">
<li class="MsoListParagraph" style="mso-list:l0 level1 lfo2"><span style="mso-fareast-language:EN-US">- The various trys/ifs are a good idea so I’ll incorporate those, thanks!<o:p></o:p></span></li><li class="MsoListParagraph" style="mso-list:l0 level1 lfo2"><span style="mso-fareast-language:EN-US">- Thanks for the tip on the capital letters – this was going to be my next question as I couldn’t get the RBA dialogue to show the new attributes so this probably
explains it. I’m not fussy about the case-sensitivity of the attributes so I’ll just stick to camel/lowercase.<o:p></o:p></span></li><ol start="1" type="a">
<li class="MsoListParagraph" style="mso-list:l0 level2 lfo2"><span style="mso-fareast-language:EN-US">On a related note, is there a need to programmatically ‘refresh’ rangecol/RBA after defining the attribute, as there is with the dialogue box, or should it
be happy once the attr is set?<o:p></o:p></span></li></ol>
<li class="MsoListParagraph" style="mso-list:l0 level1 lfo2"><span style="mso-fareast-language:EN-US">- This was exactly my plan!
</span><span style="font-family:"Apple Color Emoji";mso-fareast-language:EN-US">😉</span><span style="mso-fareast-language:EN-US"> the residue attribute numbers for various different immunogenicity algorithms are coming from a separate suite of tools, so a pandas
dataframe will probably be the input (perhaps as a csv). Initially my thinking was to use the Define Attribute format and encode the sequence in a #comment, but actually this approach frees me entirely from needing to follow that format which I think is better.
My python is pretty good these days so it’s only when I run up against the inner workings of chimera that I need to consult you guys really!<o:p></o:p></span></li></ol>
<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">This definitely feels like a simpler approach than messing with DefineAttribute or MAV, so I think it’s the way to go. Thanks again for the help.<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>Monday, 2 December 2019 at 22:40<br>
<b>To: </b>"Healey, Joseph" <J.Healey.1@warwick.ac.uk><br>
<b>Cc: </b>"chimera-users@cgl.ucsf.edu BB" <chimera-users@cgl.ucsf.edu><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>
<p class="MsoNormal">As long as we are talking about exact (sub)sequence matches, I think it is reasonably simple to do in Python:
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"># pairs of sequences and corresponding values you want to assign…<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">seq_vals = [<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">(“ADTY…whatever…PLHE”, (1.97, 2.14, … same len as sequence…, 0.88, 1.22)),<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">(“…next sequence…”, (…next set of values…))<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">for seq in m.sequences():<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">for target_seq, vals in seq_vals:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">try:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">i = str(seq).index(target_seq)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">except ValueError:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">continue<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">for offset, val in enumerate(vals):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">r = seq.residues[i+offset]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">if r:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">r.chouFasmanImmuno = val<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">A few notes:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1) If there is missing structure, there maybe not be a residue that corresponds to a sequence position, which is why there is an “if r:” test in the script. The full sequence is known from the SEQRES records in the PDB file.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">2) Avoid assigning an attribute name starting with an upper-case letter. Symbolic constants start with upper-case letters and the render-by-attr code will screen out such attributes from its interface. There is a way around this by registering
the attribute with the SimpleSession module (which will also get the attribute to save in sessions). I can provide details if needed.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">3) You may want to read the sequences and values from a file rather than have them directly in the script. You might also want to set multiple attributes, in which case you would include the the attribute name along with the sequence and
values, and change the corresponding ‘for’ loop and change ‘r.attrName = val’ to setattr(r, attrName, val). I don’t know how good your Python juju is, but I can provide guidance as needed.<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>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Nov 29, 2019, at 8:22 AM, Healey, Joseph <<a href="mailto:J.Healey.1@warwick.ac.uk">J.Healey.1@warwick.ac.uk</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Eric,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I’ve been giving this some more thought. Is there perhaps a way to brute force this?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Broadly I was thinking something like this might work based on your code suggestion below:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoListParagraph" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:20.25pt;margin-bottom:.0001pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]>Split the open model to get individual models for the chains<o:p></o:p></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:20.25pt;margin-bottom:.0001pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]>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></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:20.25pt;margin-bottom:.0001pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]>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></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:56.25pt;margin-bottom:.0001pt;text-indent:-18.0pt;mso-list:l1 level2 lfo1">
<![if !supportLists]><span style="font-size:10.0pt;font-family:"Courier New""><span style="mso-list:Ignore">o<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]>If not, move on to the next model<o:p></o:p></p>
<p class="MsoListParagraph" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:20.25pt;margin-bottom:.0001pt;text-indent:-18.0pt;mso-list:l1 level1 lfo1">
<![if !supportLists]><span style="font-size:10.0pt;font-family:Symbol"><span style="mso-list:Ignore">·<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]>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></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Many thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Joe<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Serif Roman";color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><u><span style="font-size:10.0pt;font-family:"CMU Serif Roman";color:black"> </span></u><o:p></o:p></p>
</div>
<div>
<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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Research Fellow</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Warwick Medical School</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">University of Warwick</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Coventry</span><o:p></o:p></p>
</div>
<div>
<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></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.0pt;font-family:"CMU Sans Serif Medium";color:black">Email:<span class="apple-converted-space"> </span><a href="mailto:J.Healey.1@warwick.ac.uk"><span style="color:#0563C1">J.Healey.1@warwick.ac.uk</span></a><span class="apple-converted-space"> </span>|
ORCID: <a href="http://orcid.org/0000-0002-9569-6738"><span style="color:purple">orcid.org/0000-0002-9569-6738</span></a></span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div>
<p class="MsoNormal"><b><span style="font-size:12.0pt">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt">Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu"><span style="color:purple">pett@cgl.ucsf.edu</span></a>><br>
<b>Reply to:<span class="apple-converted-space"> </span></b>"<a href="mailto:chimera-users@cgl.ucsf.edu"><span style="color:purple">chimera-users@cgl.ucsf.edu</span></a><span class="apple-converted-space"> </span>BB" <<a href="mailto:chimera-users@cgl.ucsf.edu"><span style="color:purple">chimera-users@cgl.ucsf.edu</span></a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Wednesday, 27 November 2019 at 23:56<br>
<b>To:<span class="apple-converted-space"> </span></b>"<a href="mailto:chimera-users@cgl.ucsf.edu">chimera-users@cgl.ucsf.edu</a> BB" <<a href="mailto:chimera-users@cgl.ucsf.edu">chimera-users@cgl.ucsf.edu</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></b>"Healey, Joseph" <<a href="mailto:J.Healey.1@warwick.ac.uk">J.Healey.1@warwick.ac.uk</a>><br>
<b>Subject:<span class="apple-converted-space"> </span></b>Re: [Chimera-users] Auto-associate define attribute/render by attribute</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">On Nov 27, 2019, at 1:07 PM, Elaine Meng <<a href="mailto:meng@cgl.ucsf.edu"><span style="color:purple">meng@cgl.ucsf.edu</span></a>> wrote:<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<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.</span><o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">from MultAlignViewer.MAViewer import MAViewer<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">mav = MAViewer(“full-path-to-sequence-file”)<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">from chimera import openModels, Molecule<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">for m in openModels.list(modelTypes=[Molecule]):<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">try:<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">seq = m.sequence(‘C’)<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">except KeyError:<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">continue<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">from MultAlignViewer.MAViewer import MAViewer<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">mav = MAViewer([seq])<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">You then add your custom header file with:<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">mav.readHeaderFile(“full-path-to-header-file”)<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<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>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">—Eric<o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Eric Pettersen<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">UCSF Computer Graphics Lab<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica">_______________________________________________<br>
Chimera-users mailing list:<span class="apple-converted-space"> </span></span><a href="mailto:Chimera-users@cgl.ucsf.edu"><span style="font-size:9.0pt;font-family:Helvetica;color:purple">Chimera-users@cgl.ucsf.edu</span></a><span style="font-size:9.0pt;font-family:Helvetica"><br>
Manage subscription:<span class="apple-converted-space"> </span></span><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users"><span style="font-size:9.0pt;font-family:Helvetica;color:purple">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</span></a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>