<div dir="ltr">aha okay, so now i'm generating .rmf files however when trying to open them in chimera I get the following error:<div><br></div><div>"Invalid handle returned from H5Fopen(name.c_str(), H5F_ACC_RDONLY, plist)" in file "</div>
<div><br></div><div>I'm not sure whether this is because I've created empty .rmf files or something else is wrong ...</div><div><br></div><div>the code for making the rmf files:</div><div><br></div><div><div>for i in range(0, cs.get_number_of_configurations()):</div>
<div> cs.load_configuration(i)</div><div> h = IMP.atom.Hierarchy.get_children(all)</div><div> tfn = IMP.create_temporary_file_name("josh%d"%i, ".rmf")</div><div> print "file is", tfn</div>
<div> rh = RMF.create_rmf_file(tfn)</div><div> </div><div> # add the hierarchy to the file</div><div> IMP.rmf.add_hierarchies(rh, h)</div><div> </div><div> # add the current configuration to the file as frame 0</div>
<div> IMP.rmf.save_frame(rh)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 3 July 2014 00:20, <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 (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>
<<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 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 from<br>
its documentation is that when you load a configuration, the values of 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 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>> wrote:<br>
<br>
><br>
><br>
> Conceptually I do ( i think ... ) but not practically. I'm hoping to view<br>
> each of the models i created - with MSrestraints - separately as an .rmf 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 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 hierarchy 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>
>> 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 me<br>
>> know if you are not familiar with decorators, Hierarchy, or 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 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 <<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 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 Raveh)<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 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 <<a href="mailto:jma.bullock@gmail.com">jma.bullock@gmail.com</a>><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 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 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: 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 <<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 RMF<br>
>> >>> files<br>
>> >>> >> seems fine - do you get an output RMF file? Could you load it 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 restraints.<br>
>> The<br>
>> >>> >> models<br>
>> >>> >> > get scored but nothing seems to write to the pymol file. Ideally<br>
>> i'd<br>
>> >>> >> like<br>
>> >>> >> > to write to an .rmf but i haven't worked that one out either ...<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 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, 300))<br>
>> >>> >> ><br>
>> >>> >> ><br>
>> >>> >> > # this function creates the molecular hierarchies for the 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 balls<br>
>> of<br>
>> >>> >> > appropriate<br>
>> >>> >> > # radii and number, chose by the resolution parameter and 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 IMP.atom.create_connectivity_restraint<br>
>> >>> >> > functionality<br>
>> >>> >> ><br>
>> >>> >> > score=<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 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 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 easier<br>
>> to<br>
>> >>> >> > understand<br>
>> >>> >> > # in the case, the clustering is pretty meaningless<br>
>> >>> >> > embed= IMP.statistics.ConfigurationSetXYZEmbedding(cs,<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 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>
>> >>> >> > # 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 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 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(), "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 :", 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 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>
>> <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>
>> <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>
>> <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: <<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>
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>
</blockquote></div><br></div></div></div>