gao-lab / GLUE

Graph-linked unified embedding for single-cell multi-omics data integration
MIT License
365 stars 56 forks source link

KeyError at Draft a coexpression-based network #117

Closed yolcasmar closed 4 months ago

yolcasmar commented 5 months ago

Hi,

Thank you for providing this amazing tool!

I've encountered some issues while trying to build a co-expression-based draft network in the 'Regulatory inference' tutorial. When I execute the following command:

!pyscenic grn rna.loom tfs.txt \ -o draft_grn.csv --seed 0 --num_workers 20 \ --cell_id_attribute cells --gene_attribute genes

I encounter the following error: `Traceback (most recent call last): File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/loompy/attribute_manager.py", line 115, in getattr vals = self.dict["storage"][name] KeyError: 'genes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/yolanda/miniforge3/envs/scglue/bin/pyscenic", line 8, in sys.exit(main()) File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 713, in main args.func(args) File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 59, in find_adjacencies_command ex_mtx = load_exp_matrix( File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 134, in load_exp_matrix return load_exp_matrix_as_loom( File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 88, in load_exp_matrix_as_loom ... return self.getattr(thing) File "/home/yolanda/miniforge3/envs/scglue/lib/python3.10/site-packages/loompy/attribute_manager.py", line 123, in getattr raise AttributeError(f"'{type(self)}' object has no attribute '{name}'") AttributeError: '<class 'loompy.attribute_manager.AttributeManager'>' object has no attribute 'genes'`

I have successfully completed previous tutorials without any issues, so I'm curious as to what might be causing this problem.

Thank you, Yolanda

Jeff1995 commented 4 months ago

Hi @yolcasmar, thanks for your interest in GLUE! Could you try assigning the name to rna.obs_names and rna.var_names before saving it to loom? This can be done by the following commands:

rna.obs_names.name = "cells"
rna.var_names.name = "genes"
yolcasmar commented 4 months ago

Thank you for your response!

I've tried it and it works perfectly. Therefore, I will now close this issue.