Skip to content

Commit 6055db3

Browse files
committed
solve bug of none value in profiling
1 parent 25fcaf4 commit 6055db3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

treeprofiler/layouts/profile_layouts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ def __init__(self, seq, value2color=None,
681681
self.seq = seq
682682
self.seqlength = len(self.seq)
683683
self.value2color = value2color
684+
self.absence_color = '#EBEBEB'
684685

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

@@ -699,7 +700,7 @@ def __init__(self, seq, value2color=None,
699700
self.w_scale = self.width / total_width
700701
else:
701702
self.width = total_width
702-
703+
703704

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

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

0 commit comments

Comments
 (0)