Skip to content

Strip literal NA tokens from COG bar-chart labels - #44

Merged
eboyer221 merged 3 commits into
mainfrom
fix-cog-na-labels
Jul 31, 2026
Merged

Strip literal NA tokens from COG bar-chart labels#44
eboyer221 merged 3 commits into
mainfrom
fix-cog-na-labels

Conversation

@eboyer221

Copy link
Copy Markdown
Contributor

Follow up fix for the excessive NAs @amcim identified in reviewing PR #41
makeCogBarChart() was surfacing labels like COG1196: Chromosome segregation ATPase Smc NA, and the trailing NAs come from the annotation source (cluster_feature_COG.parquet), which stores unnamed COGs as the literal string "NA" and space-joins them into COG_name (e.g. "Alanine racemase NA NA NA"). This commit strips those standalone NA tokens before building the bar labels, falling back to the bare COG id when no real name remains. Affects both the interactive dashboard COG barplot and the exported cog_categories figure. Adds unit tests for the helper.

@amcim amcim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a couple of bugs here. Because of how NAs are introduced, your cleaner would not remove NA if they had a semi-colon after like "NA;". Further what would happen is that other pieces would get merge into one blob because their leading semi colons were consumed when the NAs of the previous piece were stripped. So the COG names were corrupted and the counts were fragmented as a result.

I edited .clean_cog_name to be able to split with this semicolon, and now the figure being generated matches what is in main branch, just with the NA no longer appearing.

I am approving for merge. @eboyer221 please confirm that the figure you generate in main matches what is in this branch currently.

Two things to note. 1) Currently the COG names are long and nearly all of them are cut off. 2) There is a bug in the plotting code which leads some COGs to have multiple names. 1 will be dealt with when. the switch to protein clusters happens, the bug will be dealt with in a follow up PR

@eboyer221
eboyer221 merged commit eb962a9 into main Jul 31, 2026
@eboyer221
eboyer221 deleted the fix-cog-na-labels branch July 31, 2026 21:17
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.

2 participants