From 588702ebfbdafaa6cefd970aa45beabbda51fe40 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 29 Apr 2022 18:59:57 +0000 Subject: 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) --- gn3/csvcmp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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( -- cgit v1.2.3