MStarmans91 / WORC

Workflow for Optimal Radiomics Classification
Other
66 stars 19 forks source link

Problems running tutorial #71

Closed Lieke2306 closed 2 years ago

Lieke2306 commented 2 years ago

I have been trying to run the WORC Simple tutorial for some time but I keep getting the same error:

Traceback (most recent call last):
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\validators\preflightcheck.py", line 123, in _validate
    label_data = load_labels(labels_file_train)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\processing\label_processing.py", line 49, in load_labels
    label_file)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\processing\label_processing.py", line 131, in load_label_csv
    raise ae.WORCAssertionError('First column should be patient ID!')
WORC.addexceptions.WORCAssertionError: First column should be patient ID!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "H:/PycharmProjects/RadiomicsPipeline/WORCTutorialSimple.py", line 199, in <module>
    main()
  File "H:/PycharmProjects/RadiomicsPipeline/WORCTutorialSimple.py", line 120, in main
    experiment.execute()
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 68, in dec
    raise e
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 64, in dec
    func(*args, **kwargs)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 655, in execute
    self._validate()
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 68, in dec
    raise e
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 64, in dec
    func(*args, **kwargs)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\facade\simpleworc.py", line 478, in _validate
    validator.do_validation(self)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\validators\preflightcheck.py", line 33, in do_validation
    result = self._validate(*args, **kwargs)
  File "C:\Program Files\Python3.7.9\lib\site-packages\WORC\validators\preflightcheck.py", line 127, in _validate
    raise ae.WORCValueError(f'First column in the file given to SimpleWORC().labels_from_this_file(**) needs to be named Patient.')
WORC.addexceptions.WORCValueError: First column in the file given to SimpleWORC().labels_from_this_file(**) needs to be named Patient.

I have made a file with the path H:\PycharmProjects\Data\Examplefiles\pinfo_HN but this also doesn't seem to work (see attached file). How can I fix this? pinfo_HN.csv

MStarmans91 commented 2 years ago

Thanks for your patience. To be clear: are you running exactly the WORC tutorial script, or did you make some changes to the script or to the input files? The tutorial is the unit test, so it should run. If you made any changes, can you attach your script, or describe the steps to reproduce the error?

The error suggests that WORC can at least find your file, so that's not the issue. The error message seems odd, as your first column is named Patient. However, you only have one column, that might be the issue. See the original pinfo_HN.csv file (https://github.com/MStarmans91/WORCTutorial/blob/master/Data/Examplefiles/pinfo_HN.csv): the first column should specify the object/patient name (hence the "Patient" header), and you should have at least one other column with the label you want to predict.

Lieke2306 commented 2 years ago

My file was indeed off, thank you!