[Guiblast-devel] Revised source code
Michael Mayhew
guiblast-devel@bioinformatics.org
Fri, 29 Aug 2003 09:08:52 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C36E0D.2AF782C0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_000D_01C36E0D.2AF782C0"
------=_NextPart_001_000D_01C36E0D.2AF782C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sorry about the delay, but I am still trying to figure out CVS for =
checking in, considering that I developed all of my code in the windows =
environment and not in Cygwin. Anyway, here it is, so please do try it =
out.=20
Michael
P.S. I know I don't need to tell you, but read the comments. Thanks.
------=_NextPart_001_000D_01C36E0D.2AF782C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Sorry about the delay, but I am still =
trying to=20
figure out CVS for checking in, considering that I developed all of my =
code in=20
the windows environment and not in Cygwin. Anyway, here it is, so please =
do try=20
it out. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Michael</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>P.S. I know I don't need to tell you, =
but read the=20
comments. Thanks.</FONT></DIV></BODY></HTML>
------=_NextPart_001_000D_01C36E0D.2AF782C0--
------=_NextPart_000_000C_01C36E0D.2AF782C0
Content-Type: text/plain;
name="guiblast-rev.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="guiblast-rev.py"
#!/usr/bin/python
# 0.41 24-Jul-2003
"""
__version__ =3D "$Revision: 1.7 $"
__date__ =3D "$Date: 2003/08/24 17:44:55 $"
"""
from PythonCardPrototype import model, dialog
import webbrowser
import os.path #Added to get the basename of =
the dbase
from Bio.Blast import NCBIStandalone
#some variables.
#blastexe=3D"c:\\bioinfo-adv\\blast\\blastall.exe"
#pathdb=3D"c:\\bioinfo-adv\\blast\\data\\" # aca hay que agregar cada =
base en part.
#tempdir=3D"c:\\bioinfo-adv\\temp\\"
#Modified by Michael Mayhew
#August 24, 2003
#Changed these directory strings to fit my system settings. When
#you run this revision on your system, make sure to change
#these to suit you.
#NOTE: We may want to, like the pathdb variable, make the
#blastexe variable a persistent data member of the WinBlast
#class, set at runtime by the user. Just a suggestion.
blastexe =3D "C:\\WINDOWS\\Desktop\\guiblast\\blastall.exe"
tempdir =3D "C:\\WINDOWS\\Desktop\\guiblast\\"
outformat=3D'T'
class WinBlast(model.Background):
#pathdb is now a persistent data member of the class
pathdb =3D ''
def on_menuFileExit_select(self, event):
self.Close()
def on_incrBtn_mouseClick(self, event):
startValue =3D int(self.components.field1.text)
endValue =3D startValue + 1
self.components.field1.text =3D str(endValue)
def on_decrBtn_mouseClick(self, event):
startValue =3D int(self.components.field1.text)
endValue =3D startValue - 1
self.components.field1.text =3D str(endValue)
def on_resetBtn_mouseClick(self, event):
self.components.field1.text =3D "0"
def on_SliderWordSize_mouseClick(self, event):
pass
def on_ComboProgram_selected(self, event):
pass
#Modified by Michael Mayhew
#August 24, 2003
#Added wiring code for Browse button. The button
#opens a file browser dialog so that the user
#can specify where the BLAST binary database is.
def on_Btnbrowsedb_mouseClick(self, event):
fd =3D dialog.fileDialog(self, "Select a BLAST binary database =
to open", \
'C:\\', '', 'All Files (*.*)|*.*', \
dialog.FILE_OPEN | dialog.FILE_MULTIPLE)
if fd['accepted']:
self.pathdb =3D str(fd['paths'][0])
#Show only the basename of the full database path to the =
user
self.components.dbfield.text =3D =
os.path.basename(self.pathdb)
def getradiooutput(self):
if self.components.radiooutput.selected=3D=3D"Html":
return "T"
elif self.components.radiooutput.selected=3D=3D"Plain text":
return "F"
#radiobuttons. T =3D HTML and F =3D TXT
#def getInputActionMode(self):
# """Returns the type of action the next text input should do."""
# if self.components.nextInputActionMode.selected =3D=3D =
"inserts":
# return "insert"
# elif self.components.nextInputActionMode.selected =3D=3D =
"appends":
# return "append"
# elif self.components.nextInputActionMode.selected =3D=3D =
"replaces":
# return "replace"
def on_Btnrunblast_mouseClick(self, event):
#if self.components.dbfield.text=3D=3D'nr':
# base=3D'nr'
#elif self.components.dbfield.text=3D=3D'Arabidopsis Thaliana':
# base=3D'atal.faa'
#elif self.components.dbfield.text=3D=3D'E.Coli':
# if =
(self.components.ComboProgram.text=3D=3D('blastp'))|(self.components.Comb=
oProgram.text=3D=3D('blastx')):
# base=3D'ecoli.aa'
# else:
# base=3D'ecoli.nt'
#else:
# base=3D'nr.aa' # warning about this.
=20
print "BLAST: "
print self.components.ComboProgram.text
print self.pathdb #Changed from pathdb+base to pathdb
print self.components.seqinput.text
archentrada=3Dopen(tempdir+"input.txt",'w')
archentrada.writelines(self.components.seqinput.text)
archentrada.close()
texto =3D self.getradiooutput() # radiobuttons
blast_out, error_info =3D NCBIStandalone.blastall(blastexe, =
self.components.ComboProgram.text, self.pathdb, tempdir+'input.txt', =
expectation=3D5, html=3Dtexto)
if texto=3D=3D"T":
f=3Dopen(tempdir+"tempblast.htm", 'w')
# T =3D HTML
else:
f=3Dopen(tempdir+"tempblast.txt", 'w')
#Modified by Michael Mayhew
#August 24, 2003
#Changed blast_out to blast_out.read() since blast_out is an =
open
#file handle
f.write(blast_out.read()) =20
f.close()
if texto=3D=3D"T":
webbrowser.open(tempdir+"tempblast.htm")
else:
webbrowser.open(tempdir+"tempblast.txt")
# this option should be available only something on the text =
box.=20
=20
if __name__ =3D=3D '__main__':
app =3D model.PythonCardApp(WinBlast)
app.MainLoop()
------=_NextPart_000_000C_01C36E0D.2AF782C0
Content-Type: text/plain;
name="guiblast-rev.rsrc.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="guiblast-rev.rsrc.py"
{'stack':{'type':'Stack',
'name':'Minimal',
'backgrounds': [
{'type':'Background',
'name':'bgMin',
'title':'WinBlast',
'position':(491, 61),
'size':(475, 526),
'statusBar':1,
'foregroundColor':(255, 255, 255),
'backgroundColor':(0, 255, 128),
'menubar': {'type':'MenuBar',
'menus': [
{'type':'Menu',
'name':'menuFile',
'label':'&File',
'items': [
{'type':'MenuItem',
'name':'menuFileExit',
'label':'E&xit\tAlt+X',
},
]
},
]
},
'components': [
{'type':'Button',=20
'name':'Btnbrowsedb',=20
'position':(385, 149),=20
'size':(75, -1),=20
'label':'Browse',=20
},
{'type':'TextField',=20
'name':'dbfield',=20
'position':(271, 149),=20
'size':(109, 26),=20
},
{'type':'StaticText',=20
'name':'StaticText3',=20
'position':(12, 149),=20
'backgroundColor':(0, 255, 128),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
12},=20
'foregroundColor':(255, 255, 255),=20
'text':'Program',=20
},
{'type':'Button',=20
'name':'Btnrunblast',=20
'position':(198, 416),=20
'size':(127, 41),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
12},=20
'label':'Blast!',=20
},
{'type':'ComboBox',=20
'name':'ComboProgram',=20
'position':(82, 147),=20
'size':(75, 33),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
12},=20
'items':['blastn', 'blastp', 'blastx', 'tblastx', 'tblastn'],=20
'selected':'blastn',=20
'text':'blastn',=20
},
{'type':'RadioGroup',=20
'name':'radiooutput',=20
'position':(366, 15),=20
'size':(88, 71),=20
'items':['Html', 'Plain text'],=20
'label':'Output format',=20
'layout':'vertical',=20
'max':1,=20
'selected':'Html',=20
},
{'type':'TextArea',=20
'name':'seqinput',=20
'position':(41, 244),=20
'size':(383, 157),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
10},=20
'text':'>Enter your sequence here (FASTA or plain)',=20
},
{'type':'Spinner',=20
'name':'wordsize',=20
'position':(133, 208),=20
'size':(54, 31),=20
'backgroundColor':(0, 255, 128),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
14},=20
'foregroundColor':(255, 255, 255),=20
'max':100,=20
'min':5,=20
'value':11,=20
},
{'type':'StaticText',=20
'name':'StaticText2',=20
'position':(43, 210),=20
'backgroundColor':(0, 255, 128),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
12},=20
'foregroundColor':(255, 255, 255),=20
'text':'Word size',=20
},
{'type':'StaticText',=20
'name':'StaticText1',=20
'position':(182, 150),=20
'backgroundColor':(0, 255, 128),=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
12},=20
'foregroundColor':(255, 255, 255),=20
'text':'Database',=20
},
{'type':'Button',=20
'name':'resetBtn',=20
'position':(14, 95),=20
'label':'Reset',=20
},
{'type':'Button',=20
'name':'decrBtn',=20
'position':(16, 63),=20
'label':'Decrement',=20
},
{'type':'Button',=20
'name':'incrBtn',=20
'position':(206, 19),=20
'label':'Increment',=20
},
{'type':'TextField',=20
'name':'field1',=20
'position':(140, 16),=20
'size':(54, 50),=20
'editable':0,=20
'font':{'faceName': 'MS Shell Dlg', 'family': 'sansSerif', 'size': =
24},=20
'text':'42',=20
},
] # end components
} # end background
] # end backgrounds
} }
------=_NextPart_000_000C_01C36E0D.2AF782C0--