import IMP import IMP.em2d as em2d import os """ Conversion of Electron Microscopy Images. """ # Read images fn_selection=em2d.get_example_path("all-1z5s-projections.sel") srw = em2d.SpiderImageReaderWriter() trw = em2d.TIFFImageReaderWriter() fn_images=em2d.read_selection_file(fn_selection) fn_images = [em2d.get_example_path(x) for x in fn_images] images = em2d.read_images(fn_images,srw) # write fn_saved=em2d.create_filenames(3,"1z5s-projection","tif") em2d.save_images(images,fn_saved,trw)
## \example em2d/collision_cross_section.py # Example of how to compute the collision cross section of a molecule. # import IMP import IMP.em2d as em2d import IMP.atom as atom """ Example of how to compute the collision cross section of a molecule """ IMP.base.set_log_level(IMP.base.TERSE) m = IMP.kernel.Model() fn = em2d.get_example_path("1z5s.pdb") prot = atom.read_pdb(fn, m, atom.ATOMPDBSelector()) atom.add_radii(prot) projections = 20 resolution = 1.0 pixel_size = 1.5 img_size = 80 ccs = em2d.CollisionCrossSection(projections, resolution, pixel_size, img_size) ccs.set_model_particles(IMP.atom.get_leaves(prot)) print "CCS", ccs.get_ccs(), "A**2"
## Example of how to compute the collision cross section of a molecule. ## import IMP import IMP.em2d as em2d import IMP.atom as atom """ Example of how to compute the collision cross section of a molecule """ IMP.base.set_log_level(IMP.base.TERSE) m = IMP.Model() fn = em2d.get_example_path("1z5s.pdb") prot = atom.read_pdb(fn, m ,atom.ATOMPDBSelector()) atom.add_radii(prot) projections = 20 resolution = 1.0 pixel_size = 1.5 img_size = 80 ccs = em2d.CollisionCrossSection(projections, resolution, pixel_size, img_size) ccs.set_model_particles(IMP.atom.get_leaves(prot)) print "CCS",ccs.get_ccs(),"A**2"
self.count=0 o=self.get_optimizer() m=o.get_model() m.show_restraint_score_statistics() m.show_all_statistics() #for i in range(0,m.get_number_of_restraints()): # r=m.get_restraint(i) # print "restraint",r.get_name(),"value",r.evaluate(False) def do_show(self, stream): print >> stream, ps # Get model from PDB file IMP.base.set_log_level(IMP.base.TERSE) m = IMP.Model() prot = atom.read_pdb(em2d.get_example_path("1z5s.pdb"),m,atom.ATOMPDBSelector()) atom.add_radii(prot) # get the chains chains = atom.get_by_type(prot,atom.CHAIN_TYPE) print "there are",len(chains),"chains in 1z5s.pdb" # set the chains as rigid bodies native_chain_centers = [] rigid_bodies= [] for c in chains: atoms=core.get_leaves(c) rbd=core.RigidBody.setup_particle(c,atoms) rigid_bodies.append(rbd) print "chain has",rbd.get_number_of_members(), \ "atoms","coordinates: ",rbd.get_coordinates()
where min_index is the index of the minimum value """ min_value = sequence[0] min_index = 0 for i in range(0,len(sequence)): # print "argmin - checking ",sequence[i] if(sequence[i]<min_value): min_value = sequence[i] min_index =i # print "argmin - selecting ",min_value,min_index return min_value,min_index #*************************** fn_selection = em2d.get_example_path("all-models-1z5s.sel") fn_em2d_scores = em2d.get_example_path("em2d_scores_for_clustering.data") # Load models print "Reading models ..." model = IMP.Model() ssel = atom.ATOMPDBSelector() coords =[] fn_models = em2d.read_selection_file(fn_selection) n_models = len(fn_models) hierarchies=[] for fn in fn_models: fn_model=em2d.get_example_path(fn) h=atom.read_pdb(fn_model,model,ssel,True) hierarchies.append(h) xyz=core.XYZs(atom.get_leaves(h)) coords.append( [x.get_coordinates() for x in xyz])
## \example em2d/em_images_conversion.py # Conversion of Electron Microscopy Images. # import IMP import IMP.em2d as em2d import os """ Conversion of Electron Microscopy Images. """ # Read images fn_selection = em2d.get_example_path("all-1z5s-projections.sel") srw = em2d.SpiderImageReaderWriter() trw = em2d.TIFFImageReaderWriter() fn_images = em2d.read_selection_file(fn_selection) fn_images = [em2d.get_example_path(x) for x in fn_images] images = em2d.read_images(fn_images, srw) # write fn_saved = em2d.create_filenames(3, "1z5s-projection", "tif") em2d.save_images(images, fn_saved, trw)