Strip literal NA tokens from COG bar-chart labels - #44
Conversation
There was a problem hiding this comment.
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
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.