Skip to content

BaseParser: fast path for insertion of dependent xrefs

Created by: mkszuba

Warning: this PR is now dependent on #326

Description

Factor insertion of dependent_xref entries out of add_dependent_xref() so that it can be used independently.

Use case

Parsers inserting dependent-xref mappings which do not insert xrefs themselves, e.g. Mim2GeneParser.

Benefits

Parsers which are not supposed to insert xrefs themselves will now no longer insert stub xrefs upon e.g. encountering a typo. In the event of a single accession pointing to multiple xref_ids dependent mappings can now be correctly assigned to those IDs, whereas using add_dependent_xref() would assign them all to the first matching xref_id returned by the database. Considerable performance gain thanks to fewer conversations with the database. API behaviour for inserting dependent xrefs is now consistent with that for inserting direct ones, albeit due to a name collision functions doing the same thing have different names for the two.

Possible Drawbacks

When the fast path is used validation of xref IDs is left up to the programmer, therefore it may now be easier to insert mappings pointing to xrefs which do not exist.

Testing

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

If so, do the tests pass/fail? N/A

Have you run the entire test suite and no regression was detected? N/A but I have tested the changes by running a parser which uses the relevant bits of code (i.e. my delinted version of Mim2GeneParser) and the changes seem to do what they should.

Merge request reports