PEATDB/Ekin/Ekin_map.py
def map_datatab2structure(self):
        """If the PEATDB record has a structure, then we allow the user to map each datatab
        to a specific part of the protein.

        One can map a datatab to an atom, a residue, a chain, or define a structural group and map to it"""
        if not self.parent:
            import tkMessageBox
            tkMessageBox.showinfo("No PEAT",
                                  "This option is only available when Ekin is started from PEAT",
                                  parent=self.ekin_win)
            return
        #
        # Do we have a record name
        #
        if not self.protein:
            import tkMessageBox
            tkMessageBox.showinfo("No PEAT record",
                                  "This option is only available when Ekin has been started by clicking a PEAT record",
                                  parent=self.ekin_win)
            return
        #
        # Is there a structure?
        #
        error=None
        if not self.parent.data.has_key('DBinstance'):
            error=1
        else:
            DB=self.parent.data['DBinstance'].DB
            if not DB[self.protein].has_key('Structure'):
                error=1
            else:
                print 'Trying to get PDB'
                self.pdblines,X=self.parent.get_structure(self.protein,'Structure')
                if not self.pdblines:
                    error=1
        if error:
            import tkMessageBox
            tkMessageBox.showinfo("No Structure in PEAT",
                                  "This option is only available when the PEAT record has a structure",
                                  parent=self.ekin_win)
            return
        #
        # Open the mapping window
        #
        mapper_win=Toplevel()
        mapper_win.title('Map datatab to structure. %s - %s' %(self.protein,self.field))
        self.set_geometry(self.ekin_win,mapper_win)

        #
        # Mapping Manager
        #
        row=0
        Label(mapper_win,text='Mapping Manager',bg='lightblue').grid(row=row,column=0,columnspan=3,sticky='news')
        row=row+1
        Label(mapper_win,textvariable=self.currentdataset.get()).grid(row=row,column=0,columnspan=3,sticky='news')
        #
        # Headers
        #
        #row=row+1
        #Label(mapper_win,text='Structural group type').grid(row=row,column=0,sticky='news')
        #Label(mapper_win,text='Structural element').grid(row=row,column=1,sticky='news')
        #Label(mapper_win,text='Datatab property').grid(row=row,column=2,sticky='news')
        #
        # Structural groupings for this protein
        #
        #if not DB[self.protein].has_key('structgroups'):
        #    DB[self.protein]['structgroups']={}
        #structgroups=DB[self.protein]['structgroups'].keys()
        #
        # Load the residue definitions
        #
        import Protool.mutate
        self.M_instance=Protool.mutate.Mutate(onlydefs=1)
        self.AAdefs=self.M_instance.aadefs
        #
        # Struct group types
        #
        row=row+1
        listbox_height=5
        self.group_type_box = Pmw.ScrolledListBox(mapper_win,
                                                  items=['Residues','Atoms','Titratable groups'],
                                                  labelpos='nw',
                                                  label_text='Group type',
                                                  listbox_height = listbox_height,
                                                  usehullsize = 1,
                                                  hull_width = 200,
                                                  hull_height = 100,
                                                  selectioncommand=self.update_elements)
        self.group_type_box.grid(row=row,column=0,columnspan=1,sticky='news')
        self.group_type_box.configure(listbox_bg='white')
        self.group_type_box.configure(listbox_selectmode='single')
        self.group_type_box.configure(listbox_exportselection=0)
        #
        #
        # Dropdown list of elements of each structgroup type
        #
        self.group_elements_box = Pmw.ScrolledListBox(mapper_win,
                                              items=[],
                                              labelpos='nw',
                                              label_text='Group Elements',
                                              listbox_height = listbox_height,
                                              usehullsize = 1,
                                              hull_width = 200,
                                              hull_height = 100)
        self.group_elements_box.grid(row=row,column=1,columnspan=1,sticky='news')
        self.group_elements_box.configure(listbox_bg='white')
        self.group_elements_box.configure(listbox_selectmode='extended')
        self.group_elements_box.configure(listbox_exportselection=0)

        # Parameters that we can map to structgroups
        import Fitter
        self.FIT=Fitter.FITTER('1 pKa 2 Chemical shifts',self)

        self.dataprops=['Data source']+self.FIT.parameter_names
        self.data_prop_box = Pmw.ScrolledListBox(mapper_win,
                                              items=self.dataprops,
                                              labelpos='nw',
                                              label_text='Data properties',
                                              listbox_height = listbox_height,
                                              usehullsize = 1,
                                              hull_width = 200,
                                              hull_height = 100)
        self.data_prop_box.grid(row=row,column=2,columnspan=1,sticky='news')
        self.data_prop_box.configure(listbox_bg='white')
        self.data_prop_box.configure(listbox_selectmode='extended')
        self.data_prop_box.configure(listbox_exportselection=0)
        #
        # List of existing mappings
        #
        row=row+1
        datatab=self.currentdataset.get()
        print 'Loading this datatab in mapper',datatab
        mappings=self.get_structmappings(datatab)
        self.mapping_box = Pmw.ScrolledListBox(mapper_win,
                                               items=mappings,
                                               labelpos='nw',
                                               label_text='Existing mappings',
                                               listbox_height = 6,
                                               usehullsize = 1,
                                               hull_width = 200,
                                               hull_height = 200)
        self.mapping_box.grid(row=row,column=0,columnspan=3,sticky='news')
        self.mapping_box.configure(listbox_selectmode='single')
        self.mapping_box.configure(listbox_bg='white')
        #
        # Buttons
        #
        row=row+1
        Button(mapper_win,text='Create mapping',bg='lightgreen',borderwidth=2, relief=GROOVE, command=self.create_mapping).grid(row=row,column=0,sticky='news',padx=2,pady=2)
        Button(mapper_win,text='Delete mapping',bg='yellow',borderwidth=2, relief=GROOVE, command=self.delete_mapping).grid(row=row,column=1,sticky='news',padx=2,pady=2)
        Button(mapper_win,text='Export',bg='#CFECEC',borderwidth=2, relief=GROOVE, command=self.export_dialog).grid(row=row,column=2,sticky='news',padx=2,pady=2)

        row=row+1
        Button(mapper_win,text='Close',borderwidth=2, relief=GROOVE,command=self.close_mapper_window).grid(row=row,column=1,columnspan=2,sticky='news',padx=2,pady=2)
        #
        # Structural group manager
        #
        #row=row+1
        #Label(mapper_win,text='Structural Group Manager',bg='lightblue').grid(row=row,column=0,columnspan=3,sticky='news')
        #import os, sys
        #PEAT_dir=os.path.split(__file__)[0]
        #sys.path.append(PEAT_dir)
        #import protein_selector
        #row=row+1
        #SEL=protein_selector.select_residue(mapper_win,self.pdblines)
        #SEL.box.grid(row=row,column=0)
        ##
        #row=row+1
        #Label(mapper_win,text='Atoms').grid(row=row,column=1)
        #row=row+1
        #Button(mapper_win,text='Create new structural grouping',command=self.create_new_structgroup).grid(row=row,column=0)
        #Button(mapper_win,text='Add to structural grouping',command=self.add_to_structgroup).grid(row=row,column=1)
        #Button(mapper_win,text='Close',command=mapper_win.destroy).grid(row=row,column=2,sticky='news')
        mapper_win.rowconfigure(2,weight=1)
        self.mapper_win=mapper_win
        self.mapper_win.transient(master=self.ekin_win)
        return
If the PEATDB record has a structure, then we allow the user to map each datatab
        to a specific part of the protein.

        One can map a datatab to an atom, a residue, a chain, or define a structural group and map to it
If the PEATDB record has a structure, then we allow the user to map each datatab
to a specific part of the protein.

One can map a datatab to an atom, a residue, a chain, or define a structural group and map to it
If the PEATDB record has a structure then we allow the user to map each datatab to a specific part of the protein . One can map a datatab to an atom a residue a chain or define a structural group and map to it
def map_datatab2structure(self):
        if not self.parent:
            import tkMessageBox
            tkMessageBox.showinfo("No PEAT",
                                  "This option is only available when Ekin is started from PEAT",
                                  parent=self.ekin_win)
            return
         Do we have a record name
        if not self.protein:
            import tkMessageBox
            tkMessageBox.showinfo("No PEAT record",
                                  "This option is only available when Ekin has been started by clicking a PEAT record",
                                  parent=self.ekin_win)
            return
         Is there a structure?
        error=None
        if not self.parent.data.has_key('DBinstance'):
            error=1
        else:
            DB=self.parent.data['DBinstance'].DB
            if not DB[self.protein].has_key('Structure'):
                error=1
            else:
                print 'Trying to get PDB'
                self.pdblines,X=self.parent.get_structure(self.protein,'Structure')
                if not self.pdblines:
                    error=1
        if error:
            import tkMessageBox
            tkMessageBox.showinfo("No Structure in PEAT",
                                  "This option is only available when the PEAT record has a structure",
                                  parent=self.ekin_win)
            return
         Open the mapping window
        mapper_win=Toplevel()
        mapper_win.title('Map datatab to structure. %s - %s' %(self.protein,self.field))
        self.set_geometry(self.ekin_win,mapper_win)
         Mapping Manager
        row=0
        Label(mapper_win,text='Mapping Manager',bg='lightblue').grid(row=row,column=0,columnspan=3,sticky='news')
        row=row+1
        Label(mapper_win,textvariable=self.currentdataset.get()).grid(row=row,column=0,columnspan=3,sticky='news')
         Headers
        row=row+1
        Label(mapper_win,text='Structural group type').grid(row=row,column=0,sticky='news')
        Label(mapper_win,text='Structural element').grid(row=row,column=1,sticky='news')
        Label(mapper_win,text='Datatab property').grid(row=row,column=2,sticky='news')
         Structural groupings for this protein
        if not DB[self.protein].has_key('structgroups'):
            DB[self.protein]['structgroups']={}
        structgroups=DB[self.protein]['structgroups'].keys()
         Load the residue definitions
        import Protool.mutate
        self.M_instance=Protool.mutate.Mutate(onlydefs=1)
        self.AAdefs=self.M_instance.aadefs
         Struct group types
        row=row+1
        listbox_height=5
        self.group_type_box = Pmw.ScrolledListBox(mapper_win,
                                                  items=['Residues','Atoms','Titratable groups'],
                                                  labelpos='nw',
                                                  label_text='Group type',
                                                  listbox_height = listbox_height,
                                                  usehullsize = 1,
                                                  hull_width = 200,
                                                  hull_height = 100,
                                                  selectioncommand=self.update_elements)
        self.group_type_box.grid(row=row,column=0,columnspan=1,sticky='news')
        self.group_type_box.configure(listbox_bg='white')
        self.group_type_box.configure(listbox_selectmode='single')
        self.group_type_box.configure(listbox_exportselection=0)
         Dropdown list of elements of each structgroup type
        self.group_elements_box = Pmw.ScrolledListBox(mapper_win,
                                              items=[],
                                              labelpos='nw',
                                              label_text='Group Elements',
                                              listbox_height = listbox_height,
                                              usehullsize = 1,
                                              hull_width = 200,
                                              hull_height = 100)
        self.group_elements_box.grid(row=row,column=1,columnspan=1,sticky='news')
        self.group_elements_box.configure(listbox_bg='white')
        self.group_elements_box.configure(listbox_selectmode='extended')
        self.group_elements_box.configure(listbox_exportselection=0)
         Parameters that we can map to structgroups
        import Fitter
        self.FIT=Fitter.FITTER('1 pKa 2 Chemical shifts',self)
        self.dataprops=['Data source']+self.FIT.parameter_names
        self.data_prop_box = Pmw.ScrolledListBox(mapper_win,
                                              items=self.dataprops,
                                              labelpos='nw',
                                              label_text='Data properties',
                                              listbox_height = listbox_height,
                                              usehullsize = 1,
                                              hull_width = 200,
                                              hull_height = 100)
        self.data_prop_box.grid(row=row,column=2,columnspan=1,sticky='news')
        self.data_prop_box.configure(listbox_bg='white')
        self.data_prop_box.configure(listbox_selectmode='extended')
        self.data_prop_box.configure(listbox_exportselection=0)
         List of existing mappings
        row=row+1
        datatab=self.currentdataset.get()
        print 'Loading this datatab in mapper',datatab
        mappings=self.get_structmappings(datatab)
        self.mapping_box = Pmw.ScrolledListBox(mapper_win,
                                               items=mappings,
                                               labelpos='nw',
                                               label_text='Existing mappings',
                                               listbox_height = 6,
                                               usehullsize = 1,
                                               hull_width = 200,
                                               hull_height = 200)
        self.mapping_box.grid(row=row,column=0,columnspan=3,sticky='news')
        self.mapping_box.configure(listbox_selectmode='single')
        self.mapping_box.configure(listbox_bg='white')
         Buttons
        row=row+1
        Button(mapper_win,text='Create mapping',bg='lightgreen',borderwidth=2, relief=GROOVE, command=self.create_mapping).grid(row=row,column=0,sticky='news',padx=2,pady=2)
        Button(mapper_win,text='Delete mapping',bg='yellow',borderwidth=2, relief=GROOVE, command=self.delete_mapping).grid(row=row,column=1,sticky='news',padx=2,pady=2)
        Button(mapper_win,text='Export',bg='CFECEC',borderwidth=2, relief=GROOVE, command=self.export_dialog).grid(row=row,column=2,sticky='news',padx=2,pady=2)
        row=row+1
        Button(mapper_win,text='Close',borderwidth=2, relief=GROOVE,command=self.close_mapper_window).grid(row=row,column=1,columnspan=2,sticky='news',padx=2,pady=2)
         Structural group manager
        row=row+1
        Label(mapper_win,text='Structural Group Manager',bg='lightblue').grid(row=row,column=0,columnspan=3,sticky='news')
        import os, sys
        PEAT_dir=os.path.split(__file__)[0]
        sys.path.append(PEAT_dir)
        import protein_selector
        row=row+1
        SEL=protein_selector.select_residue(mapper_win,self.pdblines)
        SEL.box.grid(row=row,column=0)
        row=row+1
        Label(mapper_win,text='Atoms').grid(row=row,column=1)
        row=row+1
        Button(mapper_win,text='Create new structural grouping',command=self.create_new_structgroup).grid(row=row,column=0)
        Button(mapper_win,text='Add to structural grouping',command=self.add_to_structgroup).grid(row=row,column=1)
        Button(mapper_win,text='Close',command=mapper_win.destroy).grid(row=row,column=2,sticky='news')
        mapper_win.rowconfigure(2,weight=1)
        self.mapper_win=mapper_win
        self.mapper_win.transient(master=self.ekin_win)
        return
def map_datatab2structure ( self ) : if not self . parent : import tkMessageBox tkMessageBox . showinfo ( "No PEAT" , "This option is only available when Ekin is started from PEAT" , parent = self . ekin_win ) return if not self . protein : import tkMessageBox tkMessageBox . showinfo ( "No PEAT record" , "This option is only available when Ekin has been started by clicking a PEAT record" , parent = self . ekin_win ) return error = None if not self . parent . data . has_key ( 'DBinstance' ) : error = 1 else : DB = self . parent . data [ 'DBinstance' ] . DB if not DB [ self . protein ] . has_key ( 'Structure' ) : error = 1 else : print 'Trying to get PDB' self . pdblines , X = self . parent . get_structure ( self . protein , 'Structure' ) if not self . pdblines : error = 1 if error : import tkMessageBox tkMessageBox . showinfo ( "No Structure in PEAT" , "This option is only available when the PEAT record has a structure" , parent = self . ekin_win ) return mapper_win = Toplevel ( ) mapper_win . title ( 'Map datatab to structure. %s - %s' % ( self . protein , self . field ) ) self . set_geometry ( self . ekin_win , mapper_win ) row = 0 Label ( mapper_win , text = 'Mapping Manager' , bg = 'lightblue' ) . grid ( row = row , column = 0 , columnspan = 3 , sticky = 'news' ) row = row + 1 Label ( mapper_win , textvariable = self . currentdataset . get ( ) ) . grid ( row = row , column = 0 , columnspan = 3 , sticky = 'news' ) import Protool . mutate self . M_instance = Protool . mutate . Mutate ( onlydefs = 1 ) self . AAdefs = self . M_instance . aadefs row = row + 1 listbox_height = 5 self . group_type_box = Pmw . ScrolledListBox ( mapper_win , items = [ 'Residues' , 'Atoms' , 'Titratable groups' ] , labelpos = 'nw' , label_text = 'Group type' , listbox_height = listbox_height , usehullsize = 1 , hull_width = 200 , hull_height = 100 , selectioncommand = self . update_elements ) self . group_type_box . grid ( row = row , column = 0 , columnspan = 1 , sticky = 'news' ) self . group_type_box . configure ( listbox_bg = 'white' ) self . group_type_box . configure ( listbox_selectmode = 'single' ) self . group_type_box . configure ( listbox_exportselection = 0 ) self . group_elements_box = Pmw . ScrolledListBox ( mapper_win , items = [ ] , labelpos = 'nw' , label_text = 'Group Elements' , listbox_height = listbox_height , usehullsize = 1 , hull_width = 200 , hull_height = 100 ) self . group_elements_box . grid ( row = row , column = 1 , columnspan = 1 , sticky = 'news' ) self . group_elements_box . configure ( listbox_bg = 'white' ) self . group_elements_box . configure ( listbox_selectmode = 'extended' ) self . group_elements_box . configure ( listbox_exportselection = 0 ) import Fitter self . FIT = Fitter . FITTER ( '1 pKa 2 Chemical shifts' , self ) self . dataprops = [ 'Data source' ] + self . FIT . parameter_names self . data_prop_box = Pmw . ScrolledListBox ( mapper_win , items = self . dataprops , labelpos = 'nw' , label_text = 'Data properties' , listbox_height = listbox_height , usehullsize = 1 , hull_width = 200 , hull_height = 100 ) self . data_prop_box . grid ( row = row , column = 2 , columnspan = 1 , sticky = 'news' ) self . data_prop_box . configure ( listbox_bg = 'white' ) self . data_prop_box . configure ( listbox_selectmode = 'extended' ) self . data_prop_box . configure ( listbox_exportselection = 0 ) row = row + 1 datatab = self . currentdataset . get ( ) print 'Loading this datatab in mapper' , datatab mappings = self . get_structmappings ( datatab ) self . mapping_box = Pmw . ScrolledListBox ( mapper_win , items = mappings , labelpos = 'nw' , label_text = 'Existing mappings' , listbox_height = 6 , usehullsize = 1 , hull_width = 200 , hull_height = 200 ) self . mapping_box . grid ( row = row , column = 0 , columnspan = 3 , sticky = 'news' ) self . mapping_box . configure ( listbox_selectmode = 'single' ) self . mapping_box . configure ( listbox_bg = 'white' ) row = row + 1 Button ( mapper_win , text = 'Create mapping' , bg = 'lightgreen' , borderwidth = 2 , relief = GROOVE , command = self . create_mapping ) . grid ( row = row , column = 0 , sticky = 'news' , padx = 2 , pady = 2 ) Button ( mapper_win , text = 'Delete mapping' , bg = 'yellow' , borderwidth = 2 , relief = GROOVE , command = self . delete_mapping ) . grid ( row = row , column = 1 , sticky = 'news' , padx = 2 , pady = 2 ) Button ( mapper_win , text = 'Export' , bg = '#CFECEC' , borderwidth = 2 , relief = GROOVE , command = self . export_dialog ) . grid ( row = row , column = 2 , sticky = 'news' , padx = 2 , pady = 2 ) row = row + 1 Button ( mapper_win , text = 'Close' , borderwidth = 2 , relief = GROOVE , command = self . close_mapper_window ) . grid ( row = row , column = 1 , columnspan = 2 , sticky = 'news' , padx = 2 , pady = 2 ) mapper_win . rowconfigure ( 2 , weight = 1 ) self . mapper_win = mapper_win self . mapper_win . transient ( master = self . ekin_win ) return
If the PEATDB record has a structure, then we allow the user to map each datatab
to a specific part of the protein.
If the PEATDB record has a structure then we allow the user to map each datatab to a specific part of the protein .
"""If the PEATDB record has a structure, then we allow the user to map each datatab
        to a specific part of the protein.

        One can map a datatab to an atom, a residue, a chain, or define a structural group and map to it""" # # Do we have a record name # # # Is there a structure? # # # Open the mapping window # # # Mapping Manager # # # Headers # #row=row+1 #Label(mapper_win,text='Structural group type').grid(row=row,column=0,sticky='news') #Label(mapper_win,text='Structural element').grid(row=row,column=1,sticky='news') #Label(mapper_win,text='Datatab property').grid(row=row,column=2,sticky='news') # # Structural groupings for this protein # #if not DB[self.protein].has_key('structgroups'): #    DB[self.protein]['structgroups']={} #structgroups=DB[self.protein]['structgroups'].keys() # # Load the residue definitions # # # Struct group types # # # # Dropdown list of elements of each structgroup type # # Parameters that we can map to structgroups # # List of existing mappings # # # Buttons # # # Structural group manager # #row=row+1 #Label(mapper_win,text='Structural Group Manager',bg='lightblue').grid(row=row,column=0,columnspan=3,sticky='news') #import os, sys #PEAT_dir=os.path.split(__file__)[0] #sys.path.append(PEAT_dir) #import protein_selector #row=row+1 #SEL=protein_selector.select_residue(mapper_win,self.pdblines) #SEL.box.grid(row=row,column=0) ## #row=row+1 #Label(mapper_win,text='Atoms').grid(row=row,column=1) #row=row+1 #Button(mapper_win,text='Create new structural grouping',command=self.create_new_structgroup).grid(row=row,column=0) #Button(mapper_win,text='Add to structural grouping',command=self.add_to_structgroup).grid(row=row,column=1) #Button(mapper_win,text='Close',command=mapper_win.destroy).grid(row=row,column=2,sticky='news')
self