Beispiel #1
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, 'Group editor -- ???')
     
     e1 = tkutil.entry_field(self.top, 'GSS type:', '', 20)
     e1.frame.pack(side='top', anchor='w')
     self.aatype = e1.variable
 
     e2 = tkutil.entry_field(self.top, 'Next GSS:', '', 20)
     e2.frame.pack(side='top', anchor='w')
     self.next_ = e2.variable
 
     e3 = tkutil.entry_field(self.top, 'Residue:', '', 20)
     e3.frame.pack(side='top', anchor='w')
     self.residue = e3.variable
 
     br = tkutil.button_row(self.top,
                 ('Apply', self.update),
                 ('Merge resonances', self.merge_resonances),
                 ('Close', self.close_cb),
                 )
     br.frame.pack(side = 'top', anchor = 'w')
    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, 'Group editor -- ???')

        e1 = tkutil.entry_field(self.top, 'GSS type:', '', 20)
        e1.frame.pack(side='top', anchor='w')
        self.aatype = e1.variable

        e2 = tkutil.entry_field(self.top, 'Next GSS:', '', 20)
        e2.frame.pack(side='top', anchor='w')
        self.next_ = e2.variable

        e3 = tkutil.entry_field(self.top, 'Residue:', '', 20)
        e3.frame.pack(side='top', anchor='w')
        self.residue = e3.variable

        br = tkutil.button_row(
            self.top,
            ('Apply', self.update),
            ('Merge resonances', self.merge_resonances),
            ('Close', self.close_cb),
        )
        br.frame.pack(side='top', anchor='w')
Beispiel #3
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()
Beispiel #4
0
    def __init__(self, session):

        self.session = session

        tkutil.Dialog.__init__(self, session.tk, 'Peak Linewidth Plot')

        self.top.columnconfigure(0, weight=1)
        r = 0

        sw = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
        sw.frame.grid(row=r, sticky='w')
        r = r + 1
        self.spectrum_widget = sw

        af = tkutil.entry_field(self.top, 'Spectrum axis: ', '1', 3)
        af.frame.grid(row=r, sticky='w')
        r = r + 1
        self.axis_variable = af.variable

        self.lw_ranges = [None, None]
        er = tkutil.entry_row(self.top, 'Linewidth range (hz): ',
                              ('min', '0', 3), ('max', '50', 3),
                              ('step', '5', 3))
        (self.lw_ranges[0], self.lw_ranges[1], self.lw_step) = er.variables
        er.frame.grid(row=r, sticky='w')
        r = r + 1

        e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
        self.atoms = e.variable
        e.frame.grid(row=r, sticky='w')
        r = r + 1

        c = tkutil.scrollable_canvas(self.top)
        c.frame.grid(row=r, sticky='news')
        self.top.rowconfigure(r, weight=1)
        r = r + 1
        self.canvas = c.canvas

        progress_label = Tkinter.Label(self.top, anchor='nw')
        progress_label.grid(row=r, sticky='w')
        r = r + 1

        postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
        br = tkutil.button_row(
            self.top,
            ('Update', self.update_cb),
            ('Postscript', postscript_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'LinewidthPlot')),
        )
        br.frame.grid(row=r, sticky='w')
        r = r + 1

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Beispiel #5
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')
Beispiel #6
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')
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Peak Linewidth Plot')

    self.top.columnconfigure(0, weight = 1)
    r = 0
    
    sw = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sw.frame.grid(row = r, sticky = 'w')
    r = r + 1
    self.spectrum_widget = sw
    
    af = tkutil.entry_field(self.top, 'Spectrum axis: ', '1', 3)
    af.frame.grid(row = r, sticky = 'w')
    r = r + 1
    self.axis_variable = af.variable
    
    self.lw_ranges = [None, None]
    er = tkutil.entry_row(self.top, 'Linewidth range (hz): ',
                          ('min', '0', 3), ('max', '50', 3), ('step', '5', 3))
    (self.lw_ranges[0], self.lw_ranges[1], self.lw_step) = er.variables
    er.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
    self.atoms = e.variable
    e.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    c = tkutil.scrollable_canvas(self.top)
    c.frame.grid(row = r, sticky = 'news')
    self.top.rowconfigure(r, weight = 1)
    r = r + 1
    self.canvas = c.canvas

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.grid(row = r, sticky = 'w')
    r = r + 1
    
    postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Postscript', postscript_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'LinewidthPlot')),
			   )
    br.frame.grid(row = r, sticky = 'w')
    r = r + 1

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Beispiel #8
0
  def __init__(self, session):
    
    tkutil.Settings_Dialog.__init__(self, session.tk,
                                    'Strip Matching Parameters')

    t = tkutil.entry_row(self.top, 'Tolerances ',
                         (' 1H', '.02', 5),
                         (' 13C', '.2', 5),
                         (' 15N', '.2', 5))
    t.frame.pack(side = 'top', anchor = 'w')
    self.tolerances = {'1H': t.variables[0],
                       '13C': t.variables[1],
                       '15N': t.variables[2]}

    e = tkutil.entry_field(self.top, 'Allow ', '0', 3, ' unmatched peaks')
    e.frame.pack(side = 'top', anchor = 'w')
    self.max_unmatched = e.variable
    
    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),                           
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'StripPlot')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Beispiel #9
0
  def __init__(self, session):

    tkutil.Settings_Dialog.__init__(self, session.tk, 'Relaxation Spectra')

    headings = ('Spectrum  ', 'Time parameter')
    st = sputil.spectrum_table(session, self.top, headings,
                               self.add_spectrum, self.remove_spectrum)
    st.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_widgets = {}

    spectra = session.project.spectrum_list()
    def time_param(s, self=self):
      return pyutil.string_to_float(self.default_time_parameter(s), 0)
    spectra = pyutil.sort_by_function_value(spectra, time_param)
    for spectrum in spectra:
      st.add_spectrum(spectrum)

    e = tkutil.entry_field(self.top, 'Use ', '5', 3,
                           ' random trials for error estimates.')
    e.frame.pack(side = 'top', anchor = 'w')
    self.trials = e
    
    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
                           ('Apply', self.apply_cb),                           
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'RelaxFit')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Beispiel #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')
    def __init__(self, session):

        self.session = session
        tkutil.Dialog.__init__(self, session.tk, 'Chemical Shift Plot')

        self.top.columnconfigure(0, weight=1)
        r = 0

        self.condition_widget = sputil.condition_menu(session, self.top,
                                                      'Condition: ')
        self.condition_widget.frame.grid(row=r, sticky='w')
        r = r + 1

        self.ppm_range_widget = [None, None]
        er = tkutil.entry_row(self.top, 'PPM range: ', ('min', '0', 3),
                              ('max', '12', 3), ('step', '1', 3))
        (self.ppm_range_widget[0], self.ppm_range_widget[1],
         self.ppm_step_widget) = er.variables
        er.frame.grid(row=r, sticky='w')
        r = r + 1

        e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
        self.atoms = e.variable
        e.frame.grid(row=r, sticky='w')
        r = r + 1

        t = tkutil.checkbutton(self.top, 'Show typical amino acid shifts?', 0)
        self.typical_range = t.variable
        t.button.grid(row=r, sticky='w')
        r = r + 1

        c = tkutil.scrollable_canvas(self.top)
        c.frame.grid(row=r, sticky='news')
        self.top.rowconfigure(r, weight=1)
        r = r + 1
        self.canvas = c.canvas

        progress_label = Tkinter.Label(self.top, anchor='nw')
        progress_label.grid(row=r, sticky='w')
        r = r + 1

        postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
        br = tkutil.button_row(
            self.top,
            ('Update', self.update_cb),
            ('Postscript', postscript_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'ChemShiftPlot')),
        )
        br.frame.grid(row=r, sticky='w')
        r = r + 1

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Beispiel #12
0
  def __init__(self, session):

    tkutil.Settings_Dialog.__init__(self, session.tk, 'Show Peak Strips')

    sw = tkutil.entry_field(self.top, 'Strip width (screen pixels): ', '', 4)
    sw.frame.pack(side = 'top', anchor = 'w')
    self.strip_width = sw.variable

    gp = tkutil.entry_field(self.top, 'Gap between strips (screen pixels): ',
                            '', 4)
    gp.frame.pack(side = 'top', anchor = 'w')
    self.strip_gap = gp.variable

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),
			   ('Close', self.close_cb),                           
                           ('Help', sputil.help_cb(session, 'StripPlot')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Beispiel #13
0
  def add_spectrum(self, spectrum, table, row):

    onoff = self.default_onoff(spectrum)
    b = tkutil.checkbutton(table.frame, spectrum.name, onoff)
    b.button.grid(row = row, column = 0, sticky = 'nw')

    ttext = self.default_time_parameter(spectrum)
    e = tkutil.entry_field(table.frame, '', ttext)
    e.frame.grid(row = row, column = 1, sticky = 'nw')

    self.spectrum_widgets[spectrum] = (b, e)
Beispiel #14
0
  def __init__(self, session):

    self.session = session
    tkutil.Dialog.__init__(self, session.tk, 'Chemical Shift Plot')

    self.top.columnconfigure(0, weight = 1)
    r = 0
    
    self.condition_widget = sputil.condition_menu(session, self.top, 'Condition: ')
    self.condition_widget.frame.grid(row = r, sticky = 'w')
    r = r + 1

    self.ppm_range_widget = [None, None]
    er = tkutil.entry_row(self.top, 'PPM range: ',
                          ('min', '0', 3), ('max', '12', 3), ('step', '1', 3))
    (self.ppm_range_widget[0],
     self.ppm_range_widget[1],
     self.ppm_step_widget) = er.variables
    er.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
    self.atoms = e.variable
    e.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    t = tkutil.checkbutton(self.top, 'Show typical amino acid shifts?', 0)
    self.typical_range = t.variable
    t.button.grid(row = r, sticky = 'w')
    r = r + 1
    
    c = tkutil.scrollable_canvas(self.top)
    c.frame.grid(row = r, sticky = 'news')
    self.top.rowconfigure(r, weight = 1)
    r = r + 1
    self.canvas = c.canvas

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.grid(row = r, sticky = 'w')
    r = r + 1
    
    postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Postscript', postscript_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'ChemShiftPlot')),
			   )
    br.frame.grid(row = r, sticky = 'w')
    r = r + 1

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
  def __init__(self, session):
  
    tkutil.Settings_Dialog.__init__(self, session.tk, 'AutoAssign Details')

    se = tkutil.checkbutton(self.top,
                            'Use an already running AutoAssign server?', 0)
    se.button.pack(side = 'top', anchor = 'w')
    self.server_exists = se.variable

    hp = tkutil.entry_row(self.top, 'Server on',
                          ('host ', '', 25),
                          (' port ', '', 5),
                          )
    hp.frame.pack(side = 'top', anchor = 'w')
    self.server_host, self.server_port = hp.variables

    sl = tkutil.entry_field(self.top,
			    'Sleep time after server startup (seconds): ',
                            initial = 1, width = 3)
    sl.frame.pack(side = 'top', anchor = 'w')
    self.server_lag = sl.variable

    sp = tkutil.entry_field(self.top, 'Server program ', '', width = 25)
    sp.frame.pack(side = 'top', anchor = 'w')
    self.server_executable = sp.variable

    cp = tkutil.entry_field(self.top, 'Client program ', '', width = 25)
    cp.frame.pack(side = 'top', anchor = 'w')
    self.client_executable = cp.variable

    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
                           ('Apply', self.apply_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'AutoAssign')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Beispiel #16
0
 def __init__(self, session, gid=None, rid=None, group_editor=None):
     self.gid = gid
     self.rid = rid
     self.group_editor = group_editor
     
     tkutil.Dialog.__init__(self, session.tk, 'Resonance editor --- ???')
     
     e1 = tkutil.entry_field(self.top, 'Atom type:', '', 20)
     e1.frame.pack(side='top', anchor='w')
     self.atomtype = e1.variable
 
     br = tkutil.button_row(self.top,
                 ('Apply', self.update),
                 ('Close', self.close_cb),
                 )
     br.frame.pack(side = 'top', anchor = 'w')
Beispiel #17
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'MARDIGRAS Format')

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

    pl = sputil.peak_listbox(self.top)
    pl.frame.pack(fill = 'both', expand = 1)
    pl.heading['text'] = 'Peak list'
    pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
    pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
    self.peak_list = pl

    ib = tkutil.checkbutton(self.top, 'Include unintegrated peaks?', 0)
    ib.button.pack(side = 'top', anchor = 'w')
    self.unintegrated = ib

    nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
    nb.button.pack(side = 'top', anchor = 'w')
    self.note = nb

    eh = Tkinter.Label(self.top, text = 'Omit peak if note has a word from:')
    eh.pack(side = 'top', anchor = 'w')
    ef = tkutil.entry_field(self.top, '  ', width = 30)
    ef.frame.pack(side = 'top', anchor = 'w')
    self.note_words = ef
    et = Tkinter.Label(self.top, text = '(space separated list of words)')
    et.pack(side = 'top', anchor = 'w')
    
    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),
                           ('Write Peaks', self.save_peaks_cb),
                           ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session,
                                                   'MardigrasFormat')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Beispiel #18
0
    def __init__(self, session, gid=None, rid=None, group_editor=None):
        self.gid = gid
        self.rid = rid
        self.group_editor = group_editor

        tkutil.Dialog.__init__(self, session.tk, 'Resonance editor --- ???')

        e1 = tkutil.entry_field(self.top, 'Atom type:', '', 20)
        e1.frame.pack(side='top', anchor='w')
        self.atomtype = e1.variable

        br = tkutil.button_row(
            self.top,
            ('Apply', self.update),
            ('Close', self.close_cb),
        )
        br.frame.pack(side='top', anchor='w')
    def __init__(self, session):

        tkutil.Dialog.__init__(self, session.tk, 'MARDIGRAS Format')

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

        pl = sputil.peak_listbox(self.top)
        pl.frame.pack(fill='both', expand=1)
        pl.heading['text'] = 'Peak list'
        pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
        pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
        pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
        self.peak_list = pl

        ib = tkutil.checkbutton(self.top, 'Include unintegrated peaks?', 0)
        ib.button.pack(side='top', anchor='w')
        self.unintegrated = ib

        nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
        nb.button.pack(side='top', anchor='w')
        self.note = nb

        eh = Tkinter.Label(self.top, text='Omit peak if note has a word from:')
        eh.pack(side='top', anchor='w')
        ef = tkutil.entry_field(self.top, '  ', width=30)
        ef.frame.pack(side='top', anchor='w')
        self.note_words = ef
        et = Tkinter.Label(self.top, text='(space separated list of words)')
        et.pack(side='top', anchor='w')

        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),
            ('Write Peaks', self.save_peaks_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'MardigrasFormat')),
        )
        br.frame.pack(side='top', anchor='w')

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Beispiel #20
0
  def sequence_entry(self, parent):

    f = Tkinter.Frame(parent)

    h = Tkinter.Label(f, text = 'Sequence')
    h.pack(side = 'top', anchor = 'w')
    self.header = h
    
    t = tkutil.scrolling_text(f)
    t.text['wrap'] = 'char'
    t.frame.pack(side = 'top', fill = 'x', expand = 1)
    self.sequence_text = t

    ff = tkutil.file_field(f, 'Sequence File', 'sequence')
    ff.frame.pack(side = 'top', anchor = 'w')
    self.file_field = ff

    fr = tkutil.entry_field(f, 'First residue number', '1')
    fr.frame.pack(side = 'top', anchor = 'w')
    self.first_residue = fr

    return f
    def setup_axis_table(self):

        for w in self.axis_table.grid_slaves():
            w.destroy()

        ref_spectrum = self.ref_menu.spectrum()
        pick_view = self.pick_menu.view()
        if ref_spectrum == None or pick_view == None:
            return

        heading = ('\nAxis match tolerances (ppm)\n%s \ %s' %
                   (ref_spectrum.name, pick_view.name))
        self.axis_table_heading['text'] = heading

        column = 1
        pick_nuclei = pick_view.spectrum.nuclei
        for nucleus in pick_nuclei:
            lbl = Tkinter.Label(self.axis_table, text=nucleus)
            lbl.grid(row=1, column=column)
            column = column + 1

        row = 2
        ref_nuclei = ref_spectrum.nuclei
        for nucleus in ref_nuclei:
            lbl = Tkinter.Label(self.axis_table, text=nucleus)
            lbl.grid(row=row, column=0, sticky='w')
            row = row + 1

        self.range_entries = []
        for r in range(len(ref_nuclei)):
            for p in range(len(pick_nuclei)):
                if ref_nuclei[r] == pick_nuclei[p]:
                    if ref_nuclei[r] == '1H':
                        rtext = '.02'
                    else:
                        rtext = '.2'
                    e = tkutil.entry_field(self.axis_table, '', rtext, 4)
                    e.frame.grid(row=r + 2, column=p + 1, sticky='w')
                    self.range_entries.append((r, p, e))
  def setup_axis_table(self):

    for w in self.axis_table.grid_slaves():
      w.destroy()

    ref_spectrum = self.ref_menu.spectrum()
    pick_view = self.pick_menu.view()
    if ref_spectrum == None or pick_view == None:
      return

    heading = ('\nAxis match tolerances (ppm)\n%s \ %s' % (ref_spectrum.name,
                                                           pick_view.name))
    self.axis_table_heading['text'] = heading

    column = 1
    pick_nuclei = pick_view.spectrum.nuclei
    for nucleus in pick_nuclei:
      lbl= Tkinter.Label(self.axis_table, text = nucleus)
      lbl.grid(row = 1, column = column)
      column = column + 1
    
    row = 2
    ref_nuclei = ref_spectrum.nuclei
    for nucleus in ref_nuclei:
      lbl= Tkinter.Label(self.axis_table, text = nucleus)
      lbl.grid(row = row, column = 0, sticky = 'w')
      row = row + 1

    self.range_entries = []
    for r in range(len(ref_nuclei)):
      for p in range(len(pick_nuclei)):
        if ref_nuclei[r] == pick_nuclei[p]:
          if ref_nuclei[r] == '1H':
            rtext = '.02'
          else:
            rtext = '.2'
          e = tkutil.entry_field(self.axis_table, '', rtext, 4)
          e.frame.grid(row = r + 2, column = p + 1, sticky = 'w')
          self.range_entries.append((r,p,e))
  def spectrum_choice_table(self, parent):

    f = Tkinter.Frame(parent, borderwidth = 5)

    self.type_to_spectrum_menu = {}
    self.type_to_phase = {}

    count = 0
    entries_per_column = 5
    row = 1
    column = 0
    for type in spectrum_types:

      column = 4 * (count / entries_per_column)
      row = 1 + (count % entries_per_column)
      
      if row == 1:
        lbl = Tkinter.Label(f, text = '  ')
        lbl.grid(row = 0, column = column)
        lbl = Tkinter.Label(f, text = 'Spectrum')
        lbl.grid(row = 0, column = column + 2)
        lbl = Tkinter.Label(f, text = 'Phase')
        lbl.grid(row = 0, column = column + 3)

      lbl = Tkinter.Label(f, text = type)
      lbl.grid(row = row, column = column + 1, sticky = 'w')

      m = sputil.spectrum_menu(self.sparky_session, f, '', allow_no_choice = 1)
      m.frame.grid(row = row, column = column + 2, sticky = 'w')
      self.type_to_spectrum_menu[type] = m

      p = tkutil.entry_field(f, '', width = 6)
      p.frame.grid(row = row, column = column + 3, sticky = 'w')
      self.type_to_phase[type] = p.variable
      
      count = count + 1

    return f
Beispiel #24
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'DYANA / XEASY Format')

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

    sl = tkutil.scrolling_list(self.top, 'Chemical shift list', 5)
    sl.frame.pack(fill = 'both', expand = 1)
    sl.listbox.bind('<ButtonRelease-1>', self.resonance_cb)
    self.shift_list = sl

    pl = sputil.peak_listbox(self.top)
    pl.frame.pack(fill = 'both', expand = 1)
    pl.heading['text'] = 'Peak list'
    pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
    pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
    self.peak_list = pl

    cy = tkutil.checkbutton(self.top, 'Cyana Formatting ?', 0)
    cy.button.pack(side = 'top', anchor = 'w')
    self.cyana = cy

    hb = tkutil.checkbutton(self.top,
                            'Show peak heights instead of volumes?', 0)
    hb.button.pack(side = 'top', anchor = 'w')
    self.heights = hb

    ib = tkutil.checkbutton(self.top, 'Include unintegrated peaks?', 0)
    ib.button.pack(side = 'top', anchor = 'w')
    self.unintegrated = ib

    ab = tkutil.checkbutton(self.top, 'Include unassigned peaks?', 0)
    ab.button.pack(side = 'top', anchor = 'w')
    self.unassigned = ab

    mb = tkutil.checkbutton(self.top,
                            'Include assignments without a residue number?', 0)
    mb.button.pack(side = 'top', anchor = 'w')
    self.unnumbered = mb

    nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
    nb.button.pack(side = 'top', anchor = 'w')
    self.note = nb

    eh = Tkinter.Label(self.top, text = 'Omit peak if note has a word from:')
    eh.pack(side = 'top', anchor = 'w')
    ef = tkutil.entry_field(self.top, '  ', width = 30)
    ef.frame.pack(side = 'top', anchor = 'w')
    self.note_words = ef
    et = Tkinter.Label(self.top, text = '(space separated list of words)')
    et.pack(side = 'top', anchor = 'w')
    
    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),
			   ('Write Shifts', self.save_shifts_cb),
                           ('Write Peaks', self.save_peaks_cb),
                           ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'XEASYFormat')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])
Beispiel #25
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'Set Volume Errors')

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

    f = Tkinter.Frame(self.top)
    f.pack(side = 'top', anchor = 'w')

    r = 0

    w = Tkinter.Label(f, text = 'Error (%)')
    w.grid(row = r, column = 1)
    r = r + 1

    cb = tkutil.checkbutton(f, 'Default fit', 1)
    self.fit_default = cb.variable
    cb.button.grid(row = r, column = 0, sticky = 'w')
    e = tkutil.entry_field(f, '', '10', 4)
    self.fit_default_error = e.variable
    e.frame.grid(row = r, column = 1)
    r = r + 1

    cb = tkutil.checkbutton(f, 'Default box / ellipse', 1)
    self.box_default = cb.variable
    cb.button.grid(row = r, column = 0, sticky = 'w')
    e = tkutil.entry_field(f, '', '20', 4)
    self.box_default_error = e.variable
    e.frame.grid(row = r, column = 1)
    r = r + 1

    cb = tkutil.checkbutton(f, 'Near diagonal', 0)
    self.near_diagonal = cb.variable
    cb.button.grid(row = r, column = 0, sticky = 'w')
    e = tkutil.entry_field(f, '', '20', 4)
    self.near_diagonal_error = e.variable
    e.frame.grid(row = r, column = 1)
    tkutil.grid_labels(f, ('Range (ppm)', r, 2))
    e = tkutil.entry_field(f, '|w1-w2| ', '.1', 4)
    self.near_diagonal_range = e.variable
    e.frame.grid(row = r+1, column = 2)
    r = r + 2

    cb = tkutil.checkbutton(f, 'Near other peaks', 0)
    self.nearby_peaks = cb.variable
    cb.button.grid(row = r, column = 0, sticky = 'w')
    tkutil.grid_labels(f,
                       ('Relative volume', r+1, 0),
                       ('< .5', r+2, 0),
                       ('.5 - 2', r+3, 0),
                       ('> 2', r+4, 0),
                       ('unintegrated', r+5, 0))
    self.nearby_error = {}
    (self.nearby_error['< .5'],
     self.nearby_error['.5 - 2'],
     self.nearby_error['> 2'],
     self.nearby_error['unintegrated']
     ) = tkutil.grid_entries(f, 4,
                             ('5', r+2, 1),
                             ('10', r+3, 1),
                             ('20', r+4, 1),
                             ('20', r+5, 1))
    self.nearby_range = {}
    tkutil.grid_labels(f, ('Range (ppm)', r+1, 2))
    e = tkutil.entry_field(f, 'w1 ', '.05', 4)
    self.nearby_range['w1 range'] = e.variable
    e.frame.grid(row = r+2, column = 2)
    e = tkutil.entry_field(f, 'w2 ', '.05', 4)
    self.nearby_range['w2 range'] = e.variable
    e.frame.grid(row = r+3, column = 2)
    r = r + 6

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

    br = tkutil.button_row(self.top,
			   ('Set Volume Errors', self.update_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'VolumeErrors')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
Beispiel #26
0
    def __init__(self, session):

        self.session = session

        tkutil.Dialog.__init__(self, session.tk, 'DYANA / XEASY Format')

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

        sl = tkutil.scrolling_list(self.top, 'Chemical shift list', 5)
        sl.frame.pack(fill='both', expand=1)
        sl.listbox.bind('<ButtonRelease-1>', self.resonance_cb)
        self.shift_list = sl

        pl = sputil.peak_listbox(self.top)
        pl.frame.pack(fill='both', expand=1)
        pl.heading['text'] = 'Peak list'
        pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
        pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
        pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
        self.peak_list = pl

        cy = tkutil.checkbutton(self.top, 'Cyana Formatting ?', 0)
        cy.button.pack(side='top', anchor='w')
        self.cyana = cy

        hb = tkutil.checkbutton(self.top,
                                'Show peak heights instead of volumes?', 0)
        hb.button.pack(side='top', anchor='w')
        self.heights = hb

        ib = tkutil.checkbutton(self.top, 'Include unintegrated peaks?', 0)
        ib.button.pack(side='top', anchor='w')
        self.unintegrated = ib

        ab = tkutil.checkbutton(self.top, 'Include unassigned peaks?', 0)
        ab.button.pack(side='top', anchor='w')
        self.unassigned = ab

        mb = tkutil.checkbutton(
            self.top, 'Include assignments without a residue number?', 0)
        mb.button.pack(side='top', anchor='w')
        self.unnumbered = mb

        nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
        nb.button.pack(side='top', anchor='w')
        self.note = nb

        eh = Tkinter.Label(self.top, text='Omit peak if note has a word from:')
        eh.pack(side='top', anchor='w')
        ef = tkutil.entry_field(self.top, '  ', width=30)
        ef.frame.pack(side='top', anchor='w')
        self.note_words = ef
        et = Tkinter.Label(self.top, text='(space separated list of words)')
        et.pack(side='top', anchor='w')

        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),
            ('Write Shifts', self.save_shifts_cb),
            ('Write Peaks', self.save_peaks_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'XEASYFormat')),
        )
        br.frame.pack(side='top', anchor='w')

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])
    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()
Beispiel #28
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()
Beispiel #29
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'XPLOR Restraints')

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

    pl = sputil.peak_listbox(self.top)
    pl.frame.pack(fill = 'both', expand = 1)
    pl.heading['text'] = 'XPLOR Restraint list'
    pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
    pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
    self.peak_list = pl

    bt = tkutil.entry_field(self.top, 'Bounds text ', width = 30)
    bt.frame.pack(side = 'top', anchor = 'w')
    self.bounds_text = bt

    nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
    nb.button.pack(side = 'top', anchor = 'w')
    self.note = nb

    hb = tkutil.entry_row(self.top, 'Only peaks with height',
                          (' >= ', '', 8), (' and < ', '', 8))
    hb.frame.pack(side = 'top', anchor = 'w')
    self.height_min, self.height_max = hb.variables

    vb = tkutil.entry_row(self.top, 'Only peaks with volume',
                          (' >= ', '', 8), (' and < ', '', 8))
    vb.frame.pack(side = 'top', anchor = 'w')
    self.volume_min, self.volume_max = vb.variables

    eh1 = Tkinter.Label(self.top, text = 'Omit peak if note has a word from:')
    eh1.pack(side = 'top', anchor = 'w')
    ef1 = tkutil.entry_field(self.top, '  ', width = 30)
    ef1.frame.pack(side = 'top', anchor = 'w')
    self.exclude_note_words = ef1
    eh2 = Tkinter.Label(self.top, text = 'or if it has no word from:')
    eh2.pack(side = 'top', anchor = 'w')
    ef2 = tkutil.entry_field(self.top, '  ', width = 30)
    ef2.frame.pack(side = 'top', anchor = 'w')
    self.require_note_words = ef2
    et = Tkinter.Label(self.top, text = '(space separated list of words)')
    et.pack(side = 'top', anchor = 'w')
    
    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),
                           ('Write Restraints', self.save_peaks_cb),
                           ('Append', self.append_peaks_cb),
                           ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session,
                                                   'XplorFormat')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])
Beispiel #30
0
  def __init__(self, session):

    self.session = session
    try:
      persist_path = self.session.project.save_path + '.seq'
    except:
      persist_path = ''
    sequence = []
    ## If the session.project.save_path + '.seq' file exist then produce sequence = [(idx, szA)]
    if os.path.exists(persist_path):
      pszLines =[line.rstrip() for line in open(persist_path).readlines() if line.rstrip() and ">" not in line and "#" not in line]
      for line in pszLines:
        if line.split()[0] in AAA_dict.keys():
          sequence.append((int(line.split()[1]), AAA_dict[line.split()[0]]))

    if not os.path.exists(persist_path):
      tkMessageBox.showinfo('Input Error', "No Sequence file was found\n Please load a sequence using 'sq' command\nSave the project and relaunch MAGIC-Act")

      return  self.close_cb
    self.sequence = sequence
    self.selection_notice = None
    self.save_file = session.project.save_path.split('/')[-1].replace('.proj', '_pymol.txt')
    tkutil.Dialog.__init__(self, session.tk, 'MAGIC-View')
    explain = ('Pymol Visualization and Assignment Accuracy Statistics\n') 
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')
    explain = ('PDB does NOT need H')
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')

    ep = tkutil.file_field2(self.top, 'PDB file', 'Browse...', file_type=[('Protein Data Bank File', '.pdb')], default_ext='.pdb')
    self.pdb_path = ep.variable
    ep.frame.pack(side = 'top', anchor = 'w')

    lb = tkutil.entry_field(self.top, 'Labeled Methyls: ', 'ILVMAT', 10)
    lb.frame.pack(side = 'top', anchor = 'w')
    self.labeling = lb.variable

    explain = ('Specify which chain should be used')
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')
    ch = tkutil.entry_field(self.top, 'Use Chain(s): ', 'A', 5)
    self.chains = ch.variable
    ch.frame.pack(side = 'top', anchor = 'w')

    explain = ('Select 2D spectra that contain assignments')
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')    
    self.sc = self.spectrum_choice_table(self.top)
    self.sc.pack(side = 'top', anchor = 'w')

  # Compare Assignments Box
    self.lf2 = Tkinter.LabelFrame(self.top, text='Compare Assignments')
    self.lf2.pack(fill=X, pady=5)
    self.pmframe= Tkinter.Frame(self.lf2)
    self.pmframe.pack(pady=5)
    # First Spectrum
    self.sc_ref_spectrum = spectrum_menu(session, self.pmframe, 'Ref Spectrum: ')
    self.sc_ref_spectrum.frame.pack(side ='top',padx=3)
  # Second Spectrum  
    self.sc_spectrum_2 = spectrum_menu(session, self.pmframe, 'Query Spectrum: ')
    self.sc_spectrum_2.frame.pack(side = 'top', anchor = 'w')

    sl = tkutil.scrolling_list(self.top, 'Assignment Report', 10)
    sl.frame.pack(fill = 'both', expand = 1)
    self.summary_list = sl

  # PPM Tolerances for filtering noesy and finding geminal pairs
    er = tkutil.entry_row(self.top, 'PPM tolerance: ',
                                    ('1H', '0.01', 5),
                                    ('13C', '0.10', 5))
    er.frame.pack(side = 'top', anchor = 'w',padx=2)
    self.ppm_range = er

    br = tkutil.button_row(self.top,
                           ('Compare', self.show_summary),
                           ('Save', self.save_pymol_cb),
                           ('Close', self.close_cb))
    br.frame.pack(side = 'top', anchor = 'w')
Beispiel #31
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')