Fix madc2vcf_all() "invalid substring arguments" error on off-target alleles#65
Open
shbrainard wants to merge 6 commits into
Open
Conversation
Updated funding source and note about BIGr development.
CRAN 7.2 submission
…atches
When add_others = TRUE, compare() computed other_ref_base/other_alt_base with
substring() before checking that any mismatch positions remained. If an off-target
("Other") allele aligns to the reference with its only mismatch at the target SNP
position, that position is removed and pos_ref_idx/pos_alt_idx become integer(0),
so substring() errors with "invalid substring arguments" and the whole run aborts.
Move the two substring() calls inside the existing 'if (length(pos_ref_idx) > 0)'
guard, mirroring how the off-target Match alleles are already handled. Behavior is
unchanged when mismatch positions remain; existing madc2vcf_all tests still pass.
Collaborator
|
Hi @shbrainard! Good to have codes from you. Thank you for your contribution, we will take a look and let you know :) |
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
madc2vcf_all(..., add_others = TRUE)aborts withError: ... invalid substring argumentson some DArTag datasets.Root cause
In
compare()(R/madc2vcf_all.R), the off-target ("Other") branch computesother_ref_base/other_alt_basewithsubstring()before the existingif (length(pos_ref_idx) > 0)check. When an "Other" allele aligns to the reference with its only mismatch at the target SNP position, that index is removed, leavingpos_ref_idx/pos_alt_idxasinteger(0).substring(x, integer(0), integer(0))errors with "invalid substring arguments", and aborts the run.The off-target Match branch already protects its
substring()calls with the samelength(pos_ref_idx) > 0check; the Other branch applies this check too late.Fix
Move the two
substring()calls inside the existingif (length(pos_ref_idx) > 0)block, mirroring the Match branch. No behavior change when mismatch positions remain.Verification
add_others = TRUEpipeline completes.tests/testthat/test-madc2vcf_all.Rsuite passes.