Skip to content

Commit

Permalink
Copy the estimator instead
Browse files Browse the repository at this point in the history
  • Loading branch information
michalk8 committed Mar 4, 2024
1 parent 0acf391 commit a0c1c1c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cellrank/estimators/terminal_states/_gpcca.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,11 @@ def tsi(
if cluster_key is None:
raise RuntimeError("`cluster_key` needs to be specified to compute TSI.")

# copy the `adata` object to avoid overwrites, as the estimator overrides some keys
adata = self.adata.copy()
# create a new GPCCA object to avoid unsetting attributes
# that depend on the macrostates, e.g. the terminal states
g = self.copy(deep=True)
macrostates = {}
for n_states in range(1, n_macrostates):
# create a new GPCCA object to avoid unsetting attributes that depend on the macrostates,
# e.g. the terminal states
g = GPCCA(self.transition_matrix, adata=adata)
for n_states in range(n_macrostates, 0, -1):
g = g.compute_macrostates(n_states=n_states, cluster_key=cluster_key, **kwargs)
macrostates[n_states] = g.macrostates.cat.categories

Expand Down

0 comments on commit a0c1c1c

Please sign in to comment.