Skip to content

Make the shared RLE sequence limit configurable - #660

Open
Shubham-Padkonde wants to merge 2 commits into
ga4gh:mainfrom
Shubham-Padkonde:feat/configurable-rle-sequence-limit
Open

Shubham-Padkonde wants to merge 2 commits into
ga4gh:mainfrom
Shubham-Padkonde:feat/configurable-rle-sequence-limit

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

The RLE sequence limit is currently repeated as 50 in normalization, translation, and VCF output. Add a shared GA4GH_VRS_RLE_SEQ_LIMIT environment setting so these paths agree, as requested in #598.

The default remains 50 bases. A non-negative integer selects the limit, 0 omits optional sequence values, and none disables the limit. The setting is read at import time; invalid values produce an error naming the setting. Explicit normalization/translation arguments still override the default. Documentation includes a CLI example.

Validation on Python 3.12/Linux:

  • Eight new subprocess tests exercise actual normalization, translation, and VCF output with recorded SeqRepo responses, plus invalid settings. Five fail before the change; all pass afterward.
  • Full suite: 145 passed with the bundled SeqRepo fixture configured and VCR recording disabled.
  • Ruff lint/format and repository pre-commit checks pass.

Prepared with Codex assistance. Fixes #598.

Running the three affected modules alone produces three existing VCR cassette failures; the same failures reproduce against unchanged source. The full suite above passes.

@Shubham-Padkonde
Shubham-Padkonde requested review from a team as code owners September 29, 2026 16:59

@korikuzma korikuzma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Shubham-Padkonde Thanks for making this PR! I'd like to see the tests changed before approval/merge.

Comment thread src/ga4gh/vrs/config.py Outdated


def _get_rle_seq_limit() -> int | None:
"""Read the maximum optional RLE sequence length from the environment."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it'd be good to have docs here too

Suggested change
"""Read the maximum optional RLE sequence length from the environment."""
"""Read the maximum optional RLE sequence length from the environment.
Set `GA4GH_VRS_RLE_SEQ_LIMIT` environment variable to change
the maximum length of optional `ReferenceLengthExpression.sequence` values.
The default is `50` bases. Use a non-negative integer, `0` to omit the optional
sequence, or `none` (case-insensitive) for no limit.
:raise ValueError: If provided value is not an integer or is a negative value
"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we could avoid using subprocess with a full script (it's a little hard to read and I imagine it could be hard to maintain). Could we instead look into mocking the environment variables in our existing tests (such as

def test_rle_seq_limit(tlr):
and https://github.com/ga4gh/vrs-python/blob/main/tests/extras/test_annotate_vcf.py)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah generally the recommended way to injectj/manage env vars in tests is with the pytest monkeypatch module

https://docs.pytest.org/en/stable/how-to/monkeypatch.html#monkeypatching-environment-variables

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.

RLE_SEQ_LIMIT should be configurable

3 participants