[chimera-dev] Pointer to model when opened
Eric Pettersen
pett at cgl.ucsf.edu
Tue Apr 24 12:43:14 PDT 2018
> On Apr 24, 2018, at 1:20 AM, Pablo Solar Rodríguez <pablosolar.r at gmail.com> wrote:
>
> Hello Eric and the rest of mates!
Hi Pablo!
> I would like to know if when you open a PDB through Midas 'open' method, the opened model is returned.
Since opening a file may generate multiple models (e.g. an NMR ensemble), the open method returns a list of models. If you expect your file to generate a single model, you can just use ‘open(…)[0]’ to get the model.
> I need to have access to that specific model all the time, even when IDs in the Model Panel are changed due to some other models are closed or opened.
Model IDs for existing models don’t change when other models are opened in closed. In fact, they cannot be changed!
>
> The idea is something like:
>
> if os.path.exists(model_path):
> from Midas import open
> self.model_path_pointer = open(model_path, filetype="pdb”)
That almost works, but like I said above you would ‘[0]’ to the open command in order to get the model out of the returned list.
>
> And whenever I need, make:
>
> self.model_path_pointer.name <http://self.model_path_pointer.name/>
You can change a model’s name freely, e.g.:
self.model_path_pointer.name = “New name”
> self.model_path_pointer.id <http://self.model_path_pointer.id/>
Again, you can’t change a model ID, though if you use the “model” keyword of the open() call, you can have it initially assigned to any available model number that you want.
—Eric
Eric Pettersen
UCSF Computer Graphics Lab
> ....
>
> Thank you in advance and kind regards!
>
>
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20180424/4478b59f/attachment-0001.html>
More information about the Chimera-dev
mailing list