diff --git a/muon/_atac/tools.py b/muon/_atac/tools.py index 246dc4f..448ddda 100644 --- a/muon/_atac/tools.py +++ b/muon/_atac/tools.py @@ -900,7 +900,7 @@ def tss_enrichment( extend_downstream: int = 1000, n_tss: int = 2000, return_tss: bool = True, - random_state=None, + random_state: int | None = 0, barcodes: Optional[str] = None, ): """ diff --git a/muon/_core/tools.py b/muon/_core/tools.py index e88f055..2e71623 100644 --- a/muon/_core/tools.py +++ b/muon/_core/tools.py @@ -930,7 +930,7 @@ def _cluster( data: Union[MuData, AnnData], resolution: Optional[Union[float, Sequence[float], Mapping[str, float]]] = None, mod_weights: Optional[Union[Sequence[float], Mapping[str, float]]] = None, - random_state: int = 0, + random_state: int | None = 0, key_added: str = "louvain", neighbors_key: str = None, directed: bool = True, @@ -1003,7 +1003,7 @@ def _cluster( partition_type = alg.RBConfigurationVertexPartition optimiser = alg.Optimiser() - if random_state: + if random_state is not None: optimiser.set_rng_seed(random_state) # The same as leiden.find_partition_multiplex() (louvain.find_partition_multiplex()) @@ -1059,7 +1059,7 @@ def leiden( data: Union[MuData, AnnData], resolution: Optional[Union[float, Sequence[float], Mapping[str, float]]] = None, mod_weights: Optional[Union[Sequence[float], Mapping[str, float]]] = None, - random_state: int = 0, + random_state: int | None = 0, key_added: str = "leiden", neighbors_key: str = None, directed: bool = True, @@ -1135,7 +1135,7 @@ def louvain( data: Union[MuData, AnnData], resolution: Optional[Union[float, Sequence[float], Mapping[str, float]]] = None, mod_weights: Optional[Union[Sequence[float], Mapping[str, float]]] = None, - random_state: int = 0, + random_state: int | None = 0, key_added: str = "louvain", neighbors_key: str = None, directed: bool = True, @@ -1368,7 +1368,7 @@ def ica( basis="X_pca", n_components=None, *, - random_state=None, + random_state: int | None = 0, scale=False, copy=False, **kwargs, diff --git a/muon/_prot/preproc.py b/muon/_prot/preproc.py index 5f03b90..e8501b9 100644 --- a/muon/_prot/preproc.py +++ b/muon/_prot/preproc.py @@ -22,7 +22,7 @@ def dsb( empty_counts_range: Optional[Tuple[Real, Real]] = None, cell_counts_range: Optional[Tuple[Real, Real]] = None, add_layer: bool = False, - random_state: Optional[Union[int, np.random.RandomState, None]] = None, + random_state: Optional[Union[int, np.random.RandomState, None]] = 0, ) -> Union[None, MuData]: """ Normalize protein expression with DSB (Denoised and Scaled by Background)