diff --git a/doubletdetection/doubletdetection.py b/doubletdetection/doubletdetection.py index 7c683de..c9cd086 100644 --- a/doubletdetection/doubletdetection.py +++ b/doubletdetection/doubletdetection.py @@ -96,6 +96,7 @@ def __init__( self.standard_scaling = standard_scaling self.n_jobs = n_jobs self.pseudocount = pseudocount + self.rng = np.random.default_rng(self.random_state) if self.clustering_algorithm not in ["louvain", "phenograph", "leiden"]: raise ValueError( @@ -148,7 +149,7 @@ def fit(self, raw_counts: NDArray | sp_sparse.csr_matrix) -> "BoostClassifier": raw_counts = check_array( raw_counts, accept_sparse="csr", - force_all_finite=True, + ensure_all_finite=True, ensure_2d=True, dtype="float32", ) @@ -390,8 +391,7 @@ def _createDoublets(self) -> None: num_synths = int(self.boost_rate * self._num_cells) # Parent indices - rng = np.random.default_rng(self.random_state) - choices = rng.choice(self._num_cells, size=(num_synths, 2), replace=self.replace) + choices = self.rng.choice(self._num_cells, size=(num_synths, 2), replace=self.replace) parents = [list(p) for p in choices] parent0 = self._raw_counts[choices[:, 0], :] diff --git a/pyproject.toml b/pyproject.toml index 9306e15..c33abac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "doubletdetection" -version = "4.3" +version = "4.3.0.post1" description = "Method to detect and enable removal of doublets from single-cell RNA-sequencing." readme = "README.md" requires-python = ">=3.10"