
Wow, so easy! Thank you so much!! El vie., 28 feb. 2020 a las 1:35, Eric Pettersen (<pett@cgl.ucsf.edu>) escribió:
Hi Pablo, 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 *str()* on the model. For instance if *m* is a variable holding model 0, then *str(m)* returns “#0”. So your *indexes.append()* call becomes:
*indexes.append(str(molecule))*
and you don’t even need to use *enumerate()*.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Feb 27, 2020, at 4:27 AM, Pablo Solar Rodríguez <pablosolar.r@gmail.com> wrote:
Hello all,
Optimizing my plugin, I need to hide atoms and show ribbons for some opened Molecules.
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:
*def adjust_visualization(self, final_pdbs):*
* """ Adjust atoms and ribbons visualization for FitOpt final solutions """ indexes = [] chimera.openModels.add(final_pdbs) molecule_list = om.list(modelTypes=[Molecule])*
* for index, molecule in enumerate(molecule_list):*
* if self.fitopt_tag in molecule.name <http://molecule.name/>: indexes.append('#' + str(index))*
* makeCommand(' '.join(['~show', ' '.join(indexes)])) makeCommand(' '.join(['ribbon', ' '.join(indexes)]))*
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??
Thank you all in advance!
Regards!!
*Pablo Solar Rodríguez*
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-dev
-- *Pablo Solar Rodríguez* *pablosolar.r@gmail.com <pablosolar.r@gmail.com>*