<div dir="ltr">so this is what is looks like with rmf_show:<div><br></div><div><a href="https://gist.github.com/mysticvision/271d973806603967fd31">https://gist.github.com/mysticvision/271d973806603967fd31</a></div><div><br>
</div><div>i'll email you the rmf now.</div><div><br></div><div>thanks !</div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 3 July 2014 14:28, <span dir="ltr"><<a href="mailto:imp-users-request@salilab.org" target="_blank">imp-users-request@salilab.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send IMP-users mailing list submissions to<br>
<a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of IMP-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Sampling and writing to pym/rmf (Josh Bullock) (Barak Raveh)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 3 Jul 2014 06:27:55 -0700<br>
From: Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
To: Help and discussion for users of IMP <<a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a>><br>
Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Josh<br>
Bullock)<br>
Message-ID:<br>
<<a href="mailto:CAHp%2B_UoKxFzCF8W21dQv5OhWFuSc78HZp8JdnBZH5eEjeNEEvQ@mail.gmail.com">CAHp+_UoKxFzCF8W21dQv5OhWFuSc78HZp8JdnBZH5eEjeNEEvQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
You can use rmf_show and rmf_show -v to view your file in human readable<br>
format<br>
<a href="http://integrativemodeling.org/rmf/nightly/doc/executables.html" target="_blank">http://integrativemodeling.org/rmf/nightly/doc/executables.html</a><br>
<br>
About chimera, are you using a latest nightly build? You can send me the<br>
RMF file and I'll give a look to see if it depends on the chimera version.<br>
<br>
Barak<br>
<br>
<br>
On Thu, Jul 3, 2014 at 5:55 AM, Josh Bullock <<a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>> wrote:<br>
<br>
> oh so there is something in the .rmf file, looks a bit garbled though ...<br>
> is this normal ?<br>
><br>
> <a href="https://gist.github.com/mysticvision/271d973806603967fd31" target="_blank">https://gist.github.com/mysticvision/271d973806603967fd31</a><br>
><br>
><br>
> On 3 July 2014 13:44, <<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a>> wrote:<br>
><br>
>> Send IMP-users mailing list submissions to<br>
>> <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>><br>
>> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> or, via email, send a message with subject or body 'help' to<br>
>> <a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
>><br>
>> You can reach the person managing the list at<br>
>> <a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
>><br>
>> When replying, please edit your Subject line so it is more specific<br>
>> than "Re: Contents of IMP-users digest..."<br>
>><br>
>><br>
>> Today's Topics:<br>
>><br>
>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Josh Bullock)<br>
>><br>
>><br>
>> ----------------------------------------------------------------------<br>
>><br>
>> Message: 1<br>
>> Date: Thu, 3 Jul 2014 13:44:22 +0100<br>
>> From: Josh Bullock <<a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>><br>
>> To: <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak Raveh)<br>
>> Message-ID:<br>
>> <CAHh_40_zsUCt4=<br>
>> <a href="mailto:nZbvDRd0owHzz_v_DHEiB-R%2BEm3ggDScS2zg@mail.gmail.com">nZbvDRd0owHzz_v_DHEiB-R+Em3ggDScS2zg@mail.gmail.com</a>><br>
>> Content-Type: text/plain; charset="utf-8"<br>
>><br>
>> aha okay, so now i'm generating .rmf files however when trying to open<br>
>> them<br>
>> in chimera I get the following error:<br>
>><br>
>> "Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY,<br>
>> plist)"<br>
>> in file "<br>
>><br>
>> I'm not sure whether this is because I've created empty .rmf files or<br>
>> something else is wrong ...<br>
>><br>
>> the code for making the rmf files:<br>
>><br>
>> for i in range(0, cs.get_number_of_configurations()):<br>
>> cs.load_configuration(i)<br>
>> h = IMP.atom.Hierarchy.get_children(all)<br>
>> tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")<br>
>> print "file is", tfn<br>
>> rh = RMF.create_rmf_file(tfn)<br>
>><br>
>> # add the hierarchy to the file<br>
>> IMP.rmf.add_hierarchies(rh, h)<br>
>><br>
>> # add the current configuration to the file as frame 0<br>
>> IMP.rmf.save_frame(rh)<br>
>><br>
>><br>
>> On 3 July 2014 00:20, <<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a>> wrote:<br>
>><br>
>> > Send IMP-users mailing list submissions to<br>
>> > <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>> ><br>
>> > To subscribe or unsubscribe via the World Wide Web, visit<br>
>> > <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > or, via email, send a message with subject or body 'help' to<br>
>> > <a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
>> ><br>
>> > You can reach the person managing the list at<br>
>> > <a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
>> ><br>
>> > When replying, please edit your Subject line so it is more specific<br>
>> > than "Re: Contents of IMP-users digest..."<br>
>> ><br>
>> ><br>
>> > Today's Topics:<br>
>> ><br>
>> > 1. Re: Sampling and writing to pym/rmf (Barak Raveh)<br>
>> ><br>
>> ><br>
>> > ----------------------------------------------------------------------<br>
>> ><br>
>> > Message: 1<br>
>> > Date: Wed, 2 Jul 2014 16:20:19 -0700<br>
>> > From: Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
>> > To: Help and discussion for users of IMP <<a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a>><br>
>> > Subject: Re: [IMP-users] Sampling and writing to pym/rmf<br>
>> > Message-ID:<br>
>> > <<br>
>> > <a href="mailto:CAHp%2B_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj%2BM8SZWUkCw@mail.gmail.com">CAHp+_Uoq-HAyca9AX_pFcEje32ke3J3KuKZWYfuj+M8SZWUkCw@mail.gmail.com</a>><br>
>> > Content-Type: text/plain; charset="utf-8"<br>
>> ><br>
>> > Hi Josh,<br>
>> ><br>
>> > An IMP model contains a list of particles that are tightly associated<br>
>> with<br>
>> > it (a particle does not exist outside the context of a model). Given the<br>
>> > disclaimer that I have never used ConfigurationSet, my understanding<br>
>> from<br>
>> > its documentation is that when you load a configuration, the values of<br>
>> the<br>
>> > particles within the model are updated accordingly. If I understand your<br>
>> > code correctly, 'all' is the root of the hierarchy in your model, so it<br>
>> is<br>
>> > 'all' that you should add to the rmf. The values of 'all' and all of its<br>
>> > children are supposed to update when you load a configuration,<br>
>> > automatically.<br>
>> ><br>
>> > All that being said said - use this advice at own risk, perhaps someone<br>
>> > could advise you better. Let me know if you have more questions.<br>
>> ><br>
>> > Barak<br>
>> ><br>
>> ><br>
>> > On Wed, Jul 2, 2014 at 3:42 PM, Josh Bullock <<a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>><br>
>> > wrote:<br>
>> ><br>
>> > ><br>
>> > ><br>
>> > > Conceptually I do ( i think ... ) but not practically. I'm hoping to<br>
>> view<br>
>> > > each of the models i created - with MSrestraints - separately as an<br>
>> .rmf<br>
>> > in<br>
>> > > chimera, just so i can see what i'm making !<br>
>> > ><br>
>> > > so i have created my models using:<br>
>> > ><br>
>> > > cs= get_conformations(m)<br>
>> > ><br>
>> > > do i have to assign each model to a particle before i can write it to<br>
>> an<br>
>> > > .rmf ? Or is each model already a particle with hierarchy ?<br>
>> > ><br>
>> > > -------------------------------------------<br>
>> > ><br>
>> > > for i in range(0, cs.get_number_of_configurations()):<br>
>> > > cs.load_configuration(i)<br>
>> > > h = IMP.atom.Hierarchy(m) # <------- how do i call the<br>
>> hierarchy<br>
>> > of<br>
>> > > the current loaded configuration ?<br>
>> > > c = p.get_children(h)<br>
>> > > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")<br>
>> > > rh = RMF.create_rmf_file(tfn)<br>
>> > ><br>
>> > > # add the hierarchy to the file<br>
>> > > IMP.rmf.add_hierarchies(rh, h)<br>
>> > ><br>
>> > > # add the current configuration to the file as frame 0<br>
>> > > IMP.rmf.save_frame(rh)<br>
>> > ><br>
>> > > On 2 July 2014 23:03, <<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a>> wrote:<br>
>> > ><br>
>> > >> Send IMP-users mailing list submissions to<br>
>> > >> <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>> > >><br>
>> > >> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> > >> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> or, via email, send a message with subject or body 'help' to<br>
>> > >> <a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
>> > >><br>
>> > >> You can reach the person managing the list at<br>
>> > >> <a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
>> > >><br>
>> > >> When replying, please edit your Subject line so it is more specific<br>
>> > >> than "Re: Contents of IMP-users digest..."<br>
>> > >><br>
>> > >><br>
>> > >> Today's Topics:<br>
>> > >><br>
>> > >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)<br>
>> > >><br>
>> > >><br>
>> > >><br>
>> ----------------------------------------------------------------------<br>
>> > >><br>
>> > >> Message: 1<br>
>> > >> Date: Wed, 2 Jul 2014 15:03:19 -0700<br>
>> > >><br>
>> > >> From: Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
>> > >> To: Help and discussion for users of IMP <<a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a>><br>
>> > >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf<br>
>> > >> Message-ID:<br>
>> > >> <CAHp+_UqO8rXRMsUSndbg-c0jyDxnswDe9aFKvW889gGMU=<br>
>> > >> <a href="mailto:4MMQ@mail.gmail.com">4MMQ@mail.gmail.com</a>><br>
>> > >> Content-Type: text/plain; charset="utf-8"<br>
>> > >><br>
>> > >><br>
>> > >> * I meant<br>
>> > >><br>
>> > >> h = IMP.atom.Hierarchy(p)<br>
>> > >> c = p.get_children(h)<br>
>> > >><br>
>> > >> this assumes that particle p was already decorated as Hierarchy (let<br>
>> me<br>
>> > >> know if you are not familiar with decorators, Hierarchy, or<br>
>> Particle).<br>
>> > >><br>
>> > >><br>
>> > >><br>
>> > >> On Wed, Jul 2, 2014 at 3:02 PM, Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
>> > >> wrote:<br>
>> > >><br>
>> > >> > Hi Josh,<br>
>> > >> ><br>
>> > >> > I think get_children() is only a member function of Hierarchy, so<br>
>> you<br>
>> > >> > should do something like<br>
>> > >> ><br>
>> > >> > IMP.atom.Hierarchy(p)<br>
>> > >> > c = p.get_children()<br>
>> > >> ><br>
>> > >> > 'cs' seems to be a ConfigurationSet object - are you sure that you<br>
>> > >> expect<br>
>> > >> > it to have children?<br>
>> > >> ><br>
>> > >> > What do you want to do?<br>
>> > >> ><br>
>> > >> > Cheers,<br>
>> > >> > Barak<br>
>> > >> ><br>
>> > >> > On Wed, Jul 2, 2014 at 1:42 PM, Josh Bullock <<br>
>> <a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>><br>
>> > >> > wrote:<br>
>> > >> ><br>
>> > >> >> ah sorry ! this line gives me the error<br>
>> > >> >><br>
>> > >> >> h= IMP.atom.Hierarchy.get_children(cs)<br>
>> > >> >><br>
>> > >> >> thanks<br>
>> > >> >><br>
>> > >> >> josh<br>
>> > >> >><br>
>> > >> >> On 2 July 2014 17:45, <<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a>> wrote:<br>
>> > >> >><br>
>> > >> >>> Send IMP-users mailing list submissions to<br>
>> > >> >>> <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>> > >> >>><br>
>> > >> >>> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> > >> >>> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>> or, via email, send a message with subject or body 'help' to<br>
>> > >> >>> <a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
>> > >> >>><br>
>> > >> >>> You can reach the person managing the list at<br>
>> > >> >>> <a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
>> > >> >>><br>
>> > >> >>> When replying, please edit your Subject line so it is more<br>
>> specific<br>
>> > >> >>> than "Re: Contents of IMP-users digest..."<br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>> Today's Topics:<br>
>> > >> >>><br>
>> > >> >>> 1. Re: Sampling and writing to pym/rmf (Barak Raveh) (Barak<br>
>> > Raveh)<br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>><br>
>> > ----------------------------------------------------------------------<br>
>> > >> >>><br>
>> > >> >>> Message: 1<br>
>> > >> >>> Date: Wed, 2 Jul 2014 09:45:30 -0700<br>
>> > >> >>> From: Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
>> > >> >>> To: Help and discussion for users of IMP <<a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a>><br>
>> > >> >>> Subject: Re: [IMP-users] Sampling and writing to pym/rmf (Barak<br>
>> > Raveh)<br>
>> > >> >>> Message-ID:<br>
>> > >> >>> <CAHp+_Uo19VasJDJYi+2CoUUu=<br>
>> > >> >>> <a href="mailto:u_6duKCraVetU4dW45%2BoDhTAw@mail.gmail.com">u_6duKCraVetU4dW45+oDhTAw@mail.gmail.com</a>><br>
>> > >> >>> Content-Type: text/plain; charset="utf-8"<br>
>> > >> >>><br>
>> > >> >>> Which lines throws the error?<br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>> On Wed, Jul 2, 2014 at 4:56 AM, Josh Bullock <<br>
>> <a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a><br>
>> > ><br>
>> > >> >>> wrote:<br>
>> > >> >>><br>
>> > >> >>> > Hi Barek,<br>
>> > >> >>> ><br>
>> > >> >>> > So I'm not giving hierarchy.get_children the correct input:<br>
>> > >> >>> ><br>
>> > >> >>> > TypeError: unbound method get_children() must be called with<br>
>> > >> Hierarchy<br>
>> > >> >>> > instance as first argument (got ConfigurationSet instance<br>
>> instead)<br>
>> > >> >>> ><br>
>> > >> >>> > I'm not sure which argument is the hierarchy instance.<br>
>> > >> >>> ><br>
>> > >> >>> > Thanks,<br>
>> > >> >>> ><br>
>> > >> >>> > Josh<br>
>> > >> >>> ><br>
>> > >> >>> > -------------------------------------------------<br>
>> > >> >>> ><br>
>> > >> >>> > cs= get_conformations(m)<br>
>> > >> >>><br>
>> > >> >>> ><br>
>> > >> >>> > for i in range(0, cs.get_number_of_configurations()):<br>
>> > >> >>> > JOSH = cs.load_configuration(i)<br>
>> > >> >>> > S= IMP.atom.Selection<br>
>> > >> >>> > h= IMP.atom.Hierarchy.get_children(cs)<br>
>> > >> >>> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")<br>
>> > >> >>> > rh = RMF.create_rmf_file(tfn)<br>
>> > >> >>> ><br>
>> > >> >>> > On 1 July 2014 17:31, <<a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a>> wrote:<br>
>> > >> >>> ><br>
>> > >> >>> >> Send IMP-users mailing list submissions to<br>
>> > >> >>> >> <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a><br>
>> > >> >>> >><br>
>> > >> >>> >> To subscribe or unsubscribe via the World Wide Web, visit<br>
>> > >> >>> >> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>> >> or, via email, send a message with subject or body 'help' to<br>
>> > >> >>> >> <a href="mailto:imp-users-request@salilab.org">imp-users-request@salilab.org</a><br>
>> > >> >>> >><br>
>> > >> >>> >> You can reach the person managing the list at<br>
>> > >> >>> >> <a href="mailto:imp-users-owner@salilab.org">imp-users-owner@salilab.org</a><br>
>> > >> >>> >><br>
>> > >> >>> >> When replying, please edit your Subject line so it is more<br>
>> > specific<br>
>> > >> >>> >> than "Re: Contents of IMP-users digest..."<br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >> >>> >> Today's Topics:<br>
>> > >> >>> >><br>
>> > >> >>> >> 1. Re: Sampling and writing to pym/rmf (Barak Raveh)<br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >><br>
>> ----------------------------------------------------------------------<br>
>> > >> >>> >><br>
>> > >> >>> >> Message: 1<br>
>> > >> >>> >> Date: Tue, 1 Jul 2014 09:31:33 -0700<br>
>> > >> >>> >> From: Barak Raveh <<a href="mailto:barak.raveh@gmail.com">barak.raveh@gmail.com</a>><br>
>> > >> >>> >> To: Help and discussion for users of IMP <<br>
>> <a href="mailto:imp-users@salilab.org">imp-users@salilab.org</a>><br>
>> > >> >>> >> Subject: Re: [IMP-users] Sampling and writing to pym/rmf<br>
>> > >> >>> >> Message-ID:<br>
>> > >> >>> >> <CAHp+_UowiBwJozbwOfi8yFEVt7Z8o2tEZ=<br>
>> > >> >>> >> <a href="mailto:LvYPnJh-LjpC2cSA@mail.gmail.com">LvYPnJh-LjpC2cSA@mail.gmail.com</a>><br>
>> > >> >>> >> Content-Type: text/plain; charset="utf-8"<br>
>> > >> >>><br>
>> > >> >>> >><br>
>> > >> >>> >> Hi Josh, from a very superficial look, your code to write the<br>
>> RMF<br>
>> > >> >>> files<br>
>> > >> >>> >> seems fine - do you get an output RMF file? Could you load it<br>
>> in<br>
>> > >> >>> Chimera?<br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >> >>> >> On Tue, Jul 1, 2014 at 2:40 AM, Josh Bullock <<br>
>> > >> <a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>><br>
>> > >> >>> >> wrote:<br>
>> > >> >>> >><br>
>> > >> >>> >> > Hello,<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > I'm relatively new to all this so please let me know if i'm<br>
>> > >> making<br>
>> > >> >>> any<br>
>> > >> >>> >> > obvious errors ...<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > Essentially all i'm trying to do is generate an ensemble of<br>
>> > >> models<br>
>> > >> >>> made<br>
>> > >> >>> >> > from four subunits - constrained by MS connectivity<br>
>> restraints.<br>
>> > >> The<br>
>> > >> >>> >> models<br>
>> > >> >>> >> > get scored but nothing seems to write to the pymol file.<br>
>> > Ideally<br>
>> > >> i'd<br>
>> > >> >>> >> like<br>
>> > >> >>> >> > to write to an .rmf but i haven't worked that one out either<br>
>> > ...<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > Is this a reasonable way to go about my problem ?<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > Many thanks,<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > Josh<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > -------------------------------------------<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > import IMP<br>
>> > >> >>> >> > import IMP.atom<br>
>> > >> >>> >> > import IMP.rmf<br>
>> > >> >>> >> > import inspect<br>
>> > >> >>> >> > import IMP.container<br>
>> > >> >>> >> > import IMP.display<br>
>> > >> >>> >> > import IMP.statistics<br>
>> > >> >>> >> > #import IMP.example<br>
>> > >> >>> >> > import sys, math, os, optparse<br>
>> > >> >>> >> > import RMF<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > from optparse import OptionParser<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # Convert the arguments into strings and number<br>
>> > >> >>> >> > Firstpdb = str(sys.argv[1])<br>
>> > >> >>> >> > Secondpdb = str(sys.argv[2])<br>
>> > >> >>> >> > Thirdpdb = str(sys.argv[3])<br>
>> > >> >>> >> > Fourthpdb = str(sys.argv[4])<br>
>> > >> >>> >> > models = float(sys.argv[5])<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > #*****************************************<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # the spring constant to use, it doesnt really matter<br>
>> > >> >>> >> > k=100<br>
>> > >> >>> >> > # the target resolution for the representation, this is<br>
>> used to<br>
>> > >> >>> specify<br>
>> > >> >>> >> > how detailed<br>
>> > >> >>> >> > # the representation used should be<br>
>> > >> >>> >> > resolution=300<br>
>> > >> >>> >> > # the box to perform everything<br>
>> > >> >>> >> > bb=IMP.algebra.BoundingBox3D(IMP.algebra.Vector3D(0,0,0),<br>
>> > >> >>> >> > IMP.algebra.Vector3D(300, 300,<br>
>> > 300))<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # this function creates the molecular hierarchies for the<br>
>> > various<br>
>> > >> >>> >> involved<br>
>> > >> >>> >> > proteins<br>
>> > >> >>> >> > def create_representation():<br>
>> > >> >>> >> > m= IMP.Model()<br>
>> > >> >>> >> > all=IMP.atom.Hierarchy.setup_particle(IMP.Particle(m))<br>
>> > >> >>> >> > all.set_name("the universe")<br>
>> > >> >>> >> > # create a protein, represented as a set of connected<br>
>> balls<br>
>> > >> of<br>
>> > >> >>> >> > appropriate<br>
>> > >> >>> >> > # radii and number, chose by the resolution parameter<br>
>> and<br>
>> > the<br>
>> > >> >>> >> number of<br>
>> > >> >>> >> > # amino acids.<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > def create_protein_from_pdbs(name, files):<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > def create_from_pdb(file):<br>
>> > >> >>> >> > sls=IMP.SetLogState(IMP.NONE)<br>
>> > >> >>> >> > datadir = os.getcwd()<br>
>> > >> >>> >> > print datadir<br>
>> > >> >>> >> > t=IMP.atom.read_pdb( datadir+'/' + file, m,<br>
>> > >> >>> >> > IMP.atom.ATOMPDBSelector())<br>
>> > >> >>> >> > del sls<br>
>> > >> >>> >> > #IMP.atom.show_molecular_hierarchy(t)<br>
>> > >> >>> >> > c=IMP.atom.Chain(IMP.atom.get_by_type(t,<br>
>> > >> >>> >> > IMP.atom.CHAIN_TYPE)[0])<br>
>> > >> >>> >> > if c.get_number_of_children()==0:<br>
>> > >> >>> >> > IMP.atom.show_molecular_hierarchy(t)<br>
>> > >> >>> >> > # there is no reason to use all atoms, just<br>
>> > >> approximate<br>
>> > >> >>> the<br>
>> > >> >>> >> > pdb shape instead<br>
>> > >> >>> >> > s=IMP.atom.create_simplified_along_backbone(c,<br>
>> > >> >>> >> ><br>
>> > >> >>> >> resolution/300.0)<br>
>> > >> >>> >> > IMP.atom.destroy(t)<br>
>> > >> >>> >> > # make the simplified structure rigid<br>
>> > >> >>> >> > rb=IMP.atom.create_rigid_body(s)<br>
>> > >> >>> >> > # rb=IMP.atom.create_rigid_body(c)<br>
>> > >> >>> >> > rb.set_coordinates_are_optimized(True)<br>
>> > >> >>> >> > return s<br>
>> > >> >>> >> > # return c<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > h= create_from_pdb(files[0])<br>
>> > >> >>> >> > h.set_name(name)<br>
>> > >> >>> >> > all.add_child(h)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > create_protein_from_pdbs("A", [Firstpdb])<br>
>> > >> >>> >> > create_protein_from_pdbs("B", [Secondpdb])<br>
>> > >> >>> >> > create_protein_from_pdbs("C", [Thirdpdb])<br>
>> > >> >>> >> > create_protein_from_pdbs("D", [Fourthpdb])<br>
>> > >> >>> >> > #create_protein_from_pdbs("C", ["rpt3_imp.pdb"])<br>
>> > >> >>> >> > return (m, all)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # create the needed restraints and add them to the model<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > def create_restraints(m, all):<br>
>> > >> >>> >> > def add_connectivity_restraint(s):<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > tr= IMP.core.TableRefiner()<br>
>> > >> >>> >> > rps=[]<br>
>> > >> >>> >> > for sc in s:<br>
>> > >> >>> >> > ps= sc.get_selected_particles()<br>
>> > >> >>> >> > rps.append(ps[0])<br>
>> > >> >>> >> > tr.add_particle(ps[0], ps)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # duplicate the<br>
>> IMP.atom.create_connectivity_restraint<br>
>> > >> >>> >> > functionality<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > score=<br>
>> > >> >>> >> ><br>
>> > >> >>> >><br>
>> > >> >>><br>
>> > >><br>
>> ><br>
>> IMP.core.KClosePairsPairScore(IMP.core.HarmonicSphereDistancePairScore(0,1),tr)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > r= IMP.core.MSConnectivityRestraint(m,score)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > iA = r.add_type([rps[0]])<br>
>> > >> >>> >> > iB = r.add_type([rps[1]])<br>
>> > >> >>> >> > iC = r.add_type([rps[2]])<br>
>> > >> >>> >> > iD = r.add_type([rps[3]])<br>
>> > >> >>> >> > n1 = r.add_composite([iA, iB, iC, iD])<br>
>> > >> >>> >> > n2 = r.add_composite([iA, iB], n1)<br>
>> > >> >>> >> > n3 = r.add_composite([iC, iD], n1)<br>
>> > >> >>> >> > n4 = r.add_composite([iB, iC, iD], n1)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > m.add_restraint(r)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > evr=IMP.atom.create_excluded_volume_restraint([all])<br>
>> > >> >>> >> > m.add_restraint(evr)<br>
>> > >> >>> >> > # a Selection allows for natural specification of what<br>
>> the<br>
>> > >> >>> >> restraints<br>
>> > >> >>> >> > act on<br>
>> > >> >>> >> > S= IMP.atom.Selection<br>
>> > >> >>> >> > sA=S(hierarchy=all, molecule="A")<br>
>> > >> >>> >> > sB=S(hierarchy=all, molecule="B")<br>
>> > >> >>> >> > sC=S(hierarchy=all, molecule="C")<br>
>> > >> >>> >> > sD=S(hierarchy=all, molecule="D")<br>
>> > >> >>> >> > add_connectivity_restraint([sA, sB, sC, sD])<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # find acceptable conformations of the model<br>
>> > >> >>> >> > def get_conformations(m):<br>
>> > >> >>> >> > sampler= IMP.core.MCCGSampler(m)<br>
>> > >> >>> >> > sampler.set_bounding_box(bb)<br>
>> > >> >>> >> > # magic numbers, experiment with them and make them<br>
>> large<br>
>> > >> >>> enough for<br>
>> > >> >>> >> > things to work<br>
>> > >> >>> >> > sampler.set_number_of_conjugate_gradient_steps(100)<br>
>> > >> >>> >> > sampler.set_number_of_monte_carlo_steps(20)<br>
>> > >> >>> >> > sampler.set_number_of_attempts(models)<br>
>> > >> >>> >> > # We don't care to see the output from the sampler<br>
>> > >> >>> >> > sampler.set_log_level(IMP.SILENT)<br>
>> > >> >>> >> > # return the IMP.ConfigurationSet storing all the found<br>
>> > >> >>> >> configurations<br>
>> > >> >>> >> > that<br>
>> > >> >>> >> > # meet the various restraint maximum scores.<br>
>> > >> >>> >> > cs= sampler.create_sample()<br>
>> > >> >>> >> > return cs<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # cluster the conformations and write them to a file<br>
>> > >> >>> >> > def analyze_conformations(cs, all, gs):<br>
>> > >> >>> >> > # we want to cluster the configurations to make them<br>
>> easier<br>
>> > >> to<br>
>> > >> >>> >> > understand<br>
>> > >> >>> >> > # in the case, the clustering is pretty meaningless<br>
>> > >> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > IMP.container.ListSingletonContainer(IMP.atom.get_leaves(all)),<br>
>> > >> >>> True)<br>
>> > >> >>> >> > cluster= IMP.statistics.create_lloyds_kmeans(embed, 10,<br>
>> > >> 10000)<br>
>> > >> >>> >> > # dump each cluster center to a file so it can be<br>
>> viewed.<br>
>> > >> >>> >> > for i in range(cluster.get_number_of_clusters()):<br>
>> > >> >>> >> > center= cluster.get_cluster_center(i)<br>
>> > >> >>> >> > cs.load_configuration(i)<br>
>> > >> >>> >> > w= IMP.display.PymolWriter("cluster.%d.pym"%i)<br>
>> > >> >>> >> > for g in gs:<br>
>> > >> >>> >> > w.add_geometry(g)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >><br>
>> > >> >>><br>
>> > >><br>
>> ><br>
>> #******************************************************************************************<br>
>> > >> >>> >> > # now do the actual work<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > (m,all)= create_representation()<br>
>> > >> >>> >> > IMP.atom.show_molecular_hierarchy(all)<br>
>> > >> >>> >> > create_restraints(m, all)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # in order to display the results, we need something that<br>
>> maps<br>
>> > >> the<br>
>> > >> >>> >> > particles onto<br>
>> > >> >>> >> > # geometric objets. The IMP.display.Geometry objects do this<br>
>> > >> >>> mapping.<br>
>> > >> >>> >> > # IMP.display.XYZRGeometry map an IMP.core.XYZR particle<br>
>> onto a<br>
>> > >> >>> sphere<br>
>> > >> >>> >> > gs=[]<br>
>> > >> >>> >> > for i in range(all.get_number_of_children()):<br>
>> > >> >>> >> > color= IMP.display.get_display_color(i)<br>
>> > >> >>> >> > n= all.get_child(i)<br>
>> > >> >>> >> > name= n.get_name()<br>
>> > >> >>> >> > g= IMP.atom.HierarchyGeometry(n)<br>
>> > >> >>> >> > g.set_color(color)<br>
>> > >> >>> >> > gs.append(g)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > cs= get_conformations(m)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > print "found", cs.get_number_of_configurations(),<br>
>> "solutions"<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > ListScores = []<br>
>> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):<br>
>> > >> >>> >> > cs.load_configuration(i)<br>
>> > >> >>> >> > # print the configuration<br>
>> > >> >>> >> > print "solution number: ",i,"scored :",<br>
>> > m.evaluate(False)<br>
>> > >> >>> >> > ListScores.append(m.evaluate(False))<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > f1 = open("out_scores.csv", "w")<br>
>> > >> >>> >> > f1.write("\n".join(map(lambda x: str(x), ListScores)))<br>
>> > >> >>> >> > f1.close()<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # for each of the configuration, dump it to a file to view<br>
>> in<br>
>> > >> pymol<br>
>> > >> >>> >> > for i in range(0, cs.get_number_of_configurations()):<br>
>> > >> >>> >> > JOSH = cs.load_configuration(i)<br>
>> > >> >>> >> > S= IMP.atom.Selection<br>
>> > >> >>> >> > h= IMP.atom.Hierarchy.get_children(cs)<br>
>> > >> >>> >> > tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")<br>
>> > >> >>> >> > rh = RMF.create_rmf_file(tfn)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # add the hierarchy to the file<br>
>> > >> >>> >> > IMP.rmf.add_hierarchies(rh, h)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > # add the current configuration to the file as frame 0<br>
>> > >> >>> >> > IMP.rmf.save_frame(rh)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > for g in gs:<br>
>> > >> >>> >> > w.add_geometry(g)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> > analyze_conformations(cs, all, gs)<br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >> > _______________________________________________<br>
>> > >> >>> >> > IMP-users mailing list<br>
>> > >> >>> >> > <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> >>> >> > <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>> >> ><br>
>> > >> >>> >> ><br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >> >>> >> --<br>
>> > >> >>> >> Barak<br>
>> > >> >>> >> -------------- next part --------------<br>
>> > >> >>> >> An HTML attachment was scrubbed...<br>
>> > >> >>> >> URL: <<br>
>> > >> >>> >><br>
>> > >> >>><br>
>> > >><br>
>> ><br>
>> <a href="http://salilab.org/archives/imp-users/attachments/20140701/7b0e5f9f/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140701/7b0e5f9f/attachment.html</a><br>
>> > >> >>> >> ><br>
>> > >> >>> >><br>
>> > >> >>> >> ------------------------------<br>
>> > >> >>><br>
>> > >> >>> >><br>
>> > >> >>> >> _______________________________________________<br>
>> > >> >>> >> IMP-users mailing list<br>
>> > >> >>> >> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> >>> >> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>> >><br>
>> > >> >>> >><br>
>> > >> >>> >> End of IMP-users Digest, Vol 38, Issue 2<br>
>> > >> >>> >> ****************************************<br>
>> > >> >>><br>
>> > >> >>> >><br>
>> > >> >>> ><br>
>> > >> >>> ><br>
>> > >> >>> > _______________________________________________<br>
>> > >> >>> > IMP-users mailing list<br>
>> > >> >>> > <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> >>> > <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>> ><br>
>> > >> >>> ><br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>> --<br>
>> > >> >>> Barak<br>
>> > >> >>> -------------- next part --------------<br>
>> > >> >>> An HTML attachment was scrubbed...<br>
>> > >> >>> URL: <<br>
>> > >> >>><br>
>> > >><br>
>> ><br>
>> <a href="http://salilab.org/archives/imp-users/attachments/20140702/081e70ca/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140702/081e70ca/attachment.html</a><br>
>> > >> >>> ><br>
>> > >> >>><br>
>> > >> >>> ------------------------------<br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>> _______________________________________________<br>
>> > >> >>> IMP-users mailing list<br>
>> > >> >>> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> >>> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >>><br>
>> > >> >>><br>
>> > >> >>> End of IMP-users Digest, Vol 38, Issue 4<br>
>> > >> >>> ****************************************<br>
>> > >> >>><br>
>> > >> >><br>
>> > >> >><br>
>> > >> >> _______________________________________________<br>
>> > >> >> IMP-users mailing list<br>
>> > >> >> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> >> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >> >><br>
>> > >> >><br>
>> > >> ><br>
>> > >> ><br>
>> > >> > --<br>
>> > >> > Barak<br>
>> > >> ><br>
>> > >><br>
>> > >><br>
>> > >><br>
>> > >> --<br>
>> > >> Barak<br>
>> > >> -------------- next part --------------<br>
>> > >> An HTML attachment was scrubbed...<br>
>> > >> URL: <<br>
>> > >><br>
>> ><br>
>> <a href="http://salilab.org/archives/imp-users/attachments/20140702/74f552a1/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140702/74f552a1/attachment.html</a><br>
>> > >> ><br>
>> > >><br>
>> > >><br>
>> > >> ------------------------------<br>
>> > >><br>
>> > >> _______________________________________________<br>
>> > >> IMP-users mailing list<br>
>> > >> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > >> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > >><br>
>> > >><br>
>> > >> End of IMP-users Digest, Vol 38, Issue 7<br>
>> > >> ****************************************<br>
>> > >><br>
>> > ><br>
>> > ><br>
>> > > _______________________________________________<br>
>> > > IMP-users mailing list<br>
>> > > <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > > <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> > ><br>
>> > ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Barak<br>
>> > -------------- next part --------------<br>
>> > An HTML attachment was scrubbed...<br>
>> > URL: <<br>
>> ><br>
>> <a href="http://salilab.org/archives/imp-users/attachments/20140702/2f1fb30c/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140702/2f1fb30c/attachment.html</a><br>
>> > ><br>
>> ><br>
>> > ------------------------------<br>
>> ><br>
>> > _______________________________________________<br>
>> > IMP-users mailing list<br>
>> > <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> > <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>> ><br>
>> ><br>
>> > End of IMP-users Digest, Vol 38, Issue 9<br>
>> > ****************************************<br>
>> ><br>
>> -------------- next part --------------<br>
>> An HTML attachment was scrubbed...<br>
>> URL: <<br>
>> <a href="http://salilab.org/archives/imp-users/attachments/20140703/fe3a183b/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140703/fe3a183b/attachment.html</a><br>
>> ><br>
>><br>
>> ------------------------------<br>
>><br>
>> _______________________________________________<br>
>> IMP-users mailing list<br>
>> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
>> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
>><br>
>><br>
>> End of IMP-users Digest, Vol 38, Issue 10<br>
>> *****************************************<br>
>><br>
><br>
><br>
> _______________________________________________<br>
> IMP-users mailing list<br>
> <a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
> <a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
><br>
><br>
<br>
<br>
--<br>
Barak<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://salilab.org/archives/imp-users/attachments/20140703/ebc4da96/attachment.html" target="_blank">http://salilab.org/archives/imp-users/attachments/20140703/ebc4da96/attachment.html</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
IMP-users mailing list<br>
<a href="mailto:IMP-users@salilab.org">IMP-users@salilab.org</a><br>
<a href="https://salilab.org/mailman/listinfo/imp-users" target="_blank">https://salilab.org/mailman/listinfo/imp-users</a><br>
<br>
<br>
End of IMP-users Digest, Vol 38, Issue 12<br>
*****************************************<br>
</blockquote></div><br></div></div></div>