bugfix: MAF robustness — createinput comment lines + compute_fitness input guards - #252
Closed
johnoooh wants to merge 2 commits into
Closed
bugfix: MAF robustness — createinput comment lines + compute_fitness input guards#252johnoooh wants to merge 2 commits into
johnoooh wants to merge 2 commits into
Conversation
create_phylowgs_inputs.py uses csv.DictReader on the raw MAF, so a leading "#" header/comment line gets treated as the column header row and breaks column-name based parsing (KeyError downstream). Strip any "^#" lines into filtered_head.maf before passing it as the --vcf-type input. Adds an nf-test case (with a small local MAF fixture carrying a leading "#" comment line) that reproduces and verifies the fix.
Neoantigen scoring computed logC/logA/quality unconditionally, which divided by zero when Kd or KdWT was 0 and raised a KeyError from EpitopeDistance when a peptide contained a non-standard residue (e.g. "*", "X" from stop-gained/ambiguous calls). Extract the scoring step into score_neoantigen() and zero out logC/logA/quality whenever Kd/KdWT is 0 or either sequence contains residues outside the standard 20 amino acids, instead of crashing or dividing by zero. Adds pytest coverage for the non-standard-residue guard, the Kd/KdWT guard, and a clean-input case confirming normal scoring is unaffected.
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.
Two independent robustness fixes surfaced by a large production run.
Fixes
phylowgs/createinput: strip leading#comment/header lines from the MAF (grep -v '^#') beforecreate_phylowgs_inputs.py, which otherwise mis-parses a commented header.neoantigenediting/computefitness: guard the scoring loop against div-by-zero (Kd/KdWT==0) and non-standard amino-acid residues (outsideACDEFGHIKLMNPQRSTVWY, e.g.*/X) which crashEpitopeDistance; zero the score components instead of raising. Guard extracted into a testablescore_neoantigen()helper.Tests
#regression case) and computefitness 2/2,--profile docker.