本文整理匯總了Python中xbb_utils.NotePad.update方法的典型用法代碼示例。如果您正苦於以下問題:Python NotePad.update方法的具體用法?Python NotePad.update怎麽用?Python NotePad.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xbb_utils.NotePad
的用法示例。
在下文中一共展示了NotePad.update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from xbb_utils import NotePad [as 別名]
# 或者: from xbb_utils.NotePad import update [as 別名]
class BlastIt:
def __init__(self, seq, parent=None):
self.seq = seq
self.parent = parent
self.toplevel = Toplevel(parent)
Pmw.initialise(parent)
self.GetBlasts()
self.Choices()
def GetBlasts(self):
pin, nin = [], []
try:
pin.extend(glob.glob(os.environ['BLASTDB'] + '/*.pin'))
except:
pass
pin.extend(glob.glob('*.pin'))
try:
nin.extend(glob.glob(os.environ['BLASTDB'] + '/*.nin'))
except:
pass
nin.extend(glob.glob('*.nin'))
self.pin = [os.path.splitext(x)[0] for x in pin]
self.nin = [os.path.splitext(x)[0] for x in nin]
def Choices(self):
self.GetBlasts()
self.cf = Frame(self.toplevel)
self.cf.pack(side=TOP, expand=1, fill=X)
self.dbs = Pmw.ComboBox(self.cf,
label_text='Blast Databases:',
labelpos='nw',
scrolledlist_items=self.nin + self.pin,
selectioncommand=self.Validate
)
self.blasts = Pmw.ComboBox(self.cf,
label_text='Blast Programs:',
labelpos='nw',
scrolledlist_items=['blastn', 'blastp', 'blastx', 'tblastn', 'tblastx'],
selectioncommand=self.Validate
)
self.dbs.pack(side=LEFT, expand=1, fill=X)
self.blasts.pack(side=LEFT, expand=1, fill=X)
self.alternative_f = Frame(self.cf)
self.alternative = Entry(self.alternative_f)
self.alternative_f.pack(side=TOP, fill=X, expand=1)
self.alternative.pack(side=LEFT, fill=X, expand=1)
self.ok = Button(self.alternative_f, text='Run',
command=self._Run)
self.ok.pack(side=RIGHT)
self.dbs.selectitem(0)
self.blasts.selectitem(0)
self.Validate()
def Validate(self, *args):
db = self.dbs.get()
prog = self.blasts.get()
color = 'red'
if (prog in ['blastn', 'tblastx', 'tblastn']) == (db in self.nin):
color = 'green'
elif (prog in ['blastp', 'blastx']) == (db in self.pin):
color = 'green'
self.dbs.component('entry').configure(bg=color)
self.blasts.component('entry').configure(bg=color)
def _Run(self):
alternative_command = self.alternative.get()
if len(alternative_command.strip()):
self.command = alternative_command.strip()
else:
db = self.dbs.get()
prog = self.blasts.get()
self.command = 'echo %s | nice blastall -d %s -p %s' % (self.seq, db, prog)
self.Run()
def Update(self):
self.notepad.update()
self.notepad.after(1, self.Update)
def oldRun(self):
self.notepad = NotePad()
self.notepad.menubar.configure(bg='red')
self.notepad.bind('<Destroy>', self.Exit)
self.Update()
print(self.command)
self.pipe = os.popen(self.command)
while True:
try:
char = self.pipe.read(1)
self.notepad.insert(END, char)
self.notepad.update()
except:
break
#.........這裏部分代碼省略.........