Mercurial > repos > tduigou > get_db_info
diff get_db_info.py @ 13:5b16f2911491 draft default tip
planemo upload for repository https://github.com/brsynth commit 6ae809b563b40bcdb6be2e74fe2a84ddad5484ae
| author | tduigou |
|---|---|
| date | Fri, 23 May 2025 13:47:21 +0000 |
| parents | ee28ec28140d |
| children |
line wrap: on
line diff
--- a/get_db_info.py Fri May 23 12:45:20 2025 +0000 +++ b/get_db_info.py Fri May 23 13:47:21 2025 +0000 @@ -106,17 +106,18 @@ # Compare fragments between CSV and DB csv_fragments = set() - all_ids = set(df[0]) + all_ids = set(df[0].dropna().astype(str)) for _, row in df.iterrows(): for col in df.columns: - if col != 0: # Skip the first column + if col != 0: fragment = row[col] - if fragment not in all_ids: - csv_fragments.add(fragment) + if pd.notna(fragment): + fragment_str = str(fragment) + if fragment_str not in all_ids: + csv_fragments.add(fragment_str) db_fragments = set(fragment_map.keys()) missing_fragments = sorted(list(csv_fragments - db_fragments)) - if missing_fragments: raise ValueError( f" Missing fragments in DB: {', '.join(missing_fragments)}" @@ -128,6 +129,8 @@ for col in df.columns: if col != 0: fragment = row[col] + if fragment not in csv_fragments: + continue db_row = fragment_map.get(fragment) if db_row:
