yuzhenmao / ScRAT

Implementation of Phenotype prediction from single-cell RNA-seq data using attention-based neural networks (Bioinformatics).
9 stars 2 forks source link

A further question when running custom data #3

Closed HelloWorldLTY closed 2 months ago

HelloWorldLTY commented 2 months ago

Hi, when trying to run the custom data, I found a new error:

Traceback (most recent call last):
  File "/gpfs/scratchfs01/site/u/liut61/ScRAT/main.py", line 355, in <module>
    auc, acc, cm, recall, precision = train(x_train, x_valid, x_test, y_train, y_valid, y_test, id_train, id_test,
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/gpfs/scratchfs01/site/u/liut61/ScRAT/main.py", line 258, in train
    print(f"{test_id[idx]} -- true: {label_dict[true[idx]]} -- pred: {label_dict[pred[idx]]}")
                                     ^^^^^^^^^^
NameError: name 'label_dict' is not defined. Did you mean: 'label_stat'?

I think it is caused by these lines in the main function:

if args.task == 'haniffa' or args.task == 'combat':
    label_dict = {0: 'Non Covid', 1: 'Covid'}
elif args.task == 'severity':
    label_dict = {0: 'mild', 1: 'severe'}
elif args.task == 'stage':
    label_dict = {0: 'convalescence', 1: 'progression'}

It seems that you missed to assign label_dict for custom dataset. Maybe we need a elif args.task == 'custom', label_dict=xx here. Is it correct? Thanks.

yuzhenmao commented 2 months ago

Hi! Thank you for pointing this out. You are absolutely correct. I have updated the README file to instruct users to also modify line 83 in main.py when using the custom dataset.

HelloWorldLTY commented 2 months ago

Ok, thanks.