コード例 #1
0
ファイル: __init__.py プロジェクト: yohell/msaview
 def render(self, cr, area):
     if self.cscore is None or self.cscore.sequence_cscores is None:
         return
     height = len(self.cscore.sequence_cscores)
     first_seq, y_offset = divmod(float(height * area.y) / area.total_height, 1)
     first_seq = int(first_seq)
     last_seq = min(int(height * float(area.y + area.height) / area.total_height), height - 1)
     n_seq = min(last_seq - first_seq + 1, height)
     cr.rectangle(0, 0, area.width, area.height)
     cr.clip()
     cr.translate(-area.x, 0)
     # Guide lines
     cr.set_source_rgba(*Color(215, 215, 215, self.alpha).rgba)
     v_quartile_guidelines(cr, area.height, area.y, area.total_width, area.total_height)
     # Bar plot
     v_bar(cr, self.gradient, self.alpha, self.cscore.sequence_cscores, first_seq, n_seq, area.y, area.total_width, area.total_height)
     # Bottom line
     cr.set_source_rgba(.7, .7, .7, self.alpha)
     cr.set_dash([])
     cr.set_line_width(0.5)
     x = 0.25
     if not vector_based(cr):
         cr.set_line_width(1)
         x = 0.5
     cr.move_to(x, -1)
     cr.line_to(x, area.height)
     cr.stroke()
コード例 #2
0
ファイル: __init__.py プロジェクト: yohell/msaview
 def render(self, cr, area):
     if self._label_size is None:
         return
     detail = self.get_detail_size()
     if area.total_height >= detail[1]:
         return Labeler.render(self, cr, area)
     # If we don't have enough space to draw legible labels we can at least do a label sized shading. 
     values = [float(i)/area.total_width for i in self._label_widths]
     first_label, n_labels, yscale = get_view_extents(area.y, area.height, area.total_height, len(self.get_data()))
     cr.rectangle(0, 0, area.width, area.height)
     cr.clip()
     cr.translate(-area.x + 1, 0)
     v_bar(cr, None, None, values, first_label, n_labels, area.y, area.total_width, area.total_height)
     if vector_based(cr):
         cr.set_source_rgba(.85, .85, .85, self.alpha)
     else:
         cr.set_source(chequers((.5, .5, .5, self.alpha), (0, 0, 0, 0), 1))
     cr.fill()