Skip inter-block header lines in multi-allele NetMHCpan output (fixes #195) - #196
Merged
Conversation
When NetMHCpan is run with multiple alleles in a single invocation, each per-allele result block is preceded by a line of the form "HLA-X : Distance to training data ..." *after* the first `---` separator. The existing split_stdout_lines filter only dropped comments, empty lines, dash-separator lines, and lines starting with a known header token — "Distance to training data" lines slipped through and the parser crashed trying to convert "HLA-A24:02" to an int for the Pos column. Fix: after the other filters, also skip any line whose first token isn't an integer (possibly negative, to preserve the existing support for NetMHC 4.0's peptide-mode negative positions). Regression test parses a two-allele NetMHCpan 4.1 output containing the offending header line.
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.
Fixes #195.
Summary
When NetMHCpan is run with multiple alleles in one invocation, each per-allele result block is preceded by a line like:
```
HLA-A24:02 : Distance to training data 0.000 (using nearest neighbor HLA-A24:02)
```
For single-allele runs this line appears before the first `---` separator and is already skipped. For multi-allele runs the second-and-subsequent ones appear after a separator, so they passed through `split_stdout_lines` and `parse_stdout` crashed converting `HLA-A24:02` to an integer Pos.
Fix
In `split_stdout_lines`, after the existing comment/separator/header-token filters, also drop any line whose first token isn't an integer. `.lstrip("-").isdigit()` preserves support for NetMHC 4.0's negative positions in peptide-input mode (already explicitly accommodated in that module's comment).
Test plan