From 1764c7e053c38f58b8e86c18a0761374cdde63c0 Mon Sep 17 00:00:00 2001
From: Peter Swain <pswain@Home-iMac.local>
Date: Wed, 1 May 2024 12:54:26 +0100
Subject: [PATCH] change: set to list for new pandas version

---
 src/agora/io/signal.py                       | 4 ++--
 src/agora/io/writer.py                       | 2 +-
 src/postprocessor/core/reshapers/buddings.py | 4 ++--
 src/postprocessor/core/reshapers/tracks.py   | 4 +++-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/agora/io/signal.py b/src/agora/io/signal.py
index d63746dd..6abfeb17 100644
--- a/src/agora/io/signal.py
+++ b/src/agora/io/signal.py
@@ -178,8 +178,8 @@ class Signal(BridgeH5):
             else:
                 return merged
         if len(picks):
-            picked_indices = set(picks).intersection(
-                [tuple(x) for x in merged.index]
+            picked_indices = list(
+                set(picks).intersection([tuple(x) for x in merged.index])
             )
             return merged.loc[picked_indices]
         else:
diff --git a/src/agora/io/writer.py b/src/agora/io/writer.py
index 567b8da7..ac783a9f 100644
--- a/src/agora/io/writer.py
+++ b/src/agora/io/writer.py
@@ -595,7 +595,7 @@ class Writer(BridgeH5):
             new_tps = set(df.columns)
             if path + "/timepoint" in f:
                 new_tps = new_tps.difference(f[path + "/timepoint"][()])
-            df = df[new_tps]
+            df = df[list(new_tps)]
 
             if (
                 not hasattr(self, "id_cache")
diff --git a/src/postprocessor/core/reshapers/buddings.py b/src/postprocessor/core/reshapers/buddings.py
index 9c17428f..37667ba6 100644
--- a/src/postprocessor/core/reshapers/buddings.py
+++ b/src/postprocessor/core/reshapers/buddings.py
@@ -57,7 +57,7 @@ class buddings(LineageProcess):
                 traps_mothers[(trap, mother)].append(daughter)
         # a new dataframe with dimensions (n_mother_cells * n_tps)
         mothers = signal.loc[
-            set(signal.index).intersection(traps_mothers.keys())
+            list(set(signal.index).intersection(traps_mothers.keys()))
         ]
         buddings = pd.DataFrame(
             np.zeros(mothers.shape).astype(bool),
@@ -76,6 +76,6 @@ class buddings(LineageProcess):
                 fvi.index.intersection(trap_daughter_ids)
             ].values
             # ignore zeros - buds in first image are not budding events
-            daughters_idx = set(times_of_bud_appearance).difference({0})
+            daughters_idx = list(set(times_of_bud_appearance).difference({0}))
             buddings.loc[trap_mother_id, daughters_idx] = True
         return buddings
diff --git a/src/postprocessor/core/reshapers/tracks.py b/src/postprocessor/core/reshapers/tracks.py
index 4023f52b..89c90e4f 100644
--- a/src/postprocessor/core/reshapers/tracks.py
+++ b/src/postprocessor/core/reshapers/tracks.py
@@ -62,7 +62,9 @@ def get_merges(tracks, smooth=False, tol=0.2, window=5, degree=3) -> dict:
     # remove traps with no contiguous tracks
     contigs = contigs.loc[contigs.apply(len) > 0]
     # flatten to (trap, cell_id) pairs
-    flat = set([k for v in contigs.values for i in v for j in i for k in j])
+    flat = list(
+        set([k for v in contigs.values for i in v for j in i for k in j])
+    )
     # make a data frame of contiguous tracks with the tracks as arrays
     if smooth:
         smoothed_tracks = clean.loc[flat].apply(
-- 
GitLab