log1p warns adata.X is logged when it may not be (when other layers are logged)
See original GitHub issueWhen I use sc.pp.log1p(adata)
and then sc.pp.log1p(adata, layer='other')
it warns me that the data has already been logged even though I am logging a layer as opposed to adata.X.
Would be nice to flag logging for each layer instead of when anything is logged.
import scanpy as sc
adata = sc.datasets.pbmc3k_processed()
adata.layers['other'] = adata.X
sc.pp.log1p(adata, layer='other')
sc.pp.log1p(adata)
WARNING: adata.X seems to be already log-transformed.
Versions:
scanpy==1.5.2.dev5+ge5d246aa anndata==0.7.3 umap==0.3.10 numpy==1.18.5 scipy==1.5.0 pandas==1.0.5 scikit-learn==0.23.1 statsmodels==0.11.1 python-igraph==0.7.1 louvain==0.6.1 leidenalg==0.7.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
log1p warns adata.X is logged when it may not be (when other ...
When I use sc.pp.log1p(adata) and then sc.pp.log1p(adata, layer='other') it warns me that the data has already been logged even though I am ...
Read more >Numpy: RuntimeWarning: invalid value encountered in log1p
I am encountering a warning during np.log1p : RuntimeWarning: invalid value encountered in log1p , but I can't figure why.
Read more >dynamo.preprocessing.utils — dynamo 1.1.0 documentation
if np.all(adata.var_names.str.startswith("ENS")) or scopes is not None: logger ... or ensembl.transcript and thus cannot " "convert them automatically.
Read more >tf.keras.Sequential | TensorFlow v2.11.0
Sequential groups a linear stack of layers into a tf.keras.Model. ... Note that jit_compile=True may not necessarily work for all models. ... x,...
Read more >Overview — celloracle 0.10.13 documentation - GitHub Pages
Also, this notebook does NOT use celloracle in this notebook. ... WARNING: In Scanpy 0. ... X.copy() # Log transformation and scaling sc.pp.log1p(adata) ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Guys we should just keep the layer info here in log1p:
data.uns[‘log1p’] = {‘base’: base}
like
data.uns[‘log1p’][layer] = {‘base’: base}
I must also mention that upon reading in the data:
adata.uns['log1p']
returns{}
;adata.uns['log1p']["base"] = None
after reading doesn’t help.del adata.uns['log1p']
solves the problem. Visual inspection of expression values inadata.X
seem to not be log-transformed.