Skip to content

Commit

Permalink
solve bug of none value in profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
dengzq1234 committed Mar 21, 2024
1 parent 25fcaf4 commit 6055db3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions treeprofiler/layouts/profile_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ def __init__(self, seq, value2color=None,
self.seq = seq
self.seqlength = len(self.seq)
self.value2color = value2color
self.absence_color = '#EBEBEB'

self.autoformat = True # block if 1px contains > 1 tile

Expand All @@ -699,7 +700,7 @@ def __init__(self, seq, value2color=None,
self.w_scale = self.width / total_width
else:
self.width = total_width


# Text
self.ftype = ftype
Expand Down Expand Up @@ -813,7 +814,7 @@ def get_height(x, y):
# 'ftype': 'sans-serif', # default sans-serif
# }
tooltip = f'<p>{seq}</p>'
yield draw_array(sm_box, [self.value2color[x] for x in seq], tooltip=tooltip)
yield draw_array(sm_box, [self.value2color[x] if x else self.absence_color for x in seq], tooltip=tooltip)
#yield draw_text(sm_box, for i in seq, "jjj", style=style)

if self.seq_format == "categorical":
Expand All @@ -822,4 +823,4 @@ def get_height(x, y):
y, h = get_height(sm_x, y)
sm_box = Box(sm_x+sm_x0, y, posw * len(seq), h)
tooltip = f'<p>{seq}</p>'
yield draw_array(sm_box, [self.value2color[x] for x in seq], tooltip=tooltip)
yield draw_array(sm_box, [self.value2color[x] if x else self.absence_color for x in seq], tooltip=tooltip)

0 comments on commit 6055db3

Please sign in to comment.