コード例 #1
0
ファイル: r_main.py プロジェクト: CONNJUR/SparkyExtensions
    def __init__(self, session):
        self.g = GitRepo(model.project().sparky_directory)
        
        self.session = session
        self.title = 'Reproducibility'
        
        tkutil.Dialog.__init__(self, session.tk, self.title)
        
        br = tkutil.button_row(self.top, ('Make snapshot', self.make_snapshot))
        br.frame.pack(side='top', anchor='w')
        # TODO would like to get an enumerated list of these from somewhere
        e = tkutil.entry_field(self.top, 'Deductive reason used:', '<enter reason>', 50)
        e.frame.pack(side='top', anchor='w')
        self.message = e.variable

        br2 = tkutil.button_row(self.top, ('Set groups of selected peaks', self.set_group))
        br2.frame.pack(side = 'top', anchor = 'w')
        e2 = tkutil.entry_field(self.top, 'Group name:', '', 20, '(leave blank for name to be autogenerated)')
        e2.frame.pack(side = 'top', anchor = 'w')
        self.group = e2.variable

        br4 = tkutil.button_row(self.top, ('Create new group for peak', self.create_new_group))
        br4.frame.pack(side = 'top', anchor = 'w')

        br5 = tkutil.button_row(self.top, ('Set selected peaks to noise', self.set_noise))
        br5.frame.pack(side = 'top', anchor = 'w')

        br6 = tkutil.button_row(self.top, ('Set selected peaks to artifact', self.set_artifact))
        br6.frame.pack(side = 'top', anchor = 'w')
        
        self.peaktype_spectrum = m1 = tkutil.option_menu(self.top, 'Select peaktype spectrum', peaktypes.spectra.keys())
        m1.frame.pack(side='top', anchor='w')
        m1.add_callback(self.set_peaktype_spectrum)
        
        self.peaktype_dim_order = m3 = tkutil.option_menu(self.top, 'Peaktype dimension order', [])
        self.dim_order = ','.join(map(str, peaktypes.orders[1][0]))
        m3.frame.pack(side='top', anchor='w')
        m3.add_callback(self.set_peaktype_dim_order)
        
        self.peaktype = m2 = tkutil.option_menu(self.top, 'Assign peaktype', [])
        m2.frame.pack(side='top', anchor='w')
        m2.add_callback(self.assign_peaktype)

        _spectrum_names = [sp.name for sp in model.spectra()]
        self.select_signal_peaks_menu = m4 = tkutil.option_menu(self.top, 'Select signal peaks', _spectrum_names)
        m4.frame.pack(side='top', anchor='w')
        m4.add_callback(self.select_signal_peaks)

        self.changed_callback = model.session().notify_me('selection changed', self.selection_changed)
    
        br = tkutil.button_row(self.top,
                    ('Open peak-GSS dialog', self.peaks_to_gss),
                    ('Close', self.close_cb),
                    )
        br.frame.pack(side = 'top', anchor = 'w')
コード例 #2
0
    def __init__(self, session):

        self.session = session

        tkutil.Dialog.__init__(self, session.tk, 'Atom Name Translations')

        self.trans_name = tkutil.option_menu(self.top, 'Atom set: ', ())
        self.trans_name.frame.pack(side='top', anchor='w')
        self.trans_name.add_callback(self.show_translation_cb)

        st = tkutil.scrolling_list(self.top, 'Select applicable translations',
                                   5)
        st.frame.pack(side='top', anchor='w')
        st.listbox['selectmode'] = 'multiple'
        self.standard_trans = st

        for t in standard_translations():
            self.standard_trans.listbox.insert('end', t.name)

        self.bad_names = tkutil.scrolling_list(self.top, 'Non standard names',
                                               5)
        self.bad_names.frame.pack(side='top', anchor='w', fill='y', expand=1)

        br = tkutil.button_row(
            self.top,
            ('Update', self.update_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'AtomNameTrans')),
        )
        br.frame.pack(side='top', anchor='w')
コード例 #3
0
ファイル: atoms.py プロジェクト: CONNJUR/SparkyExtensions
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Atom Name Translations')

    self.trans_name = tkutil.option_menu(self.top, 'Atom set: ', ())
    self.trans_name.frame.pack(side = 'top', anchor = 'w')
    self.trans_name.add_callback(self.show_translation_cb)
      
    st = tkutil.scrolling_list(self.top, 'Select applicable translations', 5)
    st.frame.pack(side = 'top', anchor = 'w')
    st.listbox['selectmode'] = 'multiple'
    self.standard_trans = st
    
    for t in standard_translations():
      self.standard_trans.listbox.insert('end', t.name)

    self.bad_names = tkutil.scrolling_list(self.top, 'Non standard names', 5)
    self.bad_names.frame.pack(side = 'top', anchor = 'w',
                              fill = 'y', expand = 1)

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'AtomNameTrans')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
コード例 #4
0
  def __init__(self, session):

    self.session = session
    self.selection_notice = None

    tkutil.Dialog.__init__(self, session.tk, 'Read Cyana peak list')

    tspectra=('2D','3D')
    initial=tspectra[0]
    self.spectratype = tkutil.option_menu(self.top, "Select spectra dimension", tspectra, initial)
    self.spectratype.frame.pack(side = 'top', anchor = 'w')

    order=('xy','yx','xyz','xzy','yxz','yzx','zxy','zyx')
    initial=order[0]

    self.order = tkutil.option_menu(self.top, "Select output order", order, initial)
    self.order.frame.pack(side = 'top', anchor = 'w')    

    self.plp = tkutil.file_field(self.top, 'Cyana output peak file: ', 'peaklist')
    self.plp.frame.pack(side = 'top', anchor = 'e')
    self.peak_list_path = self.plp
    
    self.pl = tkutil.file_field(self.top,   'Cyana output proton file:', 'protlist')
    self.pl.frame.pack(side = 'top', anchor = 'e')
    self.proton_list_path = self.pl

    self.sl = tkutil.file_field(self.top,   'Sequence file: ', 'seqlist')
    self.sl.frame.pack(side = 'top', anchor = 'e')
    self.sequence_list_path = self.sl

    sc = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sc.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_choice = sc

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Create peaks', self.read_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'ReadPeaks')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
コード例 #5
0
  def make_dialog(self):

    tkutil.Dialog.__init__(self, self.session.tk, 'Mirror Assignment Checker')

    self.top.bind('<Destroy>', self.window_destroyed_cb, 1)

    w = self.make_noesy_table(self.top)
    w.pack(side = 'top', anchor = 'w')

    choices = ('Selected peaks',
	       'Peaks with assigned mirror peak',
	       'Peaks without assigned mirror peak',
	       'Unassigned with assigned mirror',
	       )
    self.show_type = tkutil.option_menu(self.top, 'Show ',
                                        choices, choices[0])
    self.show_type.frame.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top,
                            'Exclude mirrors with low signal/noise?', 0)
    cb.button.pack(side = 'top', anchor = 'w')
    self.exclude_mirrors = cb

    f = Tkinter.Frame(self.top)
    cb.map_widget(f)
    
    e = tkutil.entry_field(f, 'C13 / N15 intensity ratio: ', '1', 3)
    self.c13_n15_factor = e.variable
    e.frame.pack(side = 'top', anchor = 'w')

    e = tkutil.entry_field(f, 'Minimum mirror intensity factor: ', '.5', 3)
    self.min_mirror_factor = e.variable
    e.frame.pack(side = 'top', anchor = 'w')

    pl = tkutil.scrolling_list(self.top, '', 5)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-2>', self.select_peak_or_assignment_cb)
    pl.listbox.bind('<ButtonRelease-1>', self.goto_peak_or_assignment_cb)
    self.peak_list = pl

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Strips', self.strips_cb),
			   ('Save', self.peak_list.save_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(self.session,
                                                   'MirrorPeak')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])

    self.settings = self.get_settings()
コード例 #6
0
    def add_spectrum(self, spectrum, table, row):

        pat_name, pat_axes = expectedpeaks.recall_pattern(spectrum)

        #
        # Make spectrum checkbutton
        #
        cb = tkutil.checkbutton(table.frame, spectrum.name, 0)
        cb.button['selectcolor'] = sputil.spectrum_color(spectrum)
        choose_cb = pyutil.precompose(sputil.choose_spectrum_cb, spectrum,
                                      table.chosen_spectra)
        cb.add_callback(choose_cb)
        cb.button.grid(row=row, column=0, sticky='w')
        if pat_name:
            cb.set_state(1)
        table.spectrum_to_checkbutton[spectrum] = cb

        #
        # Make peak pattern menu
        #
        epeak_types = expectedpeaks.expected_peak_descriptions.keys()
        pm = tkutil.option_menu(table.frame, '', epeak_types)
        pm.frame.grid(row=row, column=1, sticky='w')
        table.spectrum_epeak_menus[spectrum] = pm

        #
        # Get default spectrum peak pattern and axis order
        #
        if pat_name == None:
            pat_name = expectedpeaks.default_spectrum_pattern_name(spectrum)
            if pat_name == None:
                pat_name = pm.get()
            pat_list = expectedpeaks.expected_peak_descriptions[pat_name]
            pat_nuclei = expectedpeaks.pattern_nuclei(pat_list[0])
            pat_axes = pyutil.order(pat_nuclei, spectrum.nuclei)

        #
        # Make axis order menu
        #
        aom = axes.axis_order_menu(table.frame,
                                   spectrum.nuclei,
                                   initial_order=pat_axes)
        aom.frame.grid(row=row, column=2, sticky='w')
        table.axis_order_menu[spectrum] = aom

        #
        # Register a callback to limit the menu choices for axis order.
        #
        def restrict_axis_order_cb(pat_name, aom=aom):
            import expectedpeaks
            pat_list = expectedpeaks.expected_peak_descriptions[pat_name]
            pat_nuclei = expectedpeaks.pattern_nuclei(pat_list[0])
            aom.restrict_menu_permutations(pat_nuclei)

        pm.add_callback(restrict_axis_order_cb)

        pm.set(pat_name)
コード例 #7
0
ファイル: r_group.py プロジェクト: CONNJUR/SparkyExtensions
 def __init__(self, session, gid=None, group_editor=None):
     self.session = session
     self.gid = gid
     self.group_editor = group_editor
     
     tkutil.Dialog.__init__(self, session.tk, 'merge resonances -- ???')
     
     self.rid1 = m1 = tkutil.option_menu(self.top, 'Resonance 1', [])
     m1.frame.pack(side='top', anchor='w')
     
     self.rid2 = m2 = tkutil.option_menu(self.top, 'Resonance 2', [])
     m2.frame.pack(side='top', anchor='w')
 
     br = tkutil.button_row(self.top,
                 ('Merge', self.merge_resonances),
                 ('Close', self.close_cb),
                 )
     br.frame.pack(side = 'top', anchor = 'w')
コード例 #8
0
    def __init__(self, session, gid=None, group_editor=None):
        self.session = session
        self.gid = gid
        self.group_editor = group_editor

        tkutil.Dialog.__init__(self, session.tk, 'merge resonances -- ???')

        self.rid1 = m1 = tkutil.option_menu(self.top, 'Resonance 1', [])
        m1.frame.pack(side='top', anchor='w')

        self.rid2 = m2 = tkutil.option_menu(self.top, 'Resonance 2', [])
        m2.frame.pack(side='top', anchor='w')

        br = tkutil.button_row(
            self.top,
            ('Merge', self.merge_resonances),
            ('Close', self.close_cb),
        )
        br.frame.pack(side='top', anchor='w')
コード例 #9
0
  def add_spectrum(self, spectrum, table, row):

    pat_name, pat_axes = expectedpeaks.recall_pattern(spectrum)

    #
    # Make spectrum checkbutton
    #
    cb = tkutil.checkbutton(table.frame, spectrum.name, 0)
    cb.button['selectcolor'] = sputil.spectrum_color(spectrum)
    choose_cb = pyutil.precompose(sputil.choose_spectrum_cb, spectrum,
                                  table.chosen_spectra)
    cb.add_callback(choose_cb)
    cb.button.grid(row = row, column = 0, sticky = 'w')
    if pat_name:
      cb.set_state(1)
    table.spectrum_to_checkbutton[spectrum] = cb

    #
    # Make peak pattern menu
    #
    epeak_types = expectedpeaks.expected_peak_descriptions.keys()
    pm = tkutil.option_menu(table.frame, '', epeak_types)
    pm.frame.grid(row = row, column = 1, sticky = 'w')
    table.spectrum_epeak_menus[spectrum] = pm

    #
    # Get default spectrum peak pattern and axis order
    #
    if pat_name == None:
      pat_name = expectedpeaks.default_spectrum_pattern_name(spectrum)
      if pat_name == None:
        pat_name = pm.get()
      pat_list = expectedpeaks.expected_peak_descriptions[pat_name]
      pat_nuclei = expectedpeaks.pattern_nuclei(pat_list[0])
      pat_axes = pyutil.order(pat_nuclei, spectrum.nuclei)

    #
    # Make axis order menu
    #
    aom = axes.axis_order_menu(table.frame, spectrum.nuclei,
                               initial_order = pat_axes)
    aom.frame.grid(row = row, column = 2, sticky = 'w')
    table.axis_order_menu[spectrum] = aom

    #
    # Register a callback to limit the menu choices for axis order.
    #
    def restrict_axis_order_cb(pat_name, aom=aom):
      import expectedpeaks
      pat_list = expectedpeaks.expected_peak_descriptions[pat_name]
      pat_nuclei = expectedpeaks.pattern_nuclei(pat_list[0])
      aom.restrict_menu_permutations(pat_nuclei)
    pm.add_callback(restrict_axis_order_cb)

    pm.set(pat_name)
コード例 #10
0
    def __init__(self, session):
        self.session = session
        self.title = 'Assign peaks into GSSs'

        tkutil.Dialog.__init__(self, session.tk, self.title)

        _spectrum_names = [sp.name for sp in model.spectra()]
        self.spec_from = m1 = tkutil.option_menu(
            self.top, 'Using selected peaks in spectrum:', _spectrum_names)
        m1.frame.pack(side='top', anchor='w')

        self.spec_to = m2 = tkutil.option_menu(
            self.top, 'Assign peaks to GSSs in spectrum:', _spectrum_names)
        m2.frame.pack(side='top', anchor='w')

        _d3 = [1, 2, 3]  # TODO do those values need to be strings?

        # matching dimension 1
        self.match1_from = m3 = tkutil.option_menu(
            self.top, 'Matching dimension 1: from:', _d3)
        m3.frame.pack(side='top', anchor='w')

        self.match1_to = m4 = tkutil.option_menu(self.top,
                                                 'Matching dimension 1: to:',
                                                 _d3)
        m4.frame.pack(side='top', anchor='w')

        self.tol1 = tkutil.entry_field(
            self.top, 'Matching dimension 1: tolerance (PPM):', '0.2', 20)
        self.tol1.frame.pack(side='top', anchor='w')

        # matching dimension 2
        self.match2_from = tkutil.option_menu(self.top,
                                              'Matching dimension 2: from:',
                                              _d3)
        self.match2_from.frame.pack(side='top', anchor='w')

        self.match2_to = tkutil.option_menu(self.top,
                                            'Matching dimension 2: to:', _d3)
        self.match2_to.frame.pack(side='top', anchor='w')

        self.tol2 = tkutil.entry_field(
            self.top, 'Matching dimension 2: tolerance (PPM):', '0.2', 20)
        self.tol2.frame.pack(side='top', anchor='w')

        # TODO check that the nuclei match
        # TODO are 2 matching dimensions enough?

        br = tkutil.button_row(
            self.top,
            ('Assign peaks', self.execute),
            ('Close', self.close_cb),
        )
        br.frame.pack(side='top', anchor='w')
コード例 #11
0
  def __init__(self, session):

    self.spectrum = None
    self.heavy_axis = None
    
    tkutil.Dialog.__init__(self, session.tk, 'Attached Proton')

    am = tkutil.option_menu(self.top, 'Attached proton axis: ', ())
    am.frame.pack(side = 'top')
    self.axis_menu = am

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
                           ('Cancel', self.close_cb),
                           ('Help', sputil.help_cb(session, 'LabelledAxis')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
コード例 #12
0
ファイル: relax.py プロジェクト: mattfenwick/SparkyExtensions
  def __init__(self, session):

    self.session = session
    self.spectrum_times = []
    self.last_spectrum_times = []
    self.error_estimate_trials = 5
    
    tkutil.Dialog.__init__(self, session.tk, 'Relaxation Peak Heights')

    pl = tkutil.scrolling_list(self.top, heading = '', height = 5)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-1>', self.show_fit_cb)
    pl.listbox.bind('<KeyPress-Delete>', pl.delete_selected_cb)
    # The following is needed so key press is received by list box.
    pl.listbox.bind('<ButtonPress-1>', pl.set_focus_cb)
    self.peak_list = pl

    md = tkutil.option_menu(self.top, 'Use ',
                            (self.HEIGHTS_MODE,
                             self.ASSIGNED_HEIGHTS_MODE,
                             self.ASSIGNED_HEIGHTS_ONLY_MODE,
                             self.VOLUMES_MODE))
    md.frame.pack(side = 'top', anchor = 'w')
    self.mode = md.variable

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
                           ('Setup...', self.setup_cb),
                           ('Save', self.peak_list.save_cb),
                           ('Append', self.peak_list.append_cb),
                           ('Clear', self.clear_cb),
                           ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'RelaxFit')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[4])
コード例 #13
0
ファイル: r_main.py プロジェクト: CONNJUR/SparkyExtensions
    def __init__(self, session):
        self.session = session
        self.title = 'Assign peaks into GSSs'
        
        tkutil.Dialog.__init__(self, session.tk, self.title)

        _spectrum_names = [sp.name for sp in model.spectra()]
        self.spec_from = m1 = tkutil.option_menu(self.top, 'Using selected peaks in spectrum:', _spectrum_names)
        m1.frame.pack(side='top', anchor='w')
        
        self.spec_to = m2 = tkutil.option_menu(self.top, 'Assign peaks to GSSs in spectrum:', _spectrum_names)
        m2.frame.pack(side='top', anchor='w')
        
        _d3 = [1, 2, 3] # TODO do those values need to be strings?
        
        # matching dimension 1
        self.match1_from = m3 = tkutil.option_menu(self.top, 'Matching dimension 1: from:', _d3)
        m3.frame.pack(side='top', anchor='w')
        
        self.match1_to = m4 = tkutil.option_menu(self.top, 'Matching dimension 1: to:', _d3)
        m4.frame.pack(side='top', anchor='w')
        
        self.tol1 = tkutil.entry_field(self.top, 'Matching dimension 1: tolerance (PPM):', '0.2', 20)
        self.tol1.frame.pack(side = 'top', anchor = 'w')

        # matching dimension 2
        self.match2_from = tkutil.option_menu(self.top, 'Matching dimension 2: from:', _d3)
        self.match2_from.frame.pack(side='top', anchor='w')
        
        self.match2_to = tkutil.option_menu(self.top, 'Matching dimension 2: to:', _d3)
        self.match2_to.frame.pack(side='top', anchor='w')
        
        self.tol2 = tkutil.entry_field(self.top, 'Matching dimension 2: tolerance (PPM):', '0.2', 20)
        self.tol2.frame.pack(side = 'top', anchor = 'w')

        # TODO check that the nuclei match
        # TODO are 2 matching dimensions enough?
    
        br = tkutil.button_row(self.top,
                    ('Assign peaks', self.execute),
                    ('Close', self.close_cb),
                    )
        br.frame.pack(side = 'top', anchor = 'w')
コード例 #14
0
  def __init__(self, session):

    self.session = session
    self.pdb_path = None
    self.model = None
    self.pseudobond_group = None
    self.recenter_on_peak = 1
    self.chimera_atom_to_num_atom = {}
    self.num_atom_to_chimera_atom = {}
    self.chimera_atom_to_resonance = {}
    self.num_atom_pair_to_pseudobond = {}
    self.selected_atoms = []
    self.peak_selected_notice = None
    self.bond_selection_trigger = None
    self.chimera_quit_trigger = None
    self.chimera_running = 0

    tkutil.Dialog.__init__(self, session.tk, 'Chimera Model')

    self.pdb_file = tkutil.file_field(self.top, 'PDB File: ', 'pdb')
    self.pdb_file.frame.pack(side = 'top', anchor = 'w')

    colors = ('white', 'black', 'red', 'yellow',
              'green', 'cyan', 'blue', 'magenta')
    c = tkutil.option_menu(self.top, 'Color assigned atoms ',
                           colors, 'yellow')
    c.frame.pack(side = 'top', anchor = 'w')
    self.assigned_atom_color = c

    cb = tkutil.checkbutton(self.top,
                            'Selecting peak highlights assignment line?', 1)
    cb.button.pack(side = 'top', anchor = 'w')
    self.show_selected_peaks = cb

    cb = tkutil.checkbutton(self.top,
                            'Selecting assignment line recenters spectrum?', 1)
    cb.button.pack(side = 'top', anchor = 'w')
    self.show_selected_lines = cb

    cb = tkutil.checkbutton(self.top, 'Selecting atoms recenters spectrum?', 1)
    cb.button.pack(side = 'top', anchor = 'w')
    self.show_selected_atoms = cb

    c = tkutil.option_menu(self.top, 'Color lines for assignments ',
                           colors, 'blue')
    c.frame.pack(side = 'top', anchor = 'w')
    self.peak_line_color = c

    cb = tkutil.checkbutton(self.top, 'Show contraint violations?', 0)
    cb.button.pack(side = 'top', anchor = 'w')
    self.show_constraints = cb
    constraint_frame = Tkinter.Frame(self.top, borderwidth = 2,
                                     relief = 'sunken')
    cb.map_widget(constraint_frame)

    self.mardi_file = tkutil.file_field(constraint_frame,
					'Mardigras Constraint File: ',
					'mardigras')
    self.mardi_file.frame.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbuttons(constraint_frame, 'top', '',
                             'Show satisfied constraints?',
                             'Show violated constraints?')
    cb.frame.pack(side = 'top', anchor = 'w')
    self.show_satisfied, self.show_violated = cb.variables
    self.show_satisfied.set(0)

    color_frame = Tkinter.Frame(constraint_frame)
    color_frame.pack(side = 'top', anchor = 'w')
    h = Tkinter.Label(color_frame, text = 'Constraint line colors:')
    h.grid(row = 0, column = 0, columnspan = 2, sticky = 'w')

    self.constraint_colors = []
    row = 1
    for text, color in (('< 0.8 times lower bound', 'blue'),
                        ('0.8-1.0 times lower bound', 'cyan'),
                        ('satisfied constraint', 'green'),
                        ('1.0-1.2 times upper bound', 'magenta'),
                        ('> 1.2 times upper bound', 'red')):
      c = tkutil.option_menu(color_frame, '', colors, color)
      c.frame.grid(row = row, column = 0, sticky = 'e', padx = 10)
      label = Tkinter.Label(color_frame, text = text)
      label.grid(row = row, column = 1, sticky = 'w')
      row = row + 1
      self.constraint_colors.append(c)
    
    self.status_line = Tkinter.Label(self.top, anchor = 'nw',
                                     wraplength = '15c', justify = 'left')
    self.status_line.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Show', self.show_cb),
                           ('Erase', self.erase_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'Chimera')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
コード例 #15
0
    def __init__(self, session):

        self.session = session
        self.pdb_path = None
        self.model = None
        self.pseudobond_group = None
        self.recenter_on_peak = 1
        self.chimera_atom_to_num_atom = {}
        self.num_atom_to_chimera_atom = {}
        self.chimera_atom_to_resonance = {}
        self.num_atom_pair_to_pseudobond = {}
        self.selected_atoms = []
        self.peak_selected_notice = None
        self.bond_selection_trigger = None
        self.chimera_quit_trigger = None
        self.chimera_running = 0

        tkutil.Dialog.__init__(self, session.tk, 'Chimera Model')

        self.pdb_file = tkutil.file_field(self.top, 'PDB File: ', 'pdb')
        self.pdb_file.frame.pack(side='top', anchor='w')

        colors = ('white', 'black', 'red', 'yellow', 'green', 'cyan', 'blue',
                  'magenta')
        c = tkutil.option_menu(self.top, 'Color assigned atoms ', colors,
                               'yellow')
        c.frame.pack(side='top', anchor='w')
        self.assigned_atom_color = c

        cb = tkutil.checkbutton(self.top,
                                'Selecting peak highlights assignment line?',
                                1)
        cb.button.pack(side='top', anchor='w')
        self.show_selected_peaks = cb

        cb = tkutil.checkbutton(
            self.top, 'Selecting assignment line recenters spectrum?', 1)
        cb.button.pack(side='top', anchor='w')
        self.show_selected_lines = cb

        cb = tkutil.checkbutton(self.top,
                                'Selecting atoms recenters spectrum?', 1)
        cb.button.pack(side='top', anchor='w')
        self.show_selected_atoms = cb

        c = tkutil.option_menu(self.top, 'Color lines for assignments ',
                               colors, 'blue')
        c.frame.pack(side='top', anchor='w')
        self.peak_line_color = c

        cb = tkutil.checkbutton(self.top, 'Show contraint violations?', 0)
        cb.button.pack(side='top', anchor='w')
        self.show_constraints = cb
        constraint_frame = Tkinter.Frame(self.top,
                                         borderwidth=2,
                                         relief='sunken')
        cb.map_widget(constraint_frame)

        self.mardi_file = tkutil.file_field(constraint_frame,
                                            'Mardigras Constraint File: ',
                                            'mardigras')
        self.mardi_file.frame.pack(side='top', anchor='w')

        cb = tkutil.checkbuttons(constraint_frame, 'top', '',
                                 'Show satisfied constraints?',
                                 'Show violated constraints?')
        cb.frame.pack(side='top', anchor='w')
        self.show_satisfied, self.show_violated = cb.variables
        self.show_satisfied.set(0)

        color_frame = Tkinter.Frame(constraint_frame)
        color_frame.pack(side='top', anchor='w')
        h = Tkinter.Label(color_frame, text='Constraint line colors:')
        h.grid(row=0, column=0, columnspan=2, sticky='w')

        self.constraint_colors = []
        row = 1
        for text, color in (('< 0.8 times lower bound',
                             'blue'), ('0.8-1.0 times lower bound', 'cyan'),
                            ('satisfied constraint', 'green'),
                            ('1.0-1.2 times upper bound',
                             'magenta'), ('> 1.2 times upper bound', 'red')):
            c = tkutil.option_menu(color_frame, '', colors, color)
            c.frame.grid(row=row, column=0, sticky='e', padx=10)
            label = Tkinter.Label(color_frame, text=text)
            label.grid(row=row, column=1, sticky='w')
            row = row + 1
            self.constraint_colors.append(c)

        self.status_line = Tkinter.Label(self.top,
                                         anchor='nw',
                                         wraplength='15c',
                                         justify='left')
        self.status_line.pack(side='top', anchor='w')

        br = tkutil.button_row(
            self.top,
            ('Show', self.show_cb),
            ('Erase', self.erase_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'Chimera')),
        )
        br.frame.pack(side='top', anchor='w')
コード例 #16
0
    def __init__(self, session):
        self.g = GitRepo(model.project().sparky_directory)

        self.session = session
        self.title = 'Reproducibility'

        tkutil.Dialog.__init__(self, session.tk, self.title)

        br = tkutil.button_row(self.top, ('Make snapshot', self.make_snapshot))
        br.frame.pack(side='top', anchor='w')
        # TODO would like to get an enumerated list of these from somewhere
        e = tkutil.entry_field(self.top, 'Deductive reason used:',
                               '<enter reason>', 50)
        e.frame.pack(side='top', anchor='w')
        self.message = e.variable

        br2 = tkutil.button_row(
            self.top, ('Set groups of selected peaks', self.set_group))
        br2.frame.pack(side='top', anchor='w')
        e2 = tkutil.entry_field(self.top, 'Group name:', '', 20,
                                '(leave blank for name to be autogenerated)')
        e2.frame.pack(side='top', anchor='w')
        self.group = e2.variable

        br4 = tkutil.button_row(
            self.top, ('Create new group for peak', self.create_new_group))
        br4.frame.pack(side='top', anchor='w')

        br5 = tkutil.button_row(
            self.top, ('Set selected peaks to noise', self.set_noise))
        br5.frame.pack(side='top', anchor='w')

        br6 = tkutil.button_row(
            self.top, ('Set selected peaks to artifact', self.set_artifact))
        br6.frame.pack(side='top', anchor='w')

        self.peaktype_spectrum = m1 = tkutil.option_menu(
            self.top, 'Select peaktype spectrum', peaktypes.spectra.keys())
        m1.frame.pack(side='top', anchor='w')
        m1.add_callback(self.set_peaktype_spectrum)

        self.peaktype_dim_order = m3 = tkutil.option_menu(
            self.top, 'Peaktype dimension order', [])
        self.dim_order = ','.join(map(str, peaktypes.orders[1][0]))
        m3.frame.pack(side='top', anchor='w')
        m3.add_callback(self.set_peaktype_dim_order)

        self.peaktype = m2 = tkutil.option_menu(self.top, 'Assign peaktype',
                                                [])
        m2.frame.pack(side='top', anchor='w')
        m2.add_callback(self.assign_peaktype)

        _spectrum_names = [sp.name for sp in model.spectra()]
        self.select_signal_peaks_menu = m4 = tkutil.option_menu(
            self.top, 'Select signal peaks', _spectrum_names)
        m4.frame.pack(side='top', anchor='w')
        m4.add_callback(self.select_signal_peaks)

        self.changed_callback = model.session().notify_me(
            'selection changed', self.selection_changed)

        br = tkutil.button_row(
            self.top,
            ('Open peak-GSS dialog', self.peaks_to_gss),
            ('Close', self.close_cb),
        )
        br.frame.pack(side='top', anchor='w')
コード例 #17
0
    def __init__(self, session):

        self.session = session
        self.selection_notice = None

        tkutil.Dialog.__init__(self, session.tk, 'Assignment Distances')

        self.top.bind('<Destroy>', self.window_destroyed_cb, 1)

        self.pdb_paths = tkutil.file_choices(self.top, 'PDB files: ', 'pdb')
        self.pdb_paths.frame.pack(side='top', anchor='w', fill='x')

        self.spectrum_choice = sputil.spectrum_menu(session, self.top,
                                                    'Spectrum: ')
        self.spectrum_choice.frame.pack(side='top', anchor='w')
        self.spectrum_choice.add_callback(self.spectrum_cb)

        er = tkutil.entry_row(self.top, 'PPM tolerance: ', ('w1', '.01', 4),
                              ('w2', '.01', 4), ('w3', '.01', 4))
        self.ppm_range = er.variables
        self.w3_range_widget = er.entries[2].frame
        er.frame.pack(side='top', anchor='w')

        self.line_format = '%15s %s %7s %s'

        self.spectrum_cb(self.spectrum_choice.get())

        e = tkutil.entry_field(self.top, 'Max atom distance: ', '', 5)
        self.max_dist = e.variable
        e.frame.pack(side='top', anchor='w')

        tchoices = ('Assignments with far atoms',
                    'Peaks with multiple assignments',
                    'Close atoms with no peak',
                    'Assignments for unassigned peaks', 'Unassignable peaks',
                    'Assignments for selected peaks')
        initial = tchoices[5]
        self.show_type = tkutil.option_menu(self.top, 'Show: ', tchoices,
                                            initial)
        self.show_type.frame.pack(side='top', anchor='w')

        dchoices = ('shortest', 'all', 'min, ave, max')
        self.show_dist = tkutil.option_menu(self.top, 'Show model distances: ',
                                            dchoices)
        self.show_dist.frame.pack(side='top', anchor='w')

        pl = tkutil.scrolling_list(self.top, '', 5)
        pl.frame.pack(side='top', fill='both', expand=1)
        pl.listbox.bind('<ButtonRelease-1>', self.select_peak_or_assignment_cb)
        pl.listbox.bind('<ButtonRelease-2>', self.goto_peak_or_assignment_cb)
        pl.listbox.bind('<Double-ButtonRelease-1>',
                        self.goto_peak_or_assignment_cb)
        self.peak_list = pl

        progress_label = Tkinter.Label(self.top, anchor='nw')
        progress_label.pack(side='top', anchor='nw')

        br = tkutil.button_row(
            self.top,
            ('Update', self.update_cb),
            ('Save', self.peak_list.save_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'AssignmentDistance')),
        )
        br.frame.pack(side='top', anchor='w')

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])

        self.settings = self.get_settings()
コード例 #18
0
ファイル: distance.py プロジェクト: CONNJUR/SparkyExtensions
  def __init__(self, session):

    self.session = session
    self.selection_notice = None

    tkutil.Dialog.__init__(self, session.tk, 'Assignment Distances')

    self.top.bind('<Destroy>', self.window_destroyed_cb, 1)

    self.pdb_paths = tkutil.file_choices(self.top, 'PDB files: ', 'pdb')
    self.pdb_paths.frame.pack(side = 'top', anchor = 'w', fill = 'x')

    self.spectrum_choice = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    self.spectrum_choice.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_choice.add_callback(self.spectrum_cb)

    er = tkutil.entry_row(self.top, 'PPM tolerance: ',
		       ('w1', '.01', 4), ('w2', '.01', 4), ('w3', '.01', 4))
    self.ppm_range = er.variables
    self.w3_range_widget = er.entries[2].frame
    er.frame.pack(side = 'top', anchor = 'w')

    self.line_format = '%15s %s %7s %s'

    self.spectrum_cb(self.spectrum_choice.get())

    e = tkutil.entry_field(self.top, 'Max atom distance: ', '', 5)
    self.max_dist = e.variable
    e.frame.pack(side = 'top', anchor = 'w')

    tchoices = ('Assignments with far atoms',
	       'Peaks with multiple assignments',
	       'Close atoms with no peak',
	       'Assignments for unassigned peaks',
	       'Unassignable peaks',
	       'Assignments for selected peaks')
    initial = tchoices[5]
    self.show_type = tkutil.option_menu(self.top, 'Show: ', tchoices, initial)
    self.show_type.frame.pack(side = 'top', anchor = 'w')

    dchoices = ('shortest', 'all', 'min, ave, max')
    self.show_dist = tkutil.option_menu(self.top, 'Show model distances: ', dchoices)
    self.show_dist.frame.pack(side = 'top', anchor = 'w')

    pl = tkutil.scrolling_list(self.top, '', 5)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-1>', self.select_peak_or_assignment_cb)
    pl.listbox.bind('<ButtonRelease-2>', self.goto_peak_or_assignment_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>',
                    self.goto_peak_or_assignment_cb)
    self.peak_list = pl

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'nw')

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Save', self.peak_list.save_cb),
			   ('Stop', self.stop_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session,
                                                   'AssignmentDistance')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])

    self.settings = self.get_settings()