-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Description
Please make sure these conditions are met
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pertpy.
- (optional) I have confirmed this bug exists on the main branch.
Report
hi
- Final Parameter and log2-fold change have different signs , the same issue was reported before in the Final Parameter and log2-fold change have different signs theislab/scCODA#84 , but the user mentioned it was fixed after using the pertpy implementation not the old scCODA . but it seem i have the issue here anyways!
sccoda_model.run_nuts(sccoda_data)
sccoda_model.summary(data=sccoda_data)
age B.Atypical_memory 0.000 34.645 0.615 │
│ B.CD5 0.000 11.824 0.615 │
│ B.Naive -0.330 285.626 0.139 │
│ B.Switched_memory -0.489 81.738 -0.090 │
│ B.non_Switched_memory -0.818 78.201 -0.565 │
│ MAIT -1.003 54.991 -0.832 │
│ MONO.CD14 -0.309 458.904 0.169 │
│ MONO.CD16 0.000 66.100 0.615
- although run_nuts work fine, run_hmc seem to give this issue, any idea why?
TypeError Traceback (most recent call last)
Cell In[35], line 1
----> 1 sccoda_model.run_hmc(sccoda_data)
File [~/venvs/newdeseq/lib/python3.11/site-packages/pertpy/tools/_coda/_base_coda.py:383](https://rstudio.pasteur.fr/s/01e0021f2ed723836f690/lab/tree/helix/projects/LabExMI/singleCell/V3/scRNA_NS_IAV_COV/scripts/15_for_figures/~/venvs/newdeseq/lib/python3.11/site-packages/pertpy/tools/_coda/_base_coda.py#line=382), in CompositionalModel2.run_hmc(self, data, modality_key, num_samples, num_warmup, rng_key, copy, *args, **kwargs)
380 rng_key = random.key(rng_key)
382 # Set up HMC kernel
--> 383 sample_adata = self.set_init_mcmc_states(
384 rng_key, sample_adata.uns["scCODA_params"]["reference_index"], sample_adata
385 )
386 init_params = sample_adata.uns["scCODA_params"]["mcmc"]["init_params"]
387 hmc_kernel = HMC(self.model, *args, init_strategy=initialization.init_to_value(values=init_params), **kwargs)
File [~/venvs/newdeseq/lib/python3.11/site-packages/pertpy/tools/_coda/_sccoda.py:204](https://rstudio.pasteur.fr/s/01e0021f2ed723836f690/lab/tree/helix/projects/LabExMI/singleCell/V3/scRNA_NS_IAV_COV/scripts/15_for_figures/~/venvs/newdeseq/lib/python3.11/site-packages/pertpy/tools/_coda/_sccoda.py#line=203), in Sccoda.set_init_mcmc_states(self, rng_key, ref_index, sample_adata)
201 beta_nobl_size = [D, P - 1]
203 # Initial MCMC states
--> 204 rng = np.random.default_rng(seed=rng_key)
206 sample_adata.uns["scCODA_params"]["mcmc"]["init_params"] = {
207 "sigma_d": np.ones(dtype=np.float64, shape=sigma_size),
208 "b_offset": rng.normal(0.0, 1.0, beta_nobl_size),
209 "ind_raw": np.zeros(dtype=np.float64, shape=beta_nobl_size),
210 "alpha": rng.normal(0.0, 1.0, alpha_size),
211 }
213 return sample_adata
File numpy[/random/_generator.pyx:5084](https://rstudio.pasteur.fr/random/_generator.pyx#line=5083), in numpy.random._generator.default_rng()
File numpy[/random/_pcg64.pyx:123](https://rstudio.pasteur.fr/random/_pcg64.pyx#line=122), in numpy.random._pcg64.PCG64.__init__()
File numpy[/random/bit_generator.pyx:535](https://rstudio.pasteur.fr/random/bit_generator.pyx#line=534), in numpy.random.bit_generator.BitGenerator.__init__()
File numpy[/random/bit_generator.pyx:307](https://rstudio.pasteur.fr/random/bit_generator.pyx#line=306), in numpy.random.bit_generator.SeedSequence.__init__()
TypeError: SeedSequence expects int or sequence of ints for entropy not Array((), dtype=key<fry>) overlaying:
[ 0 4178] ```
### Versions
```markdown
| Package | Version |
| ---------- | ------- |
| pertpy | 1.0.3 |
| pandas | 2.3.2 |
| matplotlib | 3.10.6 |
| scanpy | 1.11.4 |
| anndata | 0.12.2 |
| Dependency | Version |
| ------------------- | --------------------- |
| PyYAML | 6.0.2 |
| xarray | 2025.11.0 |
| fast-array-utils | 1.3.1 |
| pyparsing | 3.2.3 |
| h5py | 3.14.0 |
| six | 1.17.0 |
| urllib3 | 2.5.0 |
| ipython | 9.5.0 |
| tornado | 6.5.2 |
| sparsecca | 0.3.1 |
| PubChemPy | 1.0.5 |
| chex | 0.1.91 |
| pyomo | 6.9.5 |
| python-dateutil | 2.9.0.post0 |
| decorator | 5.2.1 |
| packaging | 25.0 |
| opt_einsum | 3.4.0 |
| executing | 2.2.1 |
| statsmodels | 0.14.5 |
| asttokens | 3.0.0 |
| lineax | 0.0.8 |
| certifi | 2025.8.3 (2025.08.03) |
| debugpy | 1.8.16 |
| idna | 3.10 |
| fsspec | 2025.10.0 |
| llvmlite | 0.44.0 |
| charset-normalizer | 3.4.3 |
| blitzgsea | 1.3.54 |
| kiwisolver | 1.4.9 |
| Pygments | 2.19.2 |
| absl-py | 2.3.1 |
| zarr | 3.1.2 |
| jupyter_client | 8.6.3 |
| toolz | 1.1.0 |
| etils | 1.13.0 |
| pytz | 2025.2 |
| platformdirs | 4.4.0 |
| natsort | 8.4.0 |
| parso | 0.8.5 |
| lamin_utils | 0.15.0 |
| ott-jax | 0.6.0 |
| xarray-einstats | 0.9.1 |
| multipledispatch | 1.0.0 (0.6.0) |
| prompt_toolkit | 3.0.52 |
| jax | 0.8.1 |
| importlib_resources | 6.5.2 |
| wcwidth | 0.2.13 |
| mudata | 0.3.2 |
| jupyter_core | 5.8.1 |
| pillow | 11.3.0 |
| jaxlib | 0.8.1 |
| threadpoolctl | 3.6.0 |
| flax | 0.12.0 |
| jaxtyping | 0.3.3 |
| ml_dtypes | 0.5.4 |
| numcodecs | 0.16.2 |
| setuptools | 65.5.0 |
| pyzmq | 27.1.0 |
| scikit-misc | 0.5.2 |
| session-info2 | 0.2.1 |
| numpyro | 0.19.0 |
| typing_extensions | 4.15.0 |
| arviz | 0.22.0 |
| cycler | 0.12.1 |
| optax | 0.2.6 |
| filelock | 3.20.0 |
| seaborn | 0.13.2 |
| joblib | 1.5.2 |
| pure_eval | 0.2.3 |
| simplejson | 3.20.2 |
| jaxopt | 0.8.5 |
| jedi | 0.19.2 |
| wadler_lindig | 0.1.7 |
| crc32c | 2.7.1 |
| ipykernel | 6.30.1 |
| scipy | 1.15.3 |
| pyarrow | 21.0.0 |
| donfig | 0.8.1.post1 |
| ply | 3.11 |
| numba | 0.61.2 |
| psutil | 7.0.0 |
| comm | 0.2.3 |
| numpy | 2.2.6 |
| stack-data | 0.6.3 |
| traitlets | 5.14.3 |
| legacy-api-wrap | 1.4.1 |
| adjustText | 1.3.0 |
| msgpack | 1.1.2 |
| equinox | 0.13.2 |
| patsy | 1.0.1 |
| scikit-learn | 1.7.2 |
| mpmath | 1.3.0 |
| rich | 14.2.0 |
| tqdm | 4.67.1 |
| requests | 2.32.5 |
| Component | Info |
| --------- | --------------------------------------------------------- |
| Python | 3.11.5 (main, Aug 28 2023, 07:39:50) [GCC 9.2.0] |
| OS | Linux-4.18.0-553.58.1.el8_10.x86_64-x86_64-with-glibc2.28 |
| Updated | 2025-11-20 12:51 |