Skip to content

fix: stop warning for missing or NA Entrez_Gene_Id in CNA files (#4) - #157

Open
officialasishkumar wants to merge 1 commit into
cBioPortal:mainfrom
officialasishkumar:fix/cna-entrez-na-warning
Open

fix: stop warning for missing or NA Entrez_Gene_Id in CNA files (#4)#157
officialasishkumar wants to merge 1 commit into
cBioPortal:mainfrom
officialasishkumar:fix/cna-entrez-na-warning

Conversation

@officialasishkumar

Copy link
Copy Markdown

Summary

Loading a discrete copy-number (CNA) file that has no Entrez_Gene_Id column (or rows where it is empty / NA) prints a misleading warning for every data row:

Warnings / Errors:
-------------------
0.  Ignoring line with invalid Entrez_Id NA; 20x

despite the rows being loaded correctly. The file-format docs state that one or both of Hugo_Symbol / Entrez_Gene_Id may be specified, so a missing Entrez ID is valid as long as a Hugo_Symbol is 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 in CnaUtil.getEntrezSymbol():

if (entrezAsString.isEmpty()) {   // never true: getPartString returns "NA", not ""
    return 0;
} else if (!entrezAsString.matches("^\\d+$")) {
    ProgressMonitor.logWarning("Ignoring line with invalid Entrez_Id " + entrezAsString);
    return 0;
}

was dead code, so execution always fell through to the warning branch for missing/NA Entrez IDs.

Changes

  • CnaUtil.getEntrezSymbol(): treat an empty or "NA" Entrez value as "not provided" and return 0 silently so the caller falls back to the Hugo_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

mvn -Dtest=TestCnaUtil test
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

Fixes #4

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignoring line with invalid Entrez_Id NA

1 participant