chanwkimlab / MarcoPolo

MarcoPolo is a clustering-free approach to the exploration of bimodally expressed genes along with group information in single-cell RNA-seq data
https://chanwkimlab.github.io/MarcoPolo/HumanLiver/index.html
Other
19 stars 2 forks source link

KeyError: 'phenoid' (from generate_report function) #4

Closed hongsilv closed 2 years ago

hongsilv commented 2 years ago

Hi, I greatly thank you for the wonderful software.

I was trying MarcoPolo with my scRNA-seq data, I found that save_QQscore, save_MarcoPolo function works well, but "generate_report" function keeps giving me this error

------Drawing figures------
Traceback (most recent call last):
  File "/home/data/.conda/envs/MarcoPolo/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 4554, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 4562, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'phenoid'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/data/MarcoPolo/MarcoPolo_install/MarcoPolo/MarcoPolo/report.py", line 306, in generate_report
    plot_value=exp_data_meta_transformed['phenoid']
  File "/home/data/.conda/envs/MarcoPolo/lib/python3.7/site-packages/pandas/core/frame.py", line 3024, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/home/data/.conda/envs/MarcoPolo/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3082, in get_loc
    raise KeyError(key) from err
KeyError: 'phenoid'`

when I look at the outputs, "files index.html", "voting.html" and directory "assets" seems to be properly generated, but directory "plot_image" is empty. Can you help me resolve this error?

Thank you,

chanwkimlab commented 2 years ago

Hi @hongsilv,

Sorry for the inconvenience As you can see in the demo, the edges of cells are colored by on-off information, and the faces of cells are colored by additional data - usually, cell types. The error occurred because the code was assuming that the data for coloring the face was stored in the column named "phenoid" in the *.metadatacol.tsv file. Now that I have corrected the bug, users can choose the column they want to use for coloring the faces of cells or even choose not to color them. However, as the code changed a lot in this release, it might be not straightforward to use the new codes with the format of data you have obtained previously.

In your current situation, you can try the following workaround. If your *.metadatacol.tsv contains a column you want to use for coloring the faces of cells, a simple solution is to replace "phenoid" with the name of the column by modifying the code manually. (based on the error message, the path of the file is /home/data/MarcoPolo/MarcoPolo_install/MarcoPolo/MarcoPolo/report.py). If you don't have a column to do so, please just add "phenoid" column filled with ones to the *.metadatacol.tsv file.

Thank you so much for using our software. Please feel free to reach out if you have any other questions.

Best, Chanwoo

hongsilv commented 2 years ago

Thank you for your kind response. As you told me, I changed the one of column name into 'phenoid' , UMAP_1 to TSNE_1, UMAP_2 to TSNE_2 and all errors were resolved! Thank you very much.

Best regards, SungEun