open-cravat icon indicating copy to clipboard operation
open-cravat copied to clipboard

rdata download option not working

Open samuelbharti opened this issue 1 year ago • 1 comments

On web interface https://run.opencravat.org/ The rdata generation option works for example data with 1 default annotator selected but doesn't work if more/all annotators (155) are selected. It throws an error like this: Screenshot 2023-12-21 at 1 53 35 PM

I'm assuming only certain annotations are supported for rdata currently. Is there are documentation for same?

samuelbharti avatar Dec 21 '23 19:12 samuelbharti

All annotations should work with rdata reports. This is a bug with the following traceback. It looks like one or more of the annotators is generating data that is difficult to convert to R. We'll work on narrowing down which annoator is the culprit.

root@b59eeb8e513a:/mnt/jobs/[email protected]/240112-182300# oc report input.sqlite -t rdata --debug
Generating rdata report... Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/cravat/cravat_report.py", line 1129, in run_reporter
    response_t = loop.run_until_complete(reporter.run())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nest_asyncio.py", line 99, in run_until_complete
    return f.result()
           ^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/futures.py", line 203, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 277, in __step
    result = coro.send(None)
             ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cravat/cravat_report.py", line 586, in run
    ret = self.end()
          ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/cravat/modules/reporters/rdatareporter/rdatareporter.py", line 91, in end
    pyreadr.write_rdata(self.filename, level_data, df_name=f'{self.filename_prefix}_{level}')
  File "/usr/local/lib/python3.11/site-packages/pyreadr/pyreadr.py", line 155, in write_rdata
    writer.write_r(filename_bytes, file_format, df, df_name, dateformat, datetimeformat, compress)
  File "/usr/local/lib/python3.11/site-packages/pyreadr/_pyreadr_writer.py", line 226, in write_r
    tcol = transform_data(col, pyreadr_types[column], hasmissing[indx], dateformat, datetimeformat)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyreadr/_pyreadr_writer.py", line 144, in transform_data
    if type(pd_series.dtype) is pd.core.dtypes.dtypes.CategoricalDtype:
            ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pandas/core/generic.py", line 6204, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DataFrame' object has no attribute 'dtype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/cravat/oc.py", line 238, in main
    args.func(args)
  File "/usr/local/lib/python3.11/site-packages/cravat/cravat_report.py", line 1140, in run_reporter
    loop.run_until_complete(reporter.cf.close_db())
                            ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'close_db'

kmoad avatar Jan 12 '24 18:01 kmoad