gao-lab/GLUE

KeyError: '__scglue__'

Closed this issue · 2 comments

When i tried to load glue.dill model, and run scglue.models.integration_consistency, it came out of the error KeyError: '__scglue__'

KeyError                                  Traceback (most recent call last)
Cell In[4], line 15
      8 guidance = nx.read_graphml(os.path.join(main_path, "guidance.graphml.gz"))
     10 guidance_hvf = guidance.subgraph(chain(
     11     rna.var.query("highly_variable").index,
     12     atac.var.query("highly_variable").index
     13 )).copy()
---> 15 dx = scglue.models.integration_consistency(
     16     glue, {"rna": rna, "atac": atac}, guidance_hvf
     17 )

File ~/anaconda3/lib/python3.11/site-packages/scglue/models/dx.py:60, in integration_consistency(model, adatas, graph, **kwargs)
     57     adata.obsm["X_glue"] = model.encode_data(k, adata)
     59 for k, adata in adatas.items():
---> 60     use_layer = adata.uns[config.ANNDATA_KEY]["use_layer"]
     61     if use_layer:
     62         logger.info("Using layer \"%s\" for modality \"%s\"", use_layer, k)

KeyError: '__scglue__'

Hi @OswaldoBornemann. Thanks for the report! Just to make sure, have you run configure_dataset() on rna and atac objects? It seems that you are trying to load the model trained in another Jupyter kernel. You may either save and load the configured datasets along with the model, or configure these datasets again.

Oh I see. Thank you very much.