Skip to content

Bug on post-processing in read-lab metadata-dropdowns with enums #872

@ESapenaVentura

Description

@ESapenaVentura

Description of the Issue

When processing laboratory metadata with the read-lab-metadata module, I came across an error:

Traceback (most recent call last):
  File "~/Desktop/repiiis/relecov-tools/.venv/lib/python3.12/site-packages/relecov_tools/__main__.py", line 400, in read_lab_metadata
    new_metadata.create_metadata_json()
  File "~/Desktop/repiiis/relecov-tools/.venv/lib/python3.12/site-packages/relecov_tools/read_lab_metadata.py", line 1047, in create_metadata_json
    completed_metadata = self.adding_ontology_to_enum(extended_metadata)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/Desktop/repiiis/relecov-tools/.venv/lib/python3.12/site-packages/relecov_tools/read_lab_metadata.py", line 590, in adding_ontology_to_enum
    sample_id = m_data[idx][self.unique_sample_id]
                ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'sequencing_sample_id'

While investigating, we found that this was caused by an issue when a value that is not in the accepted enum values in the schema and expects ontologies is provided.

When this happens, the function tries to extract the name of the sample, which for RELECOV is sequencing_sample_id, but this is not the case for all the JSON schemas.

Currently, we don't know where this misconfiguration happens - A bit more research is needed!

Extra info

A capture of a debug session available in slack: https://bu-isciii.slack.com/archives/C02JSQ5CEBB/p1772797157605379

AI

  • Investigate how self.unique_sample_id is set up and fix it to adapt to other schemas
  • Create PR and merge

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions