Add fallback for proxy VCF construction failures on small/single-sample objects#43
Merged
remlapmot merged 5 commits intoMRCIEU:masterfrom Mar 16, 2026
Merged
Add fallback for proxy VCF construction failures on small/single-sample objects#43remlapmot merged 5 commits intoMRCIEU:masterfrom
remlapmot merged 5 commits intoMRCIEU:masterfrom
Conversation
Refactor proxy VCF construction to include error handling and fallback mechanism for compatibility with small/single-sample VCF objects.
Collaborator
|
Thanks for this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR keeps the existing
proxy_match()proxy-construction logic as the default path, and adds a compatibility fallback that is only used when the original implementation fails during proxy VCF construction.The goal is to fix a failure mode I encountered in my environment without changing behavior for users whose workflows already succeed with the current implementation.
In particular, the original code path is still attempted first. The fallback is only triggered if
VariantAnnotationgenotype-slot replacement fails during construction of the proxy VCF object.Background
proxy_match()currently builds a proxyVCFobject and then modifies itsgenoslot after construction by:PRgeno header fieldESvalues when allele orientation requires sign reversalPRgenotype matrix to track the proxy rsID usedIn my case, this post-construction S4 replacement pattern failed with a subscript/dimension-related error during manipulation of
geno(prox). The failure appears to be associated with small or effectively single-sample VCF-like objects, whereVariantAnnotation's replacement behavior can be fragile.The functional intent of the original code is correct, so this PR does not replace that logic globally. Instead, it preserves the original implementation and adds a narrowly scoped fallback for the failing case.
What this PR changes
This PR updates only the proxy VCF construction section inside
proxy_match().The new behavior is:
Attempt the original implementation exactly as before.
If that succeeds, return the result unchanged.
If that fails, catch the error and rebuild the proxy VCF using a compatibility path that:
PRmatrix before VCF constructionVCFobject once, instead of relying on post-hocgenoslot replacementThis means existing successful cases continue using the original code path, and only problematic cases use the fallback.