-
Notifications
You must be signed in to change notification settings - Fork 699
Closed
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 scanpy.
- (optional) I have confirmed this bug exists on the main branch of scanpy.
What happened?
When I used sc.pp.scale(adata_filtered, max_value=10, layer='log1p_norm')to specify scaling the 'log1p_norm layer', I found that the function output was not stored by default in .X, but instead overwrote the 'log1p_norm' layer. When I did not specify a layer and used the default adata_filtered.X with sc.pp.scale(adata_filtered, max_value=10, layer=None), the output correctly updated adata_filtered.X
Minimal code sample
#The following code will reproduce the described issue
sc.pp.normalize_total(adata_filtered,target_sum=1e4,layer=None)
sc.pp.log1p(adata_filtered,base=None,layer=None)
adata_filtered.layers['log1p_norm']=adata_filtered.X.copy()
sc.pp.highly_variable_genes(adata_filtered,n_top_genes=2000,batch_key='Sample',layer='log1p_norm')
sc.pp.scale(adata_filtered,max_value=10,layer='log1p_norm')
#The issue will not occur after modifying the layer parameter of sc.pp.scale layer=None instead of layer='log1p_norm'
sc.pp.normalize_total(adata_filtered,target_sum=1e4,layer=None)
sc.pp.log1p(adata_filtered,base=None,layer=None)
adata_filtered.layers['log1p_norm']=adata_filtered.X.copy()
sc.pp.highly_variable_genes(adata_filtered,n_top_genes=2000,batch_key='Sample',layer='log1p_norm')
sc.pp.scale(adata_filtered,max_value=10,layer=None)Error output
Versions
| Dependency | Version |
|---|---|
| lazy_loader | 0.4 |
| psutil | 7.2.1 |
| asttokens | 3.0.1 |
| pytz | 2025.2 |
| llvmlite | 0.46.0 |
| numba | 0.63.1 |
| prompt_toolkit | 3.0.52 |
| stack-data | 0.6.3 |
| debugpy | 1.8.19 |
| tornado | 6.5.4 |
| PyYAML | 6.0.3 |
| decorator | 5.2.1 |
| patsy | 1.0.2 |
| natsort | 8.4.0 |
| executing | 2.2.1 |
| parso | 0.8.5 |
| pyarrow | 22.0.0 |
| six | 1.17.0 |
| charset-normalizer | 3.4.4 |
| setuptools | 80.9.0 |
| cycler | 0.12.1 |
| joblib | 1.5.3 |
| python-dateutil | 2.9.0.post0 |
| ipython | 8.37.0 |
| statsmodels | 0.14.6 |
| kiwisolver | 1.4.9 |
| wcwidth | 0.2.14 |
| leidenalg | 0.11.0 |
| pillow | 12.1.0 |
| pure_eval | 0.2.3 |
| igraph | 1.0.0 |
| h5py | 3.15.1 |
| texttable | 1.7.0 |
| pynndescent | 0.5.13 |
| jedi | 0.19.2 |
| Component | Info |
|---|---|
| Python | 3.10.19 |
| OS | Linux-5.15.0-86-generic-x86_64-with-glibc2.35 |
| CPU | 96 logical CPU cores, x86_64 |
| GPU | No GPU found |
| Updated | 2026-01-07 17:20 |

Metadata
Metadata
Assignees
Labels
No labels