diff --git a/src/agora/io/signal.py b/src/agora/io/signal.py index d63746dd059eb17219548c8da19b4c12450eb18d..6abfeb1742289857732298cac6e21d6d98f2c89d 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 567b8da746d080841153159a509af0bc4088162b..ac783a9f0c5d60521dbff8053ff72fe8ad14233c 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 9c17428fa480090e1c16240c742f545df83a4787..37667ba6fcdc8c69f6ef9cab4ade18730ed00e61 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 4023f52bdecaa39a92b3a5960e077f458cf8e971..89c90e4fafffa5bbcd0261b1319017148234f337 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(