当前位置: 首页>>代码示例>>Python>>正文


Python xbb_utils.NotePad类代码示例

本文整理汇总了Python中xbb_utils.NotePad的典型用法代码示例。如果您正苦于以下问题:Python NotePad类的具体用法?Python NotePad怎么用?Python NotePad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NotePad类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: export

 def export(self):
     """Export selected text to new text window."""
     seq = self.get_selection_or_sequence()
     if not seq:
         return
     np = NotePad()
     tid = np.text_id()
     tid.insert('end', seq)
开发者ID:abradle,项目名称:biopython,代码行数:8,代码来源:xbb_widget.py

示例2: gcframe

 def gcframe(self, direction='both'):
     seq = self.get_selection_or_sequence()
     if not seq:
         return
     np = NotePad()
     tid = np.text_id()
     tid.insert('end',
                self.translator.gcframe(seq, self.current_codon_table_id,
                                        direction))
开发者ID:abradle,项目名称:biopython,代码行数:9,代码来源:xbb_widget.py

示例3: extract

 def extract(self):
     seq = self.get_selection_or_sequence()
     frame = self.frame_int.get()
     if not seq:
         return
     aa_seq = self.translator.frame(seq, frame, self.current_codon_table_id)
     aa_seq = re.sub('(.{50})', '\\1\n', str(aa_seq))
     np = NotePad()
     tid = np.text_id()
     tid.insert('end', '>frame%d\n%s' % (frame, aa_seq))
开发者ID:abradle,项目名称:biopython,代码行数:10,代码来源:xbb_widget.py

示例4: translate

 def translate(self):
     seq = self.get_selection_or_sequence()
     frame = self.frame_int.get()
     if not seq:
         return
     np = NotePad()
     tid = np.text_id()
     tid.insert('end',
                self.translator.frame_nice(seq, frame,
                                           self.current_codon_table_id))
开发者ID:abradle,项目名称:biopython,代码行数:10,代码来源:xbb_widget.py

示例5: statistics

    def statistics(self):
        seq = self.get_selection_or_sequence()
        if not seq:
            return
        seq = seq.upper()
        aa = {'A': 0, 'C': 0, 'G': 0, 'T': 0, 'N': 0}
        for nt in seq:
            if nt not in aa:
                nt = 'N'
            aa[nt] = aa[nt] + 1

        GC = (100.0 * (aa['G'] + aa['C'])) / len(seq)

        np = NotePad()
        tid = np.text_id()

        tid.insert('end', "%s\n\n" %
                   (time.strftime('%y %b %d, %X\n',
                                  time.localtime(time.time()))) +
                   "Length = %d\nA=%d C=%d G=%d T=%d other=%d\nGC=%f\n\n" %
                   (len(seq), aa['A'], aa['C'], aa['G'], aa['T'], aa['N'], GC))
开发者ID:abradle,项目名称:biopython,代码行数:21,代码来源:xbb_widget.py

示例6: Run

    def Run(self):
        self.notepad = NotePad()
        tid = self.notepad.tid
        self.notepad.menubar.configure(bg='red')

        self.toplevel.destroy()
        blastbg = xbb_blastbg.BlastDisplayer(self.command, tid)
        blastbg.RunCommand()

        # indicate the finished run by changing color
        try:
            self.notepad.menubar.configure(bg='green4')
        except:
            pass
开发者ID:tcyb,项目名称:biopython,代码行数:14,代码来源:xbb_blast.py

示例7: oldRun

    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
            if not char:
                break

        try:
            self.notepad.menubar.configure(bg='green')
        except:
            pass
开发者ID:tcyb,项目名称:biopython,代码行数:23,代码来源:xbb_blast.py

示例8: __init__

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
#.........这里部分代码省略.........
开发者ID:tcyb,项目名称:biopython,代码行数:101,代码来源:xbb_blast.py


注:本文中的xbb_utils.NotePad类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。