Skip to content

Commit 05aa44a

Browse files
committed
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.
1 parent ba00399 commit 05aa44a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/parse/tnt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def parseTnT(file_manager, dataset_id, deconv_mzML, anno_mzML, tag_tsv, protein_
3434
}
3535
)
3636
protein_df['description'] = protein_df['description'].apply(
37-
lambda x: x[:50] + '...' if len(x) > 50 else x
37+
lambda x: str(x)[:50] + '...' if len(str(x)) > 50 else str(x)
3838
)
3939
file_manager.store_data(dataset_id, 'protein_dfs', protein_df)
4040
logger.log("30.0 %", level=2)

0 commit comments

Comments
 (0)