Skip to content

Feature/baseparser throw on unknown source

Created by: mkszuba

Description

Have BaseParser::get_source_id_by_source_name() throw an exception rather than return -1 in the event of being unable to find a matching source ID. Backport from ensembl-xref.

Use case

I have yet to see a parser which continues happily if it cannot get the ID of a source, therefore each and every one of the parsers I have seen implemented some variant of "if -1, abort". Moreover, the warning message produced before returning -1 has not exactly been helpful.

Benefits

More consistent behaviour of xref parsers, simpler backporting from ensembl-xref.

Possible Drawbacks

Xref parsers currently being backported which have not been merged into feature/xref_sprint yet and use BaseParser::get_source_id_by_source_name() will have to be adapted back to ensembl-xref-like behaviour, especially if their respective unit tests check what exception is thrown upon failure to retrieve a source ID.

Testing

Have you added/modified unit tests to test the changes?

I have updated the expected exception message in omim.t and mim2gene.t, which at present are the only two files affected.

If so, do the tests pass/fail?

They pass.

Have you run the entire test suite and no regression was detected?

Yes, no regression detected.

Merge request reports