Skip to content

Commit

Permalink
chore(column): remove columns which contain all None
Browse files Browse the repository at this point in the history
  • Loading branch information
giangbui committed Apr 4, 2018
1 parent 3779f8e commit 6b6ec5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion peregrine/utils/json2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def dicts2tsv(dict_list):
header_set = set()

for dict_row in dict_list:
header_set.update(dict_row.keys())
for key in dict_row.keys():
if (dict_row[key] is not None and dict_row[key] != []):
header_set.update([key])

for h in header_set:
words = h.split('-')
Expand Down
5 changes: 3 additions & 2 deletions peregrine/utils/pybdbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def create_bdbag(bag_info, payload, max_row=1000):
header_set = set()

for dict_row in json_data:
header_set.update(dict_row.keys())
for key in dict_row.keys():
if (dict_row[key] is not None and dict_row[key] != []):
header_set.update([key])

with open(bag_path + '/data/' + node_name + '.tsv', 'w') as tsvfile:
writer = csv.writer(tsvfile, delimiter='\t')
Expand Down Expand Up @@ -65,7 +67,6 @@ def create_bdbag(bag_info, payload, max_row=1000):
shutil.rmtree(zip_dir)
return zip_file_name


def zipdir(path, ziph):
length = len(path)
# ziph is zipfile handle
Expand Down

0 comments on commit 6b6ec5c

Please sign in to comment.