handle empty rows
@@ -210,7 +210,9 @@ class KgtkVisualize:
label_label_idx = kr.column_name_map['label;label']
for row in kr:
- # collect nodes from the edge file, incase node file is not present or a node is missing from the node file
+ if len(row) == len(kr.column_name_map):
+ # collect nodes from the edge file,
+ # incase node file is not present or a node is missing from the node file
node1_label = row[node1_label_idx]
node2_label = row[node2_label_idx]
if '@' in node1_label:
@@ -329,6 +331,7 @@ class KgtkVisualize:
raise ValueError("no id column in node file")
for row in kr_node:
+ if len(row) == len(kr_node.column_name_map):
_id = row[kr_node.column_name_map[self.node_file_id]]
temp = {'id': _id}
self.node_set.add(_id)
@@ -378,7 +381,8 @@ class KgtkVisualize:
temp['color'] = self.node_color_default
if self.node_size_column is not None:
- _node_size = KgtkVisualize.convert_string_float(row[kr_node.column_name_map[self.node_size_column]])
+ _node_size = KgtkVisualize.convert_string_float(
+ row[kr_node.column_name_map[self.node_size_column]])
if _node_size is not None:
temp['orig_size'] = _node_size
else:
