Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvestigationReader fails to properly report missing sections at EOF #104

Closed
sellth opened this issue Nov 2, 2023 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@sellth
Copy link
Collaborator

sellth commented Nov 2, 2023

The ISA-tab i_file is pretty standardised in that all sections need to be included. Altamisa reports ParseIsatabException if during parsing an unexpected line is read i.e. a required section header is missing. If a section is missing at the end of the file however, an unrelated exception is thrown.

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/sellts_c/Code/altamisa/altamisa/isatab/parse_investigation.py", line 163, in read
    studies = list(self._read_studies())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sellts_c/Code/altamisa/altamisa/isatab/parse_investigation.py", line 393, in _read_studies
    contacts = tuple(self._read_study_contacts())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sellts_c/Code/altamisa/altamisa/isatab/parse_investigation.py", line 584, in _read_study_contacts
    if not line[0] == investigation_headers.STUDY_CONTACTS:  # pragma: no cover
           ~~~~^^^
TypeError: 'NoneType' object is not subscriptable

This is caused by Altamisa only checking for unexpected lines and not taking into account that missing sections at the end of file do not have any following lines.

@sellth sellth added the bug Something isn't working label Nov 2, 2023
@sellth sellth self-assigned this Nov 2, 2023
@sellth
Copy link
Collaborator Author

sellth commented Jan 16, 2024

fixed in #113

@sellth sellth closed this as completed Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant