User Tools

Site Tools


bio:tools:codonopttable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
bio:tools:codonopttable [2009/12/17 09:48] 172.26.15.75bio:tools:codonopttable [2010/02/15 10:16] 172.26.0.166
Line 66: Line 66:
 <code> <code>
 $seqobj->generate_graph($myCodons,"myoutput.gif");</code> $seqobj->generate_graph($myCodons,"myoutput.gif");</code>
- 
 ====Creating a gui for CodonOptTable==== ====Creating a gui for CodonOptTable====
  
 +Here is a python script that provides a Graphical User Interface:
 +You need to have wxpython installed on your system.
 +<file>
 +#!/usr/bin/python
 +import wx
 +import os
 +import random
 +class testgui(wx.Frame):
 +    def __init__(self, parent, id, title):
 +        wx.Frame.__init__(self, parent, id, title, size=(600,300))
 +        # Menu stuff
 +        menubar =wx.MenuBar()
 +        menufile =wx.Menu()
 +        menuhelp =wx.Menu()
 +        self.SetMenuBar(menubar)
 +        menubar.Append(menufile, '&File')
 +        menubar.Append(menuhelp, '&Help')
 +        exitmenu =menufile.Append(-1, 'Quit', 'Exit Application')
 +        about =menuhelp.Append(-1, 'About', 'About us')
 +        #panel creation and sizer
 +        panel =wx.Panel(self, -1)
 +        hbsizer =wx.BoxSizer(wx.VERTICAL)
 +        self.orig_text =wx.TextCtrl(panel,-1,size=(250,150),style=wx.TE_MULTILINE)
 +       # self.orig_text =wx.TextCtrl(panel,-1)
 +#Objects
 +        self.orig_label =wx.StaticText(panel,-1, 'Paste Your Sequence here:')
 + ok_button =wx.Button(panel,-1,'Run CodonOptTable')
 + cancel_button =wx.Button(panel,-1,'Clear')
 + exit_button=wx.Button(panel,-1,'Exit')
 + disp =wx.StaticText(panel,-1,'')
 +
 + vsizer1 =wx.BoxSizer(wx.HORIZONTAL)
 + vsizer4 =wx.BoxSizer(wx.HORIZONTAL)
 + vsizer5 =wx.BoxSizer(wx.HORIZONTAL)
 + vsizer6 =wx.BoxSizer(wx.HORIZONTAL)
 + vsizer2 =wx.BoxSizer(wx.HORIZONTAL)
 +
 + vsizer1.Add(self.orig_label,1,wx.CENTRE,10)
 + vsizer2.Add(self.orig_text,1,wx.CENTRE,10)
 +
 + vsizer5.Add(ok_button,1,wx.RIGHT,1)
 + vsizer5.Add(cancel_button,1,wx.RIGHT,1)
 + vsizer5.Add(exit_button,1,wx.RIGHT,1)
 +
 + vsizer6.Add(disp,1,wx.CENTER,1)
 +
 + hbsizer.Add(vsizer1,0,wx.CENTER|wx.ALL,1)
 +# hbsizer.Add(self.orig_text,0, wx.CENTER|wx.ALL,1)
 + hbsizer.Add(vsizer2,0, wx.CENTER|wx.ALL,1)
 + hbsizer.Add(vsizer4,0, wx.CENTER|wx.ALL,1)
 + hbsizer.Add(vsizer5,0,wx.ALIGN_RIGHT|wx.RIGHT,1)
 + hbsizer.Add(vsizer6,0,wx.CENTER,1)
 +
 + #events
 + self.Bind(wx.EVT_BUTTON,self.executa,ok_button)
 + self.Bind(wx.EVT_MENU, self.soja, exitmenu)
 + self.Bind(wx.EVT_BUTTON,self.clear,cancel_button)
 + self.Bind(wx.EVT_BUTTON,self.soja,exit_button)
 + #panel.CreateStatusBar()
 + panel.SetSizer(hbsizer) 
 + self.Centre()
  
 +        self.Show(True)
 +    def clear(self,event=None):
 + self.orig_text.SetValue('')
 +
 +    def soja(self, event=None):
 +        self.Close(True)
 +    def executa(self,event=None):
 + recordid=random.randint(20,10055)
 + originator=self.orig_text.GetValue()
 + os.system('perl /home/obiero/codonopt/codonOpt-test.pl %s' %originator)
 + wx.MessageBox('DONE! check the output in you folder', 'CodonOptTable Info'   
 +app =wx.App()
 +testgui(None, -1, 'CodonOptTable GUI')
 +app.MainLoop()
 +</file>
bio/tools/codonopttable.txt · Last modified: 2010/06/30 19:52 by 172.26.15.75