I just added support for multiple hierarchies, so each particle can be part of as many hierarchies as you want. So you can just make a new hierarchy type per particle.
To make a new herarchy type you do: ht= IMP.core.HierarchyTraits("my new hierarchy type") then to use it you do hd= IMP.core.HierarchyDecorator.cast(p, ht) hd= IMP.core.HierarchyDecorator.create(p, ht) hd= IMP.core.HierarchyDecorator(p, ht) hd.get_child(0) etc.
I'll add example code shortly.
On Dec 23, 2008, at 12:40 PM, Friedrich Foerster wrote:
> maybe that solution works for me. > to be explicit: > what happens to particles d,e,f, which have completely different > restraints, which possibly require a different hierarchy? > more importantly, what happens if c is affected by another > restraint, which requires a different hierarchy? > > if i require a hierarchy that makes all restraints happy, that is my > problem. > if not, that is an improvement for me
> > > thanks > > frido > > > On Fri, Dec 19, 2008 at 7:40 PM, Daniel Russel drussel@gmail.com > wrote: > Frido: > I am not sure I entirely understand you message. Would you consider > it an improvement to be able to do the following: > > # a,b,c are Particles which are MolecularHierarchyDecorator roots > for the proteins > # they can have arbitrary levels > > # the identifier for the equivalence class hierarchy > traits= HiearchyDecoratorTraits("equivlanence_class") > > abp= Particle() > m.add_particle(abp) > cp= Particle() > m.add_particle(cp) > # create a new hierarchy to define which proteins can be > equivalently connected > abh= HierarchyDecorator.create(abp, traits) > abh.add_child(HierarchyDecorator.create(a, traits)) > abh.add_child(HierarchyDecorator.create(b, traits)) > > # nothing else has the same type as c > ch= HierarchyDecorator.create(cp, traits) > ch.add_child(HierarchyDecorator.create(c, traits)) > > > # create a refiner to get all residues irrespective of how far down > they are in the hierarchy > refres= > DescendentsOfTypeParticleRefiner > (MolecularHierarchyDecorator.get_type_key(), > > MolecularHierarchyDecorator.RESIDUE) > rtres = RefineOncePairScore(SphereDistancePairScore(), refres) > > # a refiner to produce the proteins in each equivalence class > cpr= ChildrenParticleRefiner(traits) > erops= RefineOncePairScore(rtres, cpr) > > # make a list of the particles defining the equivalence classes > classes= IMP.Particles() > classes.append(abp) > classes.append(cp) > r= ConnectivtyRestraint(erops, classes) > > The changes necessary to do the above are quite easy. > > > > On Dec 19, 2008, at 6:36 AM, Friedrich Foerster wrote: > > hi daniel, > > the Model hierarchy is not particularly awkward by itself. for me > the problem is more that dealing with a single hierarchy on the > representation level is hard. > i just constantly run into the problem that i want to press all my > restraints and representation into a single hierarchy - and i always > need to change it. so my hierarchy is basically just protein -> > fragment. whether a fragment is an atom, few residues, a domain, or > an entire protein varies from case to case. of course, i could add > another layer - but it'd be quite a bit of work to change it > everywhere and probably i'd need to change it again very soon. > for me a convenient framework for restraints would probably look > like that: > rest1 = upper_distance(particles_from_protein_A, > articles_from_protein_B) > rest2 = upper_distance(particles_from_protein_A, > articles_from_protein_C) > final_restraint = lower_scoring_one_of(rest1, rest2) > model.add_restraint(final_restraint) > > (protein_B and protein_C are both of the same protein type, e.g., > lysozyme ). for tricky cases one could use several instances of > lower_scoring_one_of. > just a proposal.... > > cheers > > frido > > On Dec 19, 2008, at 2:02 PM, Daniel Russel wrote: > > By the way, what exactly do you five cumbersome with the hierarchy > as it stands? Why do you find you are changing it a lot? Just > looking for ways to make things simpler. > > -- > > Friedrich Foerster > Max-Planck Institut fuer Biochemie > Am Klopferspitz 18 > D-82152 Martinsried > > Tel: +49 89 8578 2651 > Fax: +49 89 8578 2641 > > foerster@biochem.mpg.de > > www.tomotronic.org > > > > > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev