fix: stop warning for missing or NA Entrez_Gene_Id in CNA files (#4) - #157
Open
officialasishkumar wants to merge 1 commit into
Open
fix: stop warning for missing or NA Entrez_Gene_Id in CNA files (#4)#157officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
CnaUtil.getEntrezSymbol() emitted "Ignoring line with invalid Entrez_Id NA" for every data row whenever the Entrez_Gene_Id column was absent, empty, or explicitly "NA". This is misleading: the documentation allows specifying only a Hugo_Symbol (one or both of Hugo_Symbol / Entrez_Gene_Id may be present), so such rows are loaded correctly by falling back to the Hugo symbol. The warning incorrectly suggested the lines were ignored when they were not. The root cause is that TabDelimitedFileUtil.getPartString() returns the literal "NA" string for an absent column (index -1) or an empty cell, so the existing `entrezAsString.isEmpty()` guard never matched and execution fell through to the "invalid Entrez_Id" warning branch. Treat an empty or "NA" Entrez ID as "not provided" and return 0 silently, while still warning for genuinely malformed (non-numeric, non-NA) Entrez IDs. Adds TestCnaUtil covering the absent-column, NA, empty, valid and malformed cases. Fixes cBioPortal#4
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
Loading a discrete copy-number (
CNA) file that has noEntrez_Gene_Idcolumn (or rows where it is empty /NA) prints a misleading warning for every data row:despite the rows being loaded correctly. The file-format docs state that one or both of
Hugo_Symbol/Entrez_Gene_Idmay be specified, so a missing Entrez ID is valid as long as aHugo_Symbolis present.Root cause
TabDelimitedFileUtil.getPartString()returns the literal string"NA"when a column is absent (index-1) or the cell is empty — it never returns an empty string. As a result the existing guard inCnaUtil.getEntrezSymbol():was dead code, so execution always fell through to the warning branch for missing/
NAEntrez IDs.Changes
CnaUtil.getEntrezSymbol(): treat an empty or"NA"Entrez value as "not provided" and return0silently so the caller falls back to theHugo_Symbol. Genuinely malformed (non-numeric, non-NA) Entrez IDs still produce the warning.TestCnaUtil(new): unit tests covering the absent-column,NA, empty, valid, and malformed cases.There is no functional change to which rows are loaded — only the spurious per-row warning is removed.
Test plan
Fixes #4