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 revision Previous revision
Next revision
Previous revision
bio:tools:codonopttable [2010/04/15 11:36]
172.26.15.75
bio:tools:codonopttable [2010/06/30 19:52] (current)
172.26.15.75
Line 75: Line 75:
 import os import os
 import random import random
 +import re
 class testgui(wx.Frame): class testgui(wx.Frame):
     def __init__(self, parent, id, title):     def __init__(self, parent, id, title):
-        wx.Frame.__init__(self, parent, id, title, size=(600,300))+        wx.Frame.__init__(self, parent, id, title, size=(683,360))
         # Menu stuff         # Menu stuff
         menubar =wx.MenuBar()         menubar =wx.MenuBar()
Line 90: Line 91:
         panel =wx.Panel(self, -1)         panel =wx.Panel(self, -1)
         hbsizer =wx.BoxSizer(wx.VERTICAL)         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,size=(679,275),style=wx.TE_MULTILINE)
        # self.orig_text =wx.TextCtrl(panel,-1)        # self.orig_text =wx.TextCtrl(panel,-1)
-#Objects+       #Objects
         self.orig_label =wx.StaticText(panel,-1, 'Paste Your Sequence here:')         self.orig_label =wx.StaticText(panel,-1, 'Paste Your Sequence here:')
- ok_button =wx.Button(panel,-1,'Run CodonOptTable'+        ok_button =wx.Button(panel,-1,'Run CodonOptTable'
- cancel_button =wx.Button(panel,-1,'Clear'+        cancel_button =wx.Button(panel,-1,'Clear'
- exit_button=wx.Button(panel,-1,'Exit'+        format_seq =wx.Button(panel,-1,'Format Seq'
- disp =wx.StaticText(panel,-1,''+        rhead =wx.Button(panel,-1,'Remove Header'
-  +        exit_button=wx.Button(panel,-1,'Exit'
- vsizer1 =wx.BoxSizer(wx.HORIZONTAL) +        disp =wx.StaticText(panel,-1,''
- vsizer4 =wx.BoxSizer(wx.HORIZONTAL) +     vsizer1 =wx.BoxSizer(wx.HORIZONTAL) 
- vsizer5 =wx.BoxSizer(wx.HORIZONTAL) +     vsizer4 =wx.BoxSizer(wx.HORIZONTAL) 
- vsizer6 =wx.BoxSizer(wx.HORIZONTAL) +     vsizer5 =wx.BoxSizer(wx.HORIZONTAL) 
- vsizer2 =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) +     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(rhead,1,wx.RIGHT,1) 
- vsizer5.Add(exit_button,1,wx.RIGHT,1) +      vsizer5.Add(format_seq,1,wx.RIGHT,1) 
-  +      vsizer5.Add(ok_button,1,wx.RIGHT,1) 
- vsizer6.Add(disp,1,wx.CENTER,1) +     vsizer5.Add(cancel_button,1,wx.RIGHT,1) 
-  +     vsizer5.Add(exit_button,1,wx.RIGHT,1) 
- hbsizer.Add(vsizer1,0,wx.CENTER|wx.ALL,1) +  
-# hbsizer.Add(self.orig_text,0, wx.CENTER|wx.ALL,1) +     vsizer6.Add(disp,1,wx.CENTER,1) 
- hbsizer.Add(vsizer2,0, wx.CENTER|wx.ALL,1) +  
- hbsizer.Add(vsizer4,0, wx.CENTER|wx.ALL,1) +     hbsizer.Add(vsizer1,0,wx.CENTER|wx.ALL,1) 
- hbsizer.Add(vsizer5,0,wx.ALIGN_RIGHT|wx.RIGHT,1) +       hbsizer.Add(self.orig_text,0, wx.CENTER|wx.ALL,1) 
- hbsizer.Add(vsizer6,0,wx.CENTER,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  #events
- self.Bind(wx.EVT_BUTTON,self.executa,ok_button) +      self.Bind(wx.EVT_BUTTON,self.executa,ok_button) 
- self.Bind(wx.EVT_MENU, self.soja, exitmenu) +     self.Bind(wx.EVT_BUTTON,self.rheader,rhead) 
- self.Bind(wx.EVT_BUTTON,self.clear,cancel_button) +      self.Bind(wx.EVT_BUTTON,self.format_seq,format_seq) 
- self.Bind(wx.EVT_BUTTON,self.soja,exit_button) +      self.Bind(wx.EVT_MENU, self.soja, exitmenu) 
- #panel.CreateStatusBar() +     self.Bind(wx.EVT_BUTTON,self.clear,cancel_button) 
- panel.SetSizer(hbsizer)  +     self.Bind(wx.EVT_BUTTON,self.soja,exit_button) 
- self.Centre() +#pane l.CreateStatusBar() 
- +     panel.SetSizer(hbsizer)  
-        self.Show(True)+     self.Centre() 
 +     self.Show(True)
     def clear(self,event=None):     def clear(self,event=None):
  self.orig_text.SetValue('')  self.orig_text.SetValue('')
- +    def format_seq(self,event=None): 
 + originator=self.orig_text.GetValue() 
 + comm=re.sub('[ \t\r\n]','',originator) 
 +        self.orig_text.SetValue(comm) 
 +    def rheader(self,event=None): 
 + originator=self.orig_text.GetValue() 
 + comm=re.sub('>.*','>',originator) 
 +        self.orig_text.SetValue(comm)
     def soja(self, event=None):     def soja(self, event=None):
-        self.Close(True)+    self.Close(True)
     def executa(self,event=None):     def executa(self,event=None):
  recordid=random.randint(20,10055)  recordid=random.randint(20,10055)
Line 144: Line 156:
 testgui(None, -1, 'CodonOptTable GUI') testgui(None, -1, 'CodonOptTable GUI')
 app.MainLoop() app.MainLoop()
 +
 </code> </code>
 This is used together with the perl script: This is used together with the perl script:
Line 187: Line 200:
 codon($sequence); </code> codon($sequence); </code>
 <note warning> Note: You have to edit the paths to suite your setup. </note> <note warning> Note: You have to edit the paths to suite your setup. </note>
 +
 ==== Usefull ReGex ==== ==== Usefull ReGex ====
 ---- ----
 Merge sequence lines using sed:  Merge sequence lines using sed: 
  
-<code>cat mysequencefile | tr -d '\n> new_sequence_file</code>+<code>grep -v Tp sequence | tr -d "\n> new_sequence_file</code> 
 + 
 +<code>$ grep -o <pattern> </code> This will grep only the part of matching line that matching the pattern eg How many occurence of "ATCG"  in a sequence?
bio/tools/codonopttable.1271331388.txt.gz · Last modified: 2010/05/22 14:19 (external edit)