tabula-sapiens icon indicating copy to clipboard operation
tabula-sapiens copied to clipboard

Annotations.py fails- dependency on old sklearn modules?

Open saeedfc opened this issue 2 years ago • 4 comments

Dear,

I wanted to perform annotations locally or with our cluster. So I made a new conda environment and went with the script available (for colab session) at your website upon running any cell where I have to import 'annotations', it throws an error as below.

from annotation import get_pretrained_model_genes, check_genes_is_subset
pretrained_scanvi_path = os.path.join(tissue, tissue + "_scanvi_model")
pretrained_scvi_path = os.path.join(tissue, tissue + "_scvi_model")

training_mode='online'
is_subset = False
if training_mode == 'online':
    pretrained_genes = get_pretrained_model_genes(pretrained_scvi_path)
    query_genes = query_adata.var_names.to_numpy().astype("str")
    is_subset = check_genes_is_subset(pretrained_genes, query_genes)

if is_subset and training_mode=='online':
    ref_adata = ref_adata[:, pretrained_genes]
else:
    training_mode = 'offline'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [11], in <cell line: 16>()
      1 # !conda install -c conda-forge sortedcontainers --yes
      2 # !conda uninstall tensorflow --yes
      3 # !conda uninstall tensorboard --yes
   (...)
     14 # !conda install tensorboard --yes
     15 #!conda install -c conda-forge tensorflow --yes
---> 16 from annotation import get_pretrained_model_genes, check_genes_is_subset
     17 pretrained_scanvi_path = os.path.join(tissue, tissue + "_scanvi_model")
     18 pretrained_scvi_path = os.path.join(tissue, tissue + "_scvi_model")

File /mnt/DATA1/Fibrosis/Fibrosis_2022/Annotation/scripts/annotation.py:14, in <module>
     11 import scvi
     12 import seaborn as sns
---> 14 from OnClass.OnClassModel import OnClassModel
     16 from sklearn import svm
     17 from sklearn.ensemble import RandomForestClassifier

File ~/anaconda3/envs/tsapiens/lib/python3.9/site-packages/OnClass/OnClassModel.py:6, in <module>
      3 import sys
      4 from sklearn.preprocessing import normalize
----> 6 from OnClass.OnClass_utils import *
      7 from OnClass.BilinearNN import BilinearNN
      9 class OnClassModel:

File ~/anaconda3/envs/tsapiens/lib/python3.9/site-packages/OnClass/OnClass_utils.py:19, in <module>
     17 from sklearn.metrics.pairwise import cosine_similarity
     18 #from libs import *
---> 19 from sklearn.utils.graph_shortest_path import graph_shortest_path
     20 from scipy.sparse.linalg import svds, eigs
     22 def get_ontology_parents(GO_net, g, dfs_depth):

ModuleNotFoundError: No module named 'sklearn.utils.graph_shortest_path'

It will be nice if a yaml file for the conda environment or list of versions of each package is provided. Thanks again and Kind regards, Saeed

saeedfc avatar May 25 '22 12:05 saeedfc

Hi,

Just saw a yml file on this github reposiory. I assume it's the one that I can try with. Thanks and Kind regards, Saeed

saeedfc avatar May 27 '22 10:05 saeedfc

Update: The yml file do not include scanorama and bbknn. Still not able to manage.

saeedfc avatar May 27 '22 12:05 saeedfc

I am having the same issue here. I wonder if this is the right function? https://scikit-learn.org/stable/modules/generated/sklearn.utils.graph.single_source_shortest_path_length.html?highlight=utils

clee700 avatar Sep 06 '22 23:09 clee700

Hello, I have the same issue. Do anyone had solved this problem ?

MrDIOUFsmd avatar Jun 13 '23 14:06 MrDIOUFsmd