<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="">You’re welcome! Glad I could help.<div class=""><br class=""></div><div class="">—Eric<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 27, 2020, at 10:38 PM, 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">Wow, so easy! Thank you so much!!</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El vie., 28 feb. 2020 a las 1:35, Eric Pettersen (<<a href="mailto:pett@cgl.ucsf.edu" class="">pett@cgl.ucsf.edu</a>>) escribió:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">Hi Pablo,<div class=""><span style="white-space:pre-wrap" class=""> </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 style="white-space:pre-wrap" class=""> </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="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><span style="white-space:pre-wrap" class=""><br class=""> </span>Eric Pettersen</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><span style="white-space:pre-wrap" class=""> </span>UCSF Computer Graphics Lab</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><br class=""></div><br class="">
</div>
<div class=""><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" target="_blank" class="">pablosolar.r@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">Hello all, </div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">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:rgb(68,68,68)"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">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:rgb(68,68,68)"><i class=""><br class=""></i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><i class="">def adjust_visualization(self, final_pdbs):</i></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><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:rgb(68,68,68)"><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:rgb(68,68,68)"><i class=""> if self.fitopt_tag in <a href="http://molecule.name/" target="_blank" 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:rgb(68,68,68)"><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:rgb(68,68,68)"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">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:rgb(68,68,68)"><br class=""></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">Thank you all in advance!</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><br class="">Regards!!</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><br class=""></div><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></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" target="_blank" class="">Chimera-dev@cgl.ucsf.edu</a><br class=""><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev" target="_blank" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="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><font size="1" face="tahoma, sans-serif" color="#0b5394" class=""><b class=""><div class=""><a href="mailto:pablosolar.r@gmail.com" style="font-weight:normal" target="_blank" class=""><b class="">pablosolar.r@gmail.com</b></a><br class=""></div></b></font><div class=""><div class=""><p class=""><br class=""></p></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>