In the modeller.physical module, is there a way to select to select the physical types given the index? Something like:
>> import modeller >> print modeller.physical.types[1] physical.bond
I see that each modeller.physical.<restraint type> has a _num method which returns the index, but I'd like to avoid looping through all the object types if possible!
Cheers, Chris
------------------- Dr Chris Wood STFC Rutherford Appleton Laboratory Didcot OX11 0QX
chris.wood@stfc.ac.uk www.ccpem.ac.uk
Tel: +44(0)1235 567864 Tel: +44(0)7909 586624 Fax: +44(0)1235 567801
Skype: chris_c_woodcallto://chris_c_wood/
On 10/30/14, 11:55 AM, chris.wood@stfc.ac.uk wrote: > In the modeller.physical module, is there a way to select to select the > physical types given the index?
No. They are treated as a dict at the Python level. Why do you want to?
> I see that each modeller.physical.<restraint type> has a _num method > which returns the index
Actually that's a private member variable, so you shouldn't rely on it. Use the get_type() method instead.
> I’d like to avoid looping through all the > object types if possible!
Just loop the first time you need to do a lookup, and cache the list for future calls. I can't imagine it would be slow!
Ben Webb, Modeller Caretaker
Thanks :) it isn't slow - I just wondered if I'd missed something in the docs that would do it for me!
-----Original Message----- From: Modeller Caretaker [mailto:modeller-care@salilab.org] Sent: 30 October 2014 19:32 To: Wood, Chris (STFC,RAL,SC); modeller_usage@salilab.org Subject: Re: [modeller_usage] Physical.values
On 10/30/14, 11:55 AM, chris.wood@stfc.ac.uk wrote: > In the modeller.physical module, is there a way to select to select > the physical types given the index?
No. They are treated as a dict at the Python level. Why do you want to?
> I see that each modeller.physical.<restraint type> has a _num method > which returns the index
Actually that's a private member variable, so you shouldn't rely on it. Use the get_type() method instead.
> I'd like to avoid looping through all the object types if possible!
Just loop the first time you need to do a lookup, and cache the list for future calls. I can't imagine it would be slow!
Ben Webb, Modeller Caretaker
participants (2)
-
chris.wood@stfc.ac.uk
-
Modeller Caretaker