Skip to content

Fix copies=0 producing wrong VRS object type#621

Merged
korikuzma merged 3 commits intoga4gh:mainfrom
knQzx:fix/copies-zero-falsy
Apr 2, 2026
Merged

Fix copies=0 producing wrong VRS object type#621
korikuzma merged 3 commits intoga4gh:mainfrom
knQzx:fix/copies-zero-falsy

Conversation

@knQzx
Copy link
Copy Markdown
Contributor

@knQzx knQzx commented Mar 26, 2026

copies=0 in _from_hgvs falls through to CopyNumberChange branch
because if copies: treats 0 as falsy. changed to if copies is not None:

@knQzx knQzx requested review from a team as code owners March 26, 2026 16:38
@knQzx
Copy link
Copy Markdown
Contributor Author

knQzx commented Mar 26, 2026

found this while reading the translator - copies=0 is valid (homozygous deletion) but gets skipped since 0 is falsy in python

Copy link
Copy Markdown
Contributor

@korikuzma korikuzma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Would you be able to add a test for this issue in test_cnv_translator.py ?

@knQzx
Copy link
Copy Markdown
Contributor Author

knQzx commented Apr 2, 2026

thanks for the feedback! added a test for it - checks that copies=0 gives back CopyNumberCount and not CopyNumberChange

@theferrit32 theferrit32 requested a review from korikuzma April 2, 2026 18:56
Copy link
Copy Markdown
Contributor

@korikuzma korikuzma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🚀

@korikuzma korikuzma merged commit 596b07c into ga4gh:main Apr 2, 2026
8 checks passed
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.

2 participants