deweylab / CellO

CellO: Gene expression-based hierarchical cell type classification using the Cell Ontology
MIT License
64 stars 13 forks source link

Error after not finding pre-training models (ir.dill) #21

Open ivandatasci opened 2 years ago

ivandatasci commented 2 years ago

Hello everyone.

I just installed the latest cello-classify version with pip. Version 2.0.3. Installation went fine.

When I try to use it, I get an error.

I execute this cell in a JupyterLab notebook:

cello.scanpy_cello(adata0a,
                   clust_key='leiden',
                   rsrc_loc='/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130',
                   out_prefix='/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130/cello_model00',
                   log_dir='/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130')

and this is the error:

       Could not find the CellO resources directory called
        'resources' in '/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130'. Will download resources to current 
        directory.

Running command: curl http://deweylab.biostat.wisc.edu/cell_type_classification/resources_v2.0.0.tar.gz > /mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130/resources_v2.0.0.tar.gz
Running command: tar -C /mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130 -zxf resources_v2.0.0.tar.gz
Running command: rm /mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130/resources_v2.0.0.tar.gz
Checking if any pre-trained model is compatible with this input dataset...
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-45-2570c77cb08a> in <module>
      4 #sc.pp.neighbors(adata0a, n_neighbors=15)
      5 #sc.tl.leiden(adata0a, resolution=2.0)
----> 6 cello.scanpy_cello(adata0a,
      7                    clust_key='leiden',
      8                    rsrc_loc='/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130',

/usr/local/lib/python3.9/site-packages/cello/scanpy_cello.py in cello(adata, clust_key, rsrc_loc, algo, out_prefix, model_file, log_dir, term_ids, remove_anatomical_subterms)
    127     else:
    128         # Load or train a model
--> 129         mod = ce._retrieve_pretrained_model(adata, algo, rsrc_loc)
    130         if mod is None:
    131             mod = ce.train_model(

/usr/local/lib/python3.9/site-packages/cello/cello.py in _retrieve_pretrained_model(ad, algo, rsrc_loc)
    329                 model_fname
    330             )
--> 331             with open(model_f, 'rb') as f:
    332                 mod = dill.load(f)
    333             feats = mod.classifier.features

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/b0/compbio-ebs-01/igr/d0/220317_000000/130/resources/trained_models/ir.dill'

Could somebody offer some guidance?

Thank you.

Ivan

alexisthermofisher commented 1 year ago

Hi Ivan,

Were you ever able to figure it out? I am also having issues with my CellO resources directory.

Thanks!

mbernste commented 1 year ago

My apologies for the trouble. I just fixed the bug. If you re-install CellO via pip install -U cello-classify, then the new version should hopefully work now. Let me know if you still experience an issue.

TomSmithCGAT commented 7 months ago

I'm getting the same error. I downloaded the resources and unpacked with:

wget https://deweylab.biostat.wisc.edu/cell_type_classification/resources_v2.0.0.tar.gz; tar -xvf resources_v2.0.0.tar.gz

which gives me the following output:

x resources/
x resources/gene_metadata/
x resources/trained_models/
x resources/README
x resources/training_set/
x resources/training_set/labels.json
x resources/training_set/experiment_to_study.json
x resources/training_set/experiment_to_tags.json
x resources/training_set/log_tpm.h5: truncated gzip input
tar: Error exit delayed from previous errors.

and the following files:

 ls resources/* 
resources/README

resources/gene_metadata:

resources/trained_models:

resources/training_set:
experiment_to_study.json    experiment_to_tags.json     labels.json         log_tpm.h5

I installed cello-classify v 2.1.1 in my conda env with pip:

$conda list|grep cello
cello-classify            2.1.1                    pypi_0    pypi