From 05aa44aff92c827d81596e04cab97ab252e5876a Mon Sep 17 00:00:00 2001 From: Tom David Mueller Date: Wed, 3 Dec 2025 11:43:27 +0100 Subject: [PATCH] Fix TypeError when protein description is not a string Handle cases where protein description values may be non-string types (e.g., NaN, float) by explicitly converting to string before truncation. This prevents "TypeError: object of type 'float' has no len()" errors when parsing FLASHTnT results. --- src/parse/tnt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse/tnt.py b/src/parse/tnt.py index 0cf351e8..1b0e1ec1 100644 --- a/src/parse/tnt.py +++ b/src/parse/tnt.py @@ -34,7 +34,7 @@ def parseTnT(file_manager, dataset_id, deconv_mzML, anno_mzML, tag_tsv, protein_ } ) protein_df['description'] = protein_df['description'].apply( - lambda x: x[:50] + '...' if len(x) > 50 else x + lambda x: str(x)[:50] + '...' if len(str(x)) > 50 else str(x) ) file_manager.store_data(dataset_id, 'protein_dfs', protein_df) logger.log("30.0 %", level=2)