<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 Pablo,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>The “model IDs” aren't even necessarily integers, for instance the model ID of the first member of an NMR ensemble is 0.1 . The easiest way to get the atom spec you are trying to generate is to call <i class="">str()</i> on the model. For instance if <i class="">m</i> is a variable holding model 0, then <i class="">str(m)</i> returns “#0”. So your <i class="">indexes.append()</i><span style="font-style: normal;" class=""> call becomes:</span></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><i class="">indexes.append(str(molecule))</i></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class="">and you don’t even need to use <i class="">enumerate()</i><span style="font-style: normal;" class="">.</span></div><div class=""><br class=""></div><div class="">—Eric<br class=""><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 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=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On Feb 27, 2020, at 4:27 AM, Pablo Solar Rodríguez <<a href="mailto:pablosolar.r@gmail.com" class="">pablosolar.r@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Hello all, </div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Optimizing my plugin, I need to hide atoms and show ribbons for some opened Molecules.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">What I am trying is to loop over opened molecules in the ModelPanel and, If the Molecule matches a specific tag, save its index in a indexes list. Then, hide atoms and show ribbons by makeCommand with the indexes:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class=""><br class=""></i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class="">def adjust_visualization(self, final_pdbs):</i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class=""> """<br class=""> Adjust atoms and ribbons visualization for FitOpt final solutions<br class=""> """<br class=""> indexes = []<br class=""> chimera.openModels.add(final_pdbs)<br class=""> molecule_list = om.list(modelTypes=[Molecule])</i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class=""><br class=""> for index, molecule in enumerate(molecule_list):</i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class=""> if self.fitopt_tag in <a href="http://molecule.name/" class="">molecule.name</a>:<br class=""> indexes.append('#' + str(index))</i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><i class=""><br class=""> makeCommand(' '.join(['~show', ' '.join(indexes)]))<br class=""> makeCommand(' '.join(['ribbon', ' '.join(indexes)]))</i><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">It seems that the index from enumerate is not corresponding to the index in the ModelPanel so how could I get the proper molecule index??</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Thank you all in advance!</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class="">Regards!!</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br class=""></div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><br class="webkit-block-placeholder"></div><p class=""><font size="1" face="tahoma, sans-serif" color="#38761d" class=""><b class=""><u class="">Pablo Solar Rodríguez</u></b></font></p><div class=""><div class=""><p class=""><br class=""></p></div></div></div></div></div></div></div>
_______________________________________________<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=""></div></blockquote></div><br class=""></div></body></html>