diff options
author | zsloan | 2022-04-29 19:01:59 +0000 |
---|---|---|
committer | zsloan | 2022-04-29 19:15:28 +0000 |
commit | 65adda3923760252dd1dc94e8b5c894310885a69 (patch) | |
tree | ee62c5efefbf5a40f41ca489afae1ace76c9a040 | |
parent | 588702ebfbdafaa6cefd970aa45beabbda51fe40 (diff) | |
download | genenetwork3-65adda3923760252dd1dc94e8b5c894310885a69.tar.gz |
Replace whole header with the longest one, instead of just the
non-CaseAttribute headers (before this caused issues if someone was
adding case attributes to a file that already contained some case
attributes)
-rw-r--r-- | gn3/csvcmp.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py index 87a1610..82d491e 100644 --- a/gn3/csvcmp.py +++ b/gn3/csvcmp.py @@ -73,13 +73,9 @@ def csv_diff(base_csv, delta_csv, tmp_dir="/tmp") -> dict: longest_header = max(base_csv_header, delta_csv_header, key=lambda x: len(x)) if base_csv_header != delta_csv_header: if longest_header != base_csv_header: - base_csv = base_csv.replace( - "Strain Name,Value,SE,Count", longest_header, 1 - ) + base_csv = "\n".join([longest_header] + base_csv_list[1:]) else: - delta_csv = delta_csv.replace( - "Strain Name,Value,SE,Count", longest_header, 1 - ) + delta_csv = "\n".join([longest_header] + delta_csv_list[1:]) file_name1 = os.path.join(tmp_dir, str(uuid.uuid4())) file_name2 = os.path.join(tmp_dir, str(uuid.uuid4())) |