Skip to content

fix: gene field alignment in removeLowScoreGenes#670

Merged
edkerk merged 2 commits into
developfrom
fix/removeLowScoreGenes-gene-field-alignment
Jul 7, 2026
Merged

fix: gene field alignment in removeLowScoreGenes#670
edkerk merged 2 commits into
developfrom
fix/removeLowScoreGenes-gene-field-alignment

Conversation

@edkerk

@edkerk edkerk commented Jul 7, 2026

Copy link
Copy Markdown
Member

Main improvements in this PR:

Background

removeLowScoreGenes regenerated model.genes from getGenesFromGrRules, which returns a sorted list (unique without 'stable'), but trimmed the gene-associated annotation fields using remInd, a logical mask in the original model.genes order. When model.genes was not already sorted (as for Human-GEM–derived models), the annotation fields ended up shifted relative to model.genes — exactly the "systematic shift of gene symbols after a certain point" reported in #669. GPRs and rxnGeneMat stayed internally consistent, so only the ID↔symbol mapping was affected.

The defect has been present since removeLowScoreGenes.m was first moved into RAVEN (May 2022, commit d7b8ba2).

Fix

Gene removal never introduces new genes, so the retained set is model.genes(~remInd). Keep that original order for newModel.genes and reorder the rxnGeneMat columns to match, so the remInd-trimmed annotation fields stay aligned.

Instructions on merging this PR:

  • This PR has develop as target branch, and will be resolved with a squash-merge.
  • This PR has main as target branch, and will be resolved as descriped here.

edkerk added 2 commits July 7, 2026 15:48
removeLowScoreGenes regenerated model.genes from getGenesFromGrRules,
which returns a sorted list, but trimmed the gene-associated fields
(geneShortNames, proteins, geneMiriams, geneFrom, geneComps) using 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.

Fixes #669
@edkerk edkerk changed the title fix: gene field alignment in removeLowScoreGenes (#669) fix: gene field alignment in removeLowScoreGenes Jul 7, 2026
@edkerk
edkerk merged commit df3b6ee into develop Jul 7, 2026
1 check failed
@edkerk
edkerk deleted the fix/removeLowScoreGenes-gene-field-alignment branch July 7, 2026 13:57
@edkerk edkerk mentioned this pull request Jul 7, 2026
2 tasks
@mfcesur

mfcesur commented Jul 7, 2026

Copy link
Copy Markdown

Hi,

Thank you very much for the quick fix.

I tested the latest version from the develop branch, and the gene ID-gene symbol mapping are now correct. The issue seems to be resolved on my end.

Kind regards,
Müberra

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