Skip to content

fix: keep existing references in list attributes in ga4gh_enref - #699

Open
syahra712 wants to merge 1 commit into
ga4gh:mainfrom
syahra712:fix/enref-list-references
Open

syahra712 wants to merge 1 commit into
ga4gh:mainfrom
syahra712:fix/enref-list-references

Conversation

@syahra712

Copy link
Copy Markdown
Contributor

ga4gh_enref keeps a single referable attribute that is already a reference (a string or iriReference) and checks that it is a GA4GH identifier. The list branch skips that check and calls _enref on every item, so a list that already holds references fails:

from ga4gh.vrs import models, vrs_enref

store = {}
enreffed = vrs_enref(cis_phased_block, object_store=store)
vrs_enref(enreffed, object_store=store)
# AttributeError: 'iriReference' object has no attribute 'type'

# Same for a block built with one member given by id and one inlined
vrs_enref(models.CisPhasedBlock(members=["ga4gh:VA....", allele_dict]))

The reference check is now a small _is_reference helper used by both branches. List items that are already references are kept as they are, and a non-GA4GH CURIE in a list raises the same TypeError as a single attribute does. Inlined list items are enref'd as before. The single-attribute behaviour is unchanged.

Tests

test_enref_list_attribute_with_references in tests/test_vrs.py enrefs an already-enref'd CisPhasedBlock, enrefs a block with one referenced and one inlined member, and checks the TypeError for a non-GA4GH CURIE member. It fails on main with the AttributeError above and passes with this change. ruff check and ruff format --check (v0.9.4) are clean. The rest of the suite passes locally, except tests that need a local SeqRepo at /usr/local/share/seqrepo (test_dataproxy, test_vrs_normalize).

This is independent of #698, which fixes the matching list branch in ga4gh_deref.

@syahra712
syahra712 requested review from a team as code owners November 12, 2026 07:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant