Teichlab / bbknn

Batch balanced KNN
MIT License
149 stars 25 forks source link

problem : name 'logg' is not defined #42

Closed ahmedibatta closed 3 years ago

ahmedibatta commented 3 years ago

I tried to redo this example to using bbknn demo (https://nbviewer.jupyter.org/github/Teichlab/bbknn/blob/master/examples/demo.ipynb) but I faced two problem 1- NameError: name 'logg' is not defined 2- AttributeError: module 'bbknn' has no attribute 'ridge_regression'


NameError Traceback (most recent call last)

in 3 except ImportError: 4 pass ----> 5 bbknn.bbknn(adata) 6 sc.tl.umap(adata) 7 sc.pl.umap(adata, color=['batch','celltype']) ~\miniconda3\envs\sc_trial\lib\site-packages\bbknn\__init__.py in bbknn(adata, batch_key, approx, metric, copy, **kwargs) 259 ''' 260 start = logg.info('computing batch balanced neighbors') --> 261 adata = adata.copy() if copy else adata 262 #basic sanity checks to begin 263 #is our batch key actually present in the object? NameError: name 'logg' is not defined ________________________________________________________________________________________________ 2- regression : AttributeError: module 'bbknn' has no attribute 'ridge_regression' I am working on windows and I changed bbknn between 1.3.6 and 1.4 and 1.5 and same problem in all how can I solve these problems?
ktpolanski commented 3 years ago

The first error implies from scanpy import logging as logg did not work. I'd ask if you have scanpy installed, but I presume you managed to read the input objects.

I cannot replicate the second error - just installed off pip and I sure as heck have access to bbknn.ridge_regression(). Any version 1.4.0 and on does.

ahmedibatta commented 3 years ago

Thanks for your reply, actually I updated the bbknn and installed the package (logging & logger ) through pip and it worked but another error appears: when trying sc.tl.umap(adata)

AttributeError: module 'umap' has no attribute 'version'

version installed : scanpy==1.7.0 anndata==0.7.4 numpy==1.20.3 scipy==1.6.3 pandas==1.2.4 scikit-learn==0.22.2.post1 statsmodels==0.11.1 python-igraph==0.8.2 leidenalg==0.8.3 umap-learn==0.5.1

for second error , when updated bbknn , gave me another error for ridge.regression bbknn.ridge_regression(adata, batch_key=['batch'], confounder_key=['leiden']) KeyError: "['leiden'] not in index"
however it is be installed leidenalg==0.8.3

ktpolanski commented 3 years ago

Having a module installed will not make .obs['leiden'] appear in your object. Running sc.tl.leiden() will. You did not mention that command being troublesome. Also that command is not part of BBKNN.

Whatever sc.tl.umap() weirdness you're encountering has nothing to do with BBKNN either.

You may have better luck contacting the scanpy team about this.