question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

log1p warns adata.X is logged when it may not be (when other layers are logged)

See original GitHub issue

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 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:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
gokceneraslancommented, Jul 28, 2020

Guys we should just keep the layer info here in log1p:

data.uns[‘log1p’] = {‘base’: base}

like

data.uns[‘log1p’][layer] = {‘base’: base}

0reactions
Benfeitascommented, Aug 10, 2022

I must also mention that upon reading in the data:

  • running adata.uns['log1p'] returns {};
  • setting adata.uns['log1p']["base"] = None after reading doesn’t help.
  • running del adata.uns['log1p'] solves the problem. Visual inspection of expression values in adata.X seem to not be log-transformed.
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found