maximum diameter restraints
hi impians,
for the 26s project i would like to use a maximum diameter restraint on the shape of proteins. so it'd be a restraint similar to the connectivity restraint: all distances in a protein are evaluated and if the largest distance is above a specified threshold, a harmonic restraint would be applied on the respective pair. did anybody already put something like that into imp? and if no, is anybody familiar with the core also interested in that and willing to code it? it'd take me ages and the code would be ugly ;)
thanks
frido
--
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
I can have some code for you shortly. I am having some issues with swig at the moment.
On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote:
> hi impians, > > for the 26s project i would like to use a maximum diameter restraint > on the shape of proteins. so it'd be a restraint similar to the > connectivity restraint: all distances in a protein are evaluated and > if the largest distance is above a specified threshold, a harmonic > restraint would be applied on the respective pair. > did anybody already put something like that into imp? and if no, is > anybody familiar with the core also interested in that and willing to > code it? it'd take me ages and the code would be ugly ;) > > thanks > > frido > > -- > > 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
I have some code for you, but the repository appears to be broken.
Here is the example: import IMP import IMP.core
# This example addes a restraint on bipartite nonbonded interactions # after excluding a set of bonded interactions.
m= IMP.Model() # The set of particles lc= IMP.core.ListSingletonContainer(IMP.core.create_xyzr_particles(m, 20, 1.0)) ps = IMP.core.AllPairsPairContainer(lc)
# Set up the nonbonded list h=IMP.core.HarmonicUpperBound(10,1) d=IMP.core.DistancePairScore(h) r= IMP.core.PairsRestraint(d, ps) m.add_restraint(r)
# Set up optimizer o= IMP.core.ConjugateGradients() o.set_model(m)
o.optimize(100)
for i in range(0, ps.get_number_of_particle_pairs()): p= ps.get_particle_pair(i) print IMP.core.distance(IMP.core.XYZDecorator(p[0]), IMP.core.XYZDecorator(p[1]))
On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote:
> hi impians, > > for the 26s project i would like to use a maximum diameter restraint > on the shape of proteins. so it'd be a restraint similar to the > connectivity restraint: all distances in a protein are evaluated and > if the largest distance is above a specified threshold, a harmonic > restraint would be applied on the respective pair. > did anybody already put something like that into imp? and if no, is > anybody familiar with the core also interested in that and willing to > code it? it'd take me ages and the code would be ugly ;) > > thanks > > frido > > -- > > 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
hey Dainel - is the code checked in already? thanks, Keren.
On Mon, 1 Dec 2008, Daniel Russel wrote:
> I have some code for you, but the repository appears to be broken. > Here is the example: > import IMP > import IMP.core > > # This example addes a restraint on bipartite nonbonded interactions > # after excluding a set of bonded interactions. > > m= IMP.Model() > # The set of particles > lc= IMP.core.ListSingletonContainer(IMP.core.create_xyzr_particles(m, 20, 1.0)) > ps = IMP.core.AllPairsPairContainer(lc) > > # Set up the nonbonded list > h=IMP.core.HarmonicUpperBound(10,1) > d=IMP.core.DistancePairScore(h) > r= IMP.core.PairsRestraint(d, ps) > m.add_restraint(r) > > # Set up optimizer > o= IMP.core.ConjugateGradients() > o.set_model(m) > > o.optimize(100) > > for i in range(0, ps.get_number_of_particle_pairs()): > p= ps.get_particle_pair(i) > print IMP.core.distance(IMP.core.XYZDecorator(p[0]), > IMP.core.XYZDecorator(p[1])) > > On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote: > > hi impians, > > for the 26s project i would like to use a maximum diameter restraint > on the shape of proteins. so it'd be a restraint similar to the > connectivity restraint: all distances in a protein are evaluated and > if the largest distance is above a specified threshold, a harmonic > restraint would be applied on the respective pair. > did anybody already put something like that into imp? and if no, is > anybody familiar with the core also interested in that and willing to > code it? it'd take me ages and the code would be ugly ;) > > thanks > > frido > > -- > > 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 > > > >
No, something looks to be wrong with the repository and anything I try to commit is rejected without an error message.
On Dec 1, 2008, at 8:47 AM, Keren Lasker kerenl@salilab.org wrote:
> hey Dainel - > is the code checked in already? > thanks, > Keren. > > On Mon, 1 Dec 2008, Daniel Russel wrote: > >> I have some code for you, but the repository appears to be broken. >> Here is the example: >> import IMP >> import IMP.core >> # This example addes a restraint on bipartite nonbonded interactions >> # after excluding a set of bonded interactions. >> m= IMP.Model() >> # The set of particles >> lc= >> IMP.core.ListSingletonContainer(IMP.core.create_xyzr_particles(m, >> 20, 1.0)) >> ps = IMP.core.AllPairsPairContainer(lc) >> # Set up the nonbonded list >> h=IMP.core.HarmonicUpperBound(10,1) >> d=IMP.core.DistancePairScore(h) >> r= IMP.core.PairsRestraint(d, ps) >> m.add_restraint(r) >> # Set up optimizer >> o= IMP.core.ConjugateGradients() >> o.set_model(m) >> o.optimize(100) >> for i in range(0, ps.get_number_of_particle_pairs()): >> p= ps.get_particle_pair(i) >> print IMP.core.distance(IMP.core.XYZDecorator(p[0]), >> IMP.core.XYZDecorator(p[1])) >> On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote: >> >> hi impians, >> >> for the 26s project i would like to use a maximum diameter >> restraint >> on the shape of proteins. so it'd be a restraint similar to the >> connectivity restraint: all distances in a protein are >> evaluated and >> if the largest distance is above a specified threshold, a >> harmonic >> restraint would be applied on the respective pair. >> did anybody already put something like that into imp? and if >> no, is >> anybody familiar with the core also interested in that and >> willing to >> code it? it'd take me ages and the code would be ugly ;) >> >> thanks >> >> frido >> >> -- >> >> 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
Daniel Russel wrote: > No, something looks to be wrong with the repository and anything I try > to commit is rejected without an error message.
Indeed, there is a problem with our svn server this morning, which I will address.
Ben
thanks a lot. looks like what i need. can you add some comments at the crucial lines below?
frido
On Mon, Dec 1, 2008 at 4:39 PM, Daniel Russel drussel@gmail.com wrote:
> I have some code for you, but the repository appears to be broken. > Here is the example: > import IMP > import IMP.core > > # This example addes a restraint on bipartite nonbonded interactions > # after excluding a set of bonded interactions. > > m= IMP.Model() > # The set of particles > lc= IMP.core.ListSingletonContainer(IMP.core.create_xyzr_particles(m, 20, > 1.0)) > ps = IMP.core.AllPairsPairContainer(lc) > > # Set up the nonbonded list > h=IMP.core.HarmonicUpperBound(10,1) > d=IMP.core.DistancePairScore(h) > is that line the actual maximum distance restraint? i guess it is now a max diameter of 10?
> r= IMP.core.PairsRestraint(d, ps) > m.add_restraint(r) > > # Set up optimizer > o= IMP.core.ConjugateGradients() > o.set_model(m) > > o.optimize(100) > > for i in range(0, ps.get_number_of_particle_pairs()): > p= ps.get_particle_pair(i) > print IMP.core.distance(IMP.core.XYZDecorator(p[0]), > IMP.core.XYZDecorator(p[1])) > > On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote: > > hi impians, > > for the 26s project i would like to use a maximum diameter restraint > on the shape of proteins. so it'd be a restraint similar to the > connectivity restraint: all distances in a protein are evaluated and > if the largest distance is above a specified threshold, a harmonic > restraint would be applied on the respective pair. > did anybody already put something like that into imp? and if no, is > anybody familiar with the core also interested in that and willing to > code it? it'd take me ages and the code would be ugly ;) > > thanks > > frido > > -- > > 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 > >
It is committed now and there are some more comments in the example.
On Dec 1, 2008, at 10:59 AM, Friedrich Foerster wrote:
> thanks a lot. looks like what i need. > can you add some comments at the crucial lines below? > > frido > > On Mon, Dec 1, 2008 at 4:39 PM, Daniel Russel drussel@gmail.com > wrote: > I have some code for you, but the repository appears to be broken. > > Here is the example: > import IMP > import IMP.core > > # This example addes a restraint on bipartite nonbonded interactions > # after excluding a set of bonded interactions. > > m= IMP.Model() > # The set of particles > lc= > IMP.core.ListSingletonContainer(IMP.core.create_xyzr_particles(m, > 20, 1.0)) > ps = IMP.core.AllPairsPairContainer(lc) > > # Set up the nonbonded list > h=IMP.core.HarmonicUpperBound(10,1) > d=IMP.core.DistancePairScore(h) > is that line the actual maximum distance restraint? i guess it is > now a max diameter of 10? > r= IMP.core.PairsRestraint(d, ps) > m.add_restraint(r) > > # Set up optimizer > o= IMP.core.ConjugateGradients() > o.set_model(m) > > o.optimize(100) > > for i in range(0, ps.get_number_of_particle_pairs()): > p= ps.get_particle_pair(i) > print IMP.core.distance(IMP.core.XYZDecorator(p[0]), > IMP.core.XYZDecorator(p[1])) > > On Dec 1, 2008, at 12:11 AM, Friedrich Foerster wrote: > >> hi impians, >> >> for the 26s project i would like to use a maximum diameter restraint >> on the shape of proteins. so it'd be a restraint similar to the >> connectivity restraint: all distances in a protein are evaluated and >> if the largest distance is above a specified threshold, a harmonic >> restraint would be applied on the respective pair. >> did anybody already put something like that into imp? and if no, is >> anybody familiar with the core also interested in that and willing to >> code it? it'd take me ages and the code would be ugly ;) >> >> thanks >> >> frido >> >> -- >> >> 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
Friedrich Foerster wrote: > for the 26s project i would like to use a maximum diameter restraint > on the shape of proteins. so it'd be a restraint similar to the > connectivity restraint: all distances in a protein are evaluated and > if the largest distance is above a specified threshold, a harmonic > restraint would be applied on the respective pair.
The solution already proposed by Daniel looks perfect to me as a literal solution to your problem, but is that really what you want to do: constrain every particle pair in the protein to less than the diameter? If you have a lot of particles, that's going to become expensive rather quickly (O(N^2), obviously). Another option to consider would be to constrain every particle to be less than the radius from the protein center. That would give you far fewer restraints and scale as O(N). You could do this with a bunch of DistanceToSingletonScores if the protein center is at a fixed point, or use a GravityCenterScoreState to stick a particle at the center of gravity of your protein, and then use regular distance restraints between each particle and that center.
Ben
Ben - I might be missing something here but the centroid changes at each optimization step - so this means that the particle will converge slower in the O(N) suggestion than in the O(N^2) suggestion - since the centroid of the previous iteration will hold it back. On Dec 3, 2008, at 7:36 PM, Ben Webb wrote:
> Friedrich Foerster wrote: >> for the 26s project i would like to use a maximum diameter restraint >> on the shape of proteins. so it'd be a restraint similar to the >> connectivity restraint: all distances in a protein are evaluated and >> if the largest distance is above a specified threshold, a harmonic >> restraint would be applied on the respective pair. > > The solution already proposed by Daniel looks perfect to me as a > literal > solution to your problem, but is that really what you want to do: > constrain every particle pair in the protein to less than the > diameter? > If you have a lot of particles, that's going to become expensive > rather > quickly (O(N^2), obviously). Another option to consider would be to > constrain every particle to be less than the radius from the protein > center. That would give you far fewer restraints and scale as O(N). > You > could do this with a bunch of DistanceToSingletonScores if the protein > center is at a fixed point, or use a GravityCenterScoreState to > stick a > particle at the center of gravity of your protein, and then use > regular > distance restraints between each particle and that center. > > Ben > -- > ben@salilab.org http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Keren Lasker wrote: > Ben - I might be missing something here but the centroid changes at > each optimization step - so this means that the particle will converge > slower in the O(N) suggestion than in the O(N^2) suggestion - since > the centroid of the previous iteration will hold it back. > The score state is updated before the restraints are evaluated, so it will always have the position of the current centroid.
> On Dec 3, 2008, at 7:36 PM, Ben Webb wrote: > > >> Friedrich Foerster wrote: >> >>> for the 26s project i would like to use a maximum diameter restraint >>> on the shape of proteins. so it'd be a restraint similar to the >>> connectivity restraint: all distances in a protein are evaluated and >>> if the largest distance is above a specified threshold, a harmonic >>> restraint would be applied on the respective pair. >>> >> The solution already proposed by Daniel looks perfect to me as a >> literal >> solution to your problem, but is that really what you want to do: >> constrain every particle pair in the protein to less than the >> diameter? >> If you have a lot of particles, that's going to become expensive >> rather >> quickly (O(N^2), obviously). Another option to consider would be to >> constrain every particle to be less than the radius from the protein >> center. That would give you far fewer restraints and scale as O(N). >> You >> could do this with a bunch of DistanceToSingletonScores if the protein >> center is at a fixed point, or use a GravityCenterScoreState to >> stick a >> particle at the center of gravity of your protein, and then use >> regular >> distance restraints between each particle and that center. >> >> Ben >> -- >> ben@salilab.org http://salilab.org/~ben/ >> "It is a capital mistake to theorize before one has data." >> - Sir Arthur Conan Doyle >> _______________________________________________ >> 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 >
currently, we do not have too many particles. but of course it'd be nice to have a faster restraint in any case ;)
tx
frido
On Wed, Dec 3, 2008 at 8:01 PM, Daniel Russel drussel@gmail.com wrote:
> Keren Lasker wrote: > > Ben - I might be missing something here but the centroid changes at > > each optimization step - so this means that the particle will converge > > slower in the O(N) suggestion than in the O(N^2) suggestion - since > > the centroid of the previous iteration will hold it back. > > > The score state is updated before the restraints are evaluated, so it > will always have the position of the current centroid. > > > On Dec 3, 2008, at 7:36 PM, Ben Webb wrote: > > > > > >> Friedrich Foerster wrote: > >> > >>> for the 26s project i would like to use a maximum diameter restraint > >>> on the shape of proteins. so it'd be a restraint similar to the > >>> connectivity restraint: all distances in a protein are evaluated and > >>> if the largest distance is above a specified threshold, a harmonic > >>> restraint would be applied on the respective pair. > >>> > >> The solution already proposed by Daniel looks perfect to me as a > >> literal > >> solution to your problem, but is that really what you want to do: > >> constrain every particle pair in the protein to less than the > >> diameter? > >> If you have a lot of particles, that's going to become expensive > >> rather > >> quickly (O(N^2), obviously). Another option to consider would be to > >> constrain every particle to be less than the radius from the protein > >> center. That would give you far fewer restraints and scale as O(N). > >> You > >> could do this with a bunch of DistanceToSingletonScores if the protein > >> center is at a fixed point, or use a GravityCenterScoreState to > >> stick a > >> particle at the center of gravity of your protein, and then use > >> regular > >> distance restraints between each particle and that center. > >> > >> Ben > >> -- > >> ben@salilab.org http://salilab.org/~ben/http://salilab.org/%7Eben/ > >> "It is a capital mistake to theorize before one has data." > >> - Sir Arthur Conan Doyle > >> _______________________________________________ > >> 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 > >
For small numbers of particles, the quadratic approach should be faster. What small means is less clear :-)
On Dec 3, 2008, at 2:41 PM, "Friedrich Foerster" <foerster@biochem.mpg.de > wrote:
> currently, we do not have too many particles. but of course it'd be > nice to have a faster restraint in any case ;) > > tx > > frido > > On Wed, Dec 3, 2008 at 8:01 PM, Daniel Russel drussel@gmail.com > wrote: > Keren Lasker wrote: > > Ben - I might be missing something here but the centroid changes at > > each optimization step - so this means that the particle will > converge > > slower in the O(N) suggestion than in the O(N^2) suggestion - since > > the centroid of the previous iteration will hold it back. > > > The score state is updated before the restraints are evaluated, so it > will always have the position of the current centroid. > > > On Dec 3, 2008, at 7:36 PM, Ben Webb wrote: > > > > > >> Friedrich Foerster wrote: > >> > >>> for the 26s project i would like to use a maximum diameter > restraint > >>> on the shape of proteins. so it'd be a restraint similar to the > >>> connectivity restraint: all distances in a protein are evaluated > and > >>> if the largest distance is above a specified threshold, a harmonic > >>> restraint would be applied on the respective pair. > >>> > >> The solution already proposed by Daniel looks perfect to me as a > >> literal > >> solution to your problem, but is that really what you want to do: > >> constrain every particle pair in the protein to less than the > >> diameter? > >> If you have a lot of particles, that's going to become expensive > >> rather > >> quickly (O(N^2), obviously). Another option to consider would be to > >> constrain every particle to be less than the radius from the > protein > >> center. That would give you far fewer restraints and scale as O(N). > >> You > >> could do this with a bunch of DistanceToSingletonScores if the > protein > >> center is at a fixed point, or use a GravityCenterScoreState to > >> stick a > >> particle at the center of gravity of your protein, and then use > >> regular > >> distance restraints between each particle and that center. > >> > >> Ben > >> -- > >> ben@salilab.org http://salilab.org/~ben/ > >> "It is a capital mistake to theorize before one has data." > >> - Sir Arthur Conan Doyle > >> _______________________________________________ > >> 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 > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Ben Webb wrote: > Friedrich Foerster wrote: > >> for the 26s project i would like to use a maximum diameter restraint >> on the shape of proteins. so it'd be a restraint similar to the >> connectivity restraint: all distances in a protein are evaluated and >> if the largest distance is above a specified threshold, a harmonic >> restraint would be applied on the respective pair. >> > > The solution already proposed by Daniel looks perfect to me as a literal > solution to your problem, but is that really what you want to do: > constrain every particle pair in the protein to less than the diameter? > If you have a lot of particles, that's going to become expensive rather > quickly (O(N^2), obviously). Another option to consider would be to > constrain every particle to be less than the radius from the protein > center. That would give you far fewer restraints and scale as O(N). You > could do this with a bunch of DistanceToSingletonScores if the protein > center is at a fixed point, or use a GravityCenterScoreState to stick a > particle at the center of gravity of your protein, and then use regular > distance restraints between each particle and that center. > Good point. I hadn't suggested it since it is a looser bound than the diameter in general (not that the looseness is likely to matter :-). Also, since we already have code to compute an enclosing ball of a set of balls we can easily write a gravitycenter-analog which puts the point at the sphere center if you want something tighter than the gravity-center based bounds. Actually, I've been meaning to write such a class for a while.
participants (4)
-
Ben Webb
-
Daniel Russel
-
Friedrich Foerster
-
Keren Lasker