aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorzsloan2022-04-29 19:01:59 +0000
committerzsloan2022-04-29 19:15:28 +0000
commit65adda3923760252dd1dc94e8b5c894310885a69 (patch)
treeee62c5efefbf5a40f41ca489afae1ace76c9a040 /gn3
parent588702ebfbdafaa6cefd970aa45beabbda51fe40 (diff)
downloadgenenetwork3-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)
Diffstat (limited to 'gn3')
-rw-r--r--gn3/csvcmp.py8
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()))