pepkit / eido

Validator for PEP objects
http://eido.databio.org
BSD 2-Clause "Simplified" License
5 stars 5 forks source link

eido convert filters for csv and yaml appear to be broken #70

Closed Redmar-van-den-Berg closed 2 months ago

Redmar-van-den-Berg commented 3 months ago

I have a PEP project which appears to be functional when using it with peppy, and also the eido filters yaml-samples and basic run without error.

But when I try to convert it to yaml or csv, eido crashes with various error messages:

eido convert -f yaml project_config.yml 
Running plugin yaml
Traceback (most recent call last):
  File "/data/micromamba/envs/peppy/bin/eido", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/cli.py", line 123, in main
    convert_project(p, args.format, plugin_kwargs)
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 44, in convert_project
    return run_filter(prj, target_format, plugin_kwargs=plugin_kwargs or dict())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 80, in run_filter
    conv_result = func(prj, **plugin_kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion_plugins.py", line 44, in yaml_pep_filter
    data = p.config.to_dict()
           ^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'to_dict'
eido convert -f csv project_config.yml 
Running plugin csv
Traceback (most recent call last):
  File "/data/micromamba/envs/peppy/bin/eido", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/cli.py", line 123, in main
    convert_project(p, args.format, plugin_kwargs)
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 44, in convert_project
    return run_filter(prj, target_format, plugin_kwargs=plugin_kwargs or dict())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 80, in run_filter
    conv_result = func(prj, **plugin_kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion_plugins.py", line 57, in csv_pep_filter
    return {"samples": MultilineOutputFormatter.format(p.samples)}
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 33, in format
    sample_rows = MultilineOutputFormatter._split_sample_to_multiple_rows(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 78, in _split_sample_to_multiple_rows
    sample_row = MultilineOutputFormatter._conveeido convert -f csv project_config.yml 
Running plugin csv
Traceback (most recent call last):
  File "/data/micromamba/envs/peppy/bin/eido", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/cli.py", line 123, in main
    convert_project(p, args.format, plugin_kwargs)
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 44, in convert_project
    return run_filter(prj, target_format, plugin_kwargs=plugin_kwargs or dict())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion.py", line 80, in run_filter
    conv_result = func(prj, **plugin_kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/conversion_plugins.py", line 57, in csv_pep_filter
    return {"samples": MultilineOutputFormatter.format(p.samples)}
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 33, in format
    sample_rows = MultilineOutputFormatter._split_sample_to_multiple_rows(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 78, in _split_sample_to_multiple_rows
    sample_row = MultilineOutputFormatter._convert_sample_to_row(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 111, in _convert_sample_to_row
    value = sample[attribute][sample_index]
            ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range
rt_sample_to_row(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/micromamba/envs/peppy/lib/python3.12/site-packages/eido/output_formatters.py", line 111, in _convert_sample_to_row
    value = sample[attribute][sample_index]
            ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range
Redmar-van-den-Berg commented 3 months ago

I think this is related to the fact that I have multiple subsample_tables, which do not all contain the same samples.