Fix and refactor create_irma_vcf.py#720
Open
PauPascualMas wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72e6bf3d47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
PR Description
This PR improves IRMA-to-VCF conversion, with a focus on indel normalization, variant-filtering consistency, malformed-input handling, and VCF-safe output.
The previous implementation could discard contextual allele rows too early, fail while processing missing numeric values, produce invalid or incomplete indel representations when reference anchors were unavailable, and behave unpredictably with malformed alignment or allAlleles inputs.
Changes
Correct variant-filtering logic
Variant retention now follows the documented condition:
Numeric conversion is handled safely. Missing values such as NA, ., empty strings, and non-numeric values no longer satisfy numeric filter conditions or cause comparison errors.
Preserve context required for indel normalization
All parseable
allAllelesrows are retained during initial parsing.Filtering is applied later, after allele information has been merged with the alignment. This preserves reference and low-frequency rows needed to identify the reference bases used to anchor insertions and deletions.
Improve insertion normalization
The script now:
Motivation
IRMA represents variants using a combination of consensus alignments and
allAllelesstatistics. Insertions and deletions therefore require positional context that may be stored in rows which do not themselves pass the final reporting thresholds.Applying filters during parsing could remove that context and prevent valid indels from being normalized. The revised workflow separates parsing, alignment merging, normalization, and final filtering more clearly and handles missing or malformed values defensively.
PR checklist
black and flake8).templates/services.json.assets/reports/md/template.mdis added.assets/reports/results/template.mdis updated.CHANGELOG.mdis updated.README.mdis updated (including new tool citations and authors/contributors).templates/sftp_user.json