[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] Iterating over all restraints




On Feb 23, 2008, at 9:57 PM, Ben Webb wrote:

Keren Lasker wrote:
I would like to iterate over all restraints.
To my understating the way to do that today is using
model.get_restraints(), although the restraints I get might also be
of type RestraintSet.
It seems that today one basically needs to know which restraint sets the
model contains.
I suggest to add a function Flat() in class Restraint that returns a flat list of all restraint in that instance ( will be called
recursively with RestraintSet).


Your other option is to do what Frido is currently doing - keep a
reference in Python to the RestraintSets you're interested in looking at later. Since everything is dynamic typed at the Python level, it's very
easy to build all sorts of useful hierarchies there at runtime.
that is my current solution, but I think that we should have a more general solution ( probably the dynamic casting is good enough for now).


	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle
_______________________________________________
IMP-dev mailing list

https://salilab.org/mailman/listinfo/imp-dev