예제 #1
0
    def show_multiple_assignment_table(self, categorized_peaks):

        ctext = ('The table below shows peak counts for peaks with more\n' +
                 'than one possible assignment.  These are categorized\n' +
                 'according to the shortest range assignment possible,\n' +
                 'intra residue, sequential, medium (2-4 residues), or\n' +
                 'long (5 or more residues apart).  The first line shows\n' +
                 'peaks having exactly one possible assignment of shortest\n' +
                 'range with additional longer range possiblities.  The next\n'
                 + 'line shows peak counts with 2 possible assignments of\n' +
                 'shortest range, ...\n\n')
        self.text.insert('end', ctext)

        rline = '%10s' % ''
        for r in range_names:
            rline = rline + ('%6s' % r)
        self.text.insert('end', rline + '\n')

        for range in ('1', '2', '3', '4+'):
            self.text.insert('end', '%-10s' % range)
            pline = ''
            uniqueness = range + '-shortest'
            for shortest_range in range_names:
                category = (uniqueness, shortest_range)
                if categorized_peaks.has_key(category):
                    count = len(categorized_peaks[category])
                    tag = uniqueness + '-' + shortest_range
                    self.text.insert('end', '%6d' % count, tag)
                    cb = pyutil.postcompose(self.show_category_cb, category)
                    self.text.tag_bind(tag, '<ButtonPress-1>', cb)
                else:
                    self.text.insert('end', '%6s' % '')
            self.text.insert('end', '\n')
예제 #2
0
    def show_shortest_range_table(self, peaks_by_range):

        ctext = 'Counts of peaks by shortest range assignment.\n\n'
        self.text.insert('end', ctext)

        rline = ''
        for r in range_names:
            rline = rline + ('%6s' % r)
        self.text.insert('end', rline + '\n')

        cline = ''
        for range_name in range_names:
            if peaks_by_range.has_key(range_name):
                count = len(peaks_by_range[range_name])
                tag = range_name + '-peaks'
                self.text.insert('end', '%6d' % count, tag)
                cb = pyutil.postcompose(self.show_range_cb, range_name)
                self.text.tag_bind(tag, '<ButtonPress-1>', cb)
            else:
                self.text.insert('end', '%6s' % '')
        self.text.insert('end', '\n\n')
예제 #3
0
    def draw_assignments(self, peak_assignments, color):

        lines = {}
        for peak, assignment in peak_assignments:
            nums = []
            for r in assignment:
                if r.atom.nucleus == '1H':
                    nums.append(r.group.number)
            if len(nums) == 2:
                pyutil.table_push(lines, tuple(nums), peak)

        for (num1, num2), peaks in lines.items():
            b = self.position[num1]
            e = self.position[num2]
            id = self.canvas.create_line(b[0],
                                         b[1],
                                         e[0],
                                         e[1],
                                         width=len(peaks),
                                         fill=color)
            cb = pyutil.postcompose(self.show_peaks_cb, peaks)
            self.canvas.tag_bind(id, '<ButtonPress-1>', cb)
예제 #4
0
    def show_unique_assignment_table(self, categorized_peaks):

        ctext = 'Peaks with one possible assignment.\n\n'
        self.text.insert('end', ctext)

        rline = ''
        for r in range_names:
            rline = rline + ('%6s' % r)
        self.text.insert('end', rline + '\n')

        cline = ''
        for range_name in range_names:
            category = ('unique', range_name)
            if categorized_peaks.has_key(category):
                count = len(categorized_peaks[category])
                tag = 'unique-' + range_name
                self.text.insert('end', '%6d' % count, tag)
                cb = pyutil.postcompose(self.show_category_cb, category)
                self.text.tag_bind(tag, '<ButtonPress-1>', cb)
            else:
                self.text.insert('end', '%6s' % '')
        self.text.insert('end', '\n\n')
예제 #5
0
    def show_assignment_count_table(self, categorized_peaks):

        ptext = 'Peak counts with 0, 1, 2, ... possible assignments.\n\n'
        self.text.insert('end', ptext)

        ctable = {}
        for category, plist in categorized_peaks.items():
            if type(category) == types.IntType:
                ctable[category] = 1
        counts = ctable.keys()
        counts.sort()

        cline = ''
        for c in counts:
            cline = cline + ('%4d' % c)
        self.text.insert('end', cline + '\n')

        for c in counts:
            field = ('%4d' % len(categorized_peaks[c]))
            tag = 'count%d' % c
            self.text.insert('end', field, tag)
            cb = pyutil.postcompose(self.show_category_cb, c)
            self.text.tag_bind(tag, '<ButtonPress-1>', cb)
        self.text.insert('end', '\n\n')