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