Skip to content

Annotations.py fails- dependency on old sklearn modules? #35

Description

@saeedfc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions