<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Jan!<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Depending on whether you want to color all atoms with a particular chain ID, or atoms in the peptide/nucleic acid chain with that ID but not waters, <i class="">etc.</i><span style="font-style: normal;" class=""> there are two routes:</span></div><div class=""><br class=""></div><div class="">In the code below I am going to assume you have your color in a variable named <font face="Courier New" class=""><span style="font-style: normal;" class="">color</span></font>, and the model in a variable named <font face="Courier New" class=""><span style="font-style: normal;" class="">m</span></font> and that you are coloring chain A.</div><div class=""><br class=""></div><div class=""><b class=""><u class="">All atoms with that chain ID</u></b></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">for a in m.atoms:</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>if <a href="http://a.residue.id" class="">a.residue.id</a>.chainId == ‘A’:</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>a.color = color</span></font></div><div class=""><br class=""></div><div class=""><b class=""><u class="">All polymer atoms in that chain</u></b></div><div class=""><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">seq = m.sequence(‘A’)</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class="">for r in seq.residues:</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>if r:</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>for a in r.atoms:</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>a.color = color</span></font></div><div class=""><br class=""></div><div class="">Chimera just doesn’t have the data structures to do this efficiently that ChimeraX has. If the chain is being depicted as ribbon, you would actually set the residue’s color rather than the atom colors.</div><div class=""><br class=""></div><div class="">—Eric</div><div class="">
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="white-space: pre;"><br class="Apple-interchange-newline"> </span>Eric Pettersen</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>UCSF Computer Graphics Lab</div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jan 31, 2020, at 5:54 AM, Jan Kosinski <<a href="mailto:jan.kosinski@embl.de" class="">jan.kosinski@embl.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">In the “old” Chimera, is there an efficient way of coloring an entire chain with a single defined color from the Python interface without resorting to runCommand(‘color …') and atom_spec ? The runCommand(‘color …atom_spec ’) makes some issues when special characters are used as chain ids in the atom_spec. I guess I could loop through all atoms of chain but that might be slow for big structures.<br class=""><br class="">Best,<br class="">Jan<br class="">_______________________________________________<br class="">Chimera-dev mailing list<br class=""><a href="mailto:Chimera-dev@cgl.ucsf.edu" class="">Chimera-dev@cgl.ucsf.edu</a><br class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev<br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>