aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2022-04-29 18:59:57 +0000
committerzsloan2022-04-29 18:59:57 +0000
commit588702ebfbdafaa6cefd970aa45beabbda51fe40 (patch)
tree312a7789ed3e3a8c46eb29db1c8d5d971ae4c3f4
parent39afc680ea3eac81a2e5fff763c1cd1a51156bb5 (diff)
downloadgenenetwork3-588702ebfbdafaa6cefd970aa45beabbda51fe40.tar.gz
Get max string length instead when comparing headers
Apparently max(string1, string2) in Python gets the strong that is highest alphabetically, but I'm pretty sure this line was intenteded to get the header with the most items (which this commit doesn't fully address; you could still end up with a situation where some case attributes were removed while others were added, though that should be rare)
-rw-r--r--gn3/csvcmp.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py
index 24cbee0..87a1610 100644
--- a/gn3/csvcmp.py
+++ b/gn3/csvcmp.py
@@ -69,8 +69,8 @@ def csv_diff(base_csv, delta_csv, tmp_dir="/tmp") -> dict:
if line.startswith("Strain Name,Value,SE,Count"):
base_csv_header, delta_csv_header = line, delta_csv_list[i]
break
- longest_header = max(base_csv_header, delta_csv_header)
+ 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(