Exemplo n.º 1
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')
Exemplo n.º 2
0
  def __init__(self, session):

    self.session = session

    tkutil.Dialog.__init__(self, session.tk, 'ncIDP Repositioning Tool 1.2b/2nd DEC 2010')
    
    cm = sputil.condition_menu(session, self.top, 'Condition: ')
    cm.frame.pack(side = 'top', anchor = 'w')
    self.condition_menu = cm

    rr = tkutil.entry_row(self.top, 'Residues ',
                          ('from', '', 3), ('to', '', 3))
    self.range_variables = rr.variables
    rr.frame.pack(side = 'top', anchor = 'w')

    ol = tkutil.scrolling_list(self.top, '', 5)
    ol.frame.pack(side = 'top', fill = 'both', expand = 1)
    ol.listbox.bind('<ButtonRelease-1>', self.select_cb)
    self.offset_list = ol

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

    br = tkutil.button_row(self.top,
			   ('Positions', self.positions_cb),
			   ('Move', self.move_cb),
                           ('Shifts', self.shifts_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'Reposition'))
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3]) 
Exemplo n.º 3
0
    def __init__(self, session):
        self.session = session
        self.grid_widgets = []

        tkutil.Dialog.__init__(self, session.tk, 'Read and write PCS values')
        acqu_template = [("T{}-:".format(i + 1), "0.0", 6) for i in range(3)]

        self.dia_menu = sputil.spectrum_menu(session, self.top,
                                             'Diamagnetic Spectrum:  ')
        self.dia_menu.frame.pack(side='top', anchor='w')
        self.dia_menu.add_callback(self.dia_spec_change)
        self.dia_acqu = tkutil.entry_row(self.top, "Acqu Time:",
                                         *acqu_template)
        self.dia_acqu.frame.pack(side='top', anchor='w')

        self.para_menu = sputil.spectrum_menu(session, self.top,
                                              'Paramagnetic Spectrum: ')
        self.para_menu.frame.pack(side='top', anchor='w')
        self.para_menu.add_callback(self.para_spec_change)
        self.para_acqu = tkutil.entry_row(self.top, "Acqu Time:",
                                          *acqu_template)
        self.para_acqu.frame.pack(side='top', anchor='w')

        self.npc_write_path = tkutil.file_field(self.top,
                                                'PCS save file: ',
                                                '.npc',
                                                save=1)
        self.npc_write_path.frame.pack(side='top', anchor='e')
        self.npc_write_path.set("pcsexp.npc")

        self.npc_read_path = tkutil.file_field(self.top, 'PCS read file: ',
                                               '.npc')
        self.npc_read_path.frame.pack(side='top', anchor='e')
        self.npc_read_path.set("pcscalc.npc")

        self.message = Tkinter.Label(self.top)
        self.message.pack(side='top', anchor='w')
        self.message['text'] = "\n"

        br = tkutil.button_row(self.top, ('Write PCS', self.write_npc_cb),
                               ('Read PCS', self.read_npc_cb),
                               ('Clear PCS', self.clear_peaks_cb),
                               ('Close', self.close_cb))
        br.frame.pack(side='top', anchor='w')

        self.dia_spec_change()
        self.para_spec_change()
Exemplo n.º 4
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Create Corma Spectrum')

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

    ms = tkutil.entry_row(self.top, 'Matrix size: ',
                          ('w1', '0', 5), ('w2', '0', 5))
    ms.frame.pack(side = 'top', anchor = 'w')
    self.matrix_size = ms

    lw = tkutil.entry_row(self.top, 'Default linewidth (hz): ',
                          ('w1', '0', 5), ('w2', '0', 5))
    lw.frame.pack(side = 'top', anchor = 'w')
    self.default_linewidth = lw

    cp = tkutil.file_field(self.top, 'Corma file: ', 'corma')
    cp.frame.pack(side = 'top', anchor = 'w')
    self.corma_path = cp

    sp = tkutil.file_field(self.top, 'Save in file: ', 'spectrum', save = 1)
    sp.frame.pack(side = 'top', anchor = 'w')
    self.save_path = sp
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw', justify = 'left')
    progress_label.pack(side = 'top', anchor = 'w')
    
    self.spectrum_cb(self.spectrum_menu.get())

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

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
Exemplo n.º 5
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])
Exemplo n.º 6
0
    def tolerance_entry(self, parent):

        t = tkutil.entry_row(parent, 'Tolerances (ppm)', (' 1H', '.02', 5),
                             (' 13C', '.4', 5), (' 15N', '.2', 5))
        self.tolerances = {
            '1H': t.variables[0],
            '13C': t.variables[1],
            '15N': t.variables[2]
        }

        return t.frame
Exemplo n.º 7
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])
Exemplo n.º 8
0
  def tolerance_entry(self, parent):

    t = tkutil.entry_row(parent, 'Tolerances (ppm)',
                         (' 1H', '.02', 5),
                         (' 13C', '.4', 5),
                         (' 15N', '.2', 5))
    self.tolerances = {'1H': t.variables[0],
                       '13C': t.variables[1],
                       '15N': t.variables[2]}

    return t.frame
Exemplo n.º 9
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])
Exemplo n.º 10
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])
Exemplo n.º 11
0
    def __init__(self, session):

        self.session = session

        tkutil.Dialog.__init__(self, session.tk, 'Possible Noesy Assignments')

        sc = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
        sc.frame.pack(side='top', anchor='w')
        self.spectrum_choice = sc
        sc.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.spectrum_cb(self.spectrum_choice.get())

        t = tkutil.scrolling_text(self.top, height=32, width=60)
        t.frame.pack(side='top', anchor='nw', fill='both', expand=1)
        t.text['wrap'] = 'none'
        self.text = t.text

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

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 12
0
  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')
Exemplo n.º 13
0
    def __init__(self, session):

        self.session = session

        tkutil.Dialog.__init__(self, session.tk,
                               'Reposition Assigned Fragment')

        cm = sputil.condition_menu(session, self.top, 'Condition: ')
        cm.frame.pack(side='top', anchor='w')
        self.condition_menu = cm

        rr = tkutil.entry_row(self.top, 'Residues ', ('from', '', 3),
                              ('to', '', 3))
        self.range_variables = rr.variables
        rr.frame.pack(side='top', anchor='w')

        ol = tkutil.scrolling_list(self.top, '', 5)
        ol.frame.pack(side='top', fill='both', expand=1)
        ol.listbox.bind('<ButtonRelease-1>', self.select_cb)
        self.offset_list = ol

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

        br = tkutil.button_row(
            self.top,
            ('Positions', self.positions_cb),
            ('Move', self.move_cb),
            ('Shifts', self.shifts_cb),
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            ('Help', sputil.help_cb(session, 'Reposition')),
        )
        br.frame.pack(side='top', anchor='w')

        tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])
Exemplo n.º 14
0
  def __init__(self, session):

    self.sparky_session = session
    
    tkutil.Settings_Dialog.__init__(self, session.tk, 'AutoAssign Setup')

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

    t = tkutil.entry_row(self.top, 'Tolerances (ppm)',
                         ('HN', '', 4),
                         ('N15', '', 4),
                         ('CA', '', 4),
                         ('CB', '', 4),
                         ('HA', '', 4),
                         ('CO', '', 4),
                         )
    t.frame.pack(side = 'top', anchor = 'w')
    self.tolerances = t.entries
 
    td = tkutil.file_field(self.top, 'Temp directory for peak lists: ',
                           'autoassign', browse_button = 0, width = 30)
    td.frame.pack(side = 'top', anchor = 'w')
    self.temp_directory = td
    
    m = Tkinter.Label(self.top, anchor = 'nw', justify = 'left')
    m.pack(side = 'top', anchor = 'w')
    self.message = m

    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')
Exemplo n.º 15
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])
Exemplo n.º 16
0
  def UpdateDialog(self):
    # Clear objects
    if self.spectrum_text <> None:
        self.spectrum_text.frame.destroy()
    if self.peak_text <> None:
        self.peak_text.frame.destroy()
    if self.label_box <> None:
        self.label_box.destroy()
    if self.br <> None:
        self.br.frame.destroy()
    if self.br2 <> None:
        self.br2.frame.destroy()        
    if self.progress_label <> None:
        self.progress_label.destroy()    
    
    # Set up selected spectrum
    self.spectrum = self.session.selected_spectrum()

    # There should be selected spectrum
    if self.spectrum == None:
        self.close_cb()
        
    # There should be one selected peak    
    peaks = self.spectrum.selected_peaks()
    
    if len(peaks) > 0:
        self.peak = peaks[0]
    else:
        self.close_cb()

    # Create label object for showing spectrum name
    t = tkutil.entry_row(self.top, 'Selected Spectrum: ' + self.spectrum.name)
    t.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_text = t

    # Dunno why 'len(peaks) > 0' is not working 
    if self.peak <> None:
        if self.spectrum.dimension == 2:
            u = tkutil.entry_row(self.top, 'Selected Peak: %7.3f,%7.3f' % (self.peak.position[0],self.peak.position[1]) )
        else:
            u = tkutil.entry_row(self.top, 'Selected Peak: %7.3f,%7.3f,%7.3f' % (self.peak.position[0],self.peak.position[1],self.peak.position[2]) )
        u.frame.pack(side = 'top', anchor = 'w')
        self.peak_text = u
        
        # Create listbox object for showing labels
        lbLabel = self.label_list_box(self.top)                         # List box
        lbLabel.pack(side = 'top', fill = 'both', expand = 1)
        self.label_box = lbLabel
        self.LabelBox()                           # Set up label list box


    # Create Buttons
    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')   
    self.progress_label = progress_label
   
    self.br = tkutil.button_row(self.top,
                           ('Update', self.UpdateDialog),         # Func
                           ('Assign', self.Assign),         # Func
                           ('Best Prob.', self.AssignTheBest),
                           ('UnAssign', self.UnAssign),     # Func
                          )
    self.br2 = tkutil.button_row(self.top,
                           ('Floating Labels', self.FloatingLabel),
                           ('Graph...', self.Graph),        # Func
                           ('Stop', self.stop_cb),
                           ('Close', self.close_cb),        
                           #('Help', sputil.Help(session, 'PineAssign')),
                          )
    self.br.frame.pack(side = 'top', anchor = 'w')
    self.br2.frame.pack(side = 'top', anchor = 'w')
     
    tkutil.Stoppable.__init__(self, progress_label, self.br2.buttons[2])
Exemplo n.º 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()
Exemplo n.º 18
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()
Exemplo n.º 19
0
    def UpdateDialog(self):
        # Clear objects
        if self.spectrum_text <> None:
            self.spectrum_text.frame.destroy()
        if self.peak_text <> None:
            self.peak_text.frame.destroy()
        if self.label_box <> None:
            self.label_box.destroy()
        if self.br <> None:
            self.br.frame.destroy()
        if self.br2 <> None:
            self.br2.frame.destroy()
        if self.progress_label <> None:
            self.progress_label.destroy()

        # Set up selected spectrum
        self.spectrum = self.session.selected_spectrum()

        # There should be selected spectrum
        if self.spectrum == None:
            self.close_cb()

        # There should be one selected peak
        peaks = self.spectrum.selected_peaks()

        if len(peaks) > 0:
            self.peak = peaks[0]
        else:
            self.close_cb()

        # Create label object for showing spectrum name
        t = tkutil.entry_row(self.top,
                             'Selected Spectrum: ' + self.spectrum.name)
        t.frame.pack(side='top', anchor='w')
        self.spectrum_text = t

        # Dunno why 'len(peaks) > 0' is not working
        if self.peak <> None:
            if self.spectrum.dimension == 2:
                u = tkutil.entry_row(
                    self.top, 'Selected Peak: %7.3f,%7.3f' %
                    (self.peak.position[0], self.peak.position[1]))
            else:
                u = tkutil.entry_row(
                    self.top, 'Selected Peak: %7.3f,%7.3f,%7.3f' %
                    (self.peak.position[0], self.peak.position[1],
                     self.peak.position[2]))
            u.frame.pack(side='top', anchor='w')
            self.peak_text = u

            # Create listbox object for showing labels
            lbLabel = self.label_list_box(self.top)  # List box
            lbLabel.pack(side='top', fill='both', expand=1)
            self.label_box = lbLabel
            self.LabelBox()  # Set up label list box

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

        self.br = tkutil.button_row(
            self.top,
            ('Update', self.UpdateDialog),  # Func
            ('Assign', self.Assign),  # Func
            ('Best Prob.', self.AssignTheBest),
            ('UnAssign', self.UnAssign),  # Func
        )
        self.br2 = tkutil.button_row(
            self.top,
            ('Floating Labels', self.FloatingLabel),
            ('Graph...', self.Graph),  # Func
            ('Stop', self.stop_cb),
            ('Close', self.close_cb),
            #('Help', sputil.Help(session, 'PineAssign')),
        )
        self.br.frame.pack(side='top', anchor='w')
        self.br2.frame.pack(side='top', anchor='w')

        tkutil.Stoppable.__init__(self, progress_label, self.br2.buttons[2])
Exemplo n.º 20
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')