Skip to content

Fix gene field alignment in removeLowScoreGenes - #706

Merged
edkerk merged 1 commit into
develop3from
fix/removelowscoregenes-field-alignment-develop3
Aug 28, 2026
Merged

Fix gene field alignment in removeLowScoreGenes#706
edkerk merged 1 commit into
develop3from
fix/removelowscoregenes-field-alignment-develop3

Conversation

@edkerk

@edkerk edkerk commented Aug 28, 2026

Copy link
Copy Markdown
Member

Ports the fix from #670 (merged to develop) to develop3, which carried the identical bug in its reworked removeLowScoreGenes.

removeLowScoreGenes regenerated model.genes from getGenesFromGrRules, which returns a sorted list, but trimmed the gene-associated fields (geneShortNames, proteins, geneMiriams, geneFrom, geneComps) with a mask in the original gene order. When model.genes was not already sorted, every annotation field ended up shifted relative to model.genes, corrupting the gene-ID → gene-symbol mapping in ftINIT-reconstructed models (removeGenes=true).

The retained genes are now kept in their original order and the rxnGeneMat columns reordered to match, so the trimmed annotation fields stay aligned.

Reproduced on develop3 with an unsorted-genes model: removing one isozyme gene paired G2 -> short3 and G3 -> short2; after the fix G2 -> short2, G3 -> short3. Adds removeLowScoreGenesKeepsFieldsAligned to tINIT covering exactly this.

Ports the fix from #670 (merged to develop) to develop3, which carried the
identical bug in its reworked removeLowScoreGenes.

removeLowScoreGenes regenerated model.genes from getGenesFromGrRules, which
returns a sorted list, but trimmed the gene-associated fields
(geneShortNames, proteins, geneMiriams, geneFrom, geneComps) with a mask in
the original gene order. When model.genes was not already sorted, this left
every annotation field shifted relative to model.genes, corrupting the gene
ID to gene symbol mapping in ftINIT-reconstructed models (removeGenes=true).

Retain the remaining genes in their original order and reorder the
rxnGeneMat columns to match, so the trimmed annotation fields stay aligned.

Reproduced on develop3 with an unsorted-genes model: removing one isozyme
gene paired G2->short3 and G3->short2; after the fix G2->short2, G3->short3.
Adds removeLowScoreGenesKeepsFieldsAligned to tINIT covering exactly this.
@github-actions

Copy link
Copy Markdown

Function test results

303 tests   277 ✅  1m 8s ⏱️
 25 suites   26 💤
  1 files      0 ❌

Results for commit 8f6b233.

@edkerk
edkerk merged commit c528db7 into develop3 Aug 28, 2026
4 checks passed
@edkerk
edkerk deleted the fix/removelowscoregenes-field-alignment-develop3 branch August 28, 2026 07:52
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.

1 participant