Skip to content

feat: Add components method to Variant class#40

Merged
afrubin merged 2 commits intomainfrom
feature/bencap/39/interface-for-hgvs-substrings
May 6, 2025
Merged

feat: Add components method to Variant class#40
afrubin merged 2 commits intomainfrom
feature/bencap/39/interface-for-hgvs-substrings

Conversation

@bencap
Copy link
Contributor

@bencap bencap commented Apr 3, 2025

Adds a components method to the Variant class which is a tuple of fully qualified variant strings that comprises the current variant object. The format_variant function was refactored into a new function _format_component_variants, which returns a list of the component variants of a Variant object. In turn, the repr function uses this class function to return the variant string representation. The components method returns the result of this new internal formatting function, with the prefix and transcript identifier prepended to each variant string.

For multi-variants, each tuple element is parsable into a single-variant Variant object which comprises the original multi-variant. For single- variants, the single element tuple contains the original variant string.

Closes #39.

@bencap bencap added the enhancement New feature or request label Apr 3, 2025
@bencap bencap requested a review from afrubin April 3, 2025 14:53
@bencap bencap force-pushed the feature/bencap/39/interface-for-hgvs-substrings branch from 9f3611d to 427f22c Compare April 3, 2025 15:37
Adds a `components` method to the Variant class which is a tuple
of fully qualified variant strings that comprises the current variant
object. The `format_variant` function was refactored into a new
function `_format_component_variants`, which returns a list of the
component variants of a Variant object. In turn, the __repr__ function
uses this class function to return the variant string representation.
The `components` method returns the result of this new internal
formatting function, with the prefix and transcript identifier prepended
to each variant string.

For multi-variants, each tuple element is parsable into a single-variant
Variant object which comprises the original multi-variant. For single-
variants, the single element tuple contains the original variant string.
@bencap bencap force-pushed the feature/bencap/39/interface-for-hgvs-substrings branch from 427f22c to 99b1b29 Compare April 3, 2025 15:39
@bencap bencap force-pushed the feature/bencap/39/interface-for-hgvs-substrings branch from 488adce to dff5572 Compare April 3, 2025 15:55
@afrubin afrubin merged commit ecf42f6 into main May 6, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a Convenient Interface for Accessing (or re-Constructing) Multi-Variant HGVS Sub-strings

2 participants