fix: gene field alignment in removeLowScoreGenes#670
Merged
Conversation
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
|
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main improvements in this PR:
removeLowScoreGenesmisaligned the gene-associated fields (geneShortNames,proteins,geneMiriams,geneFrom,geneComps) relative tomodel.genes, corrupting the gene ID → gene symbol mapping in ftINIT-reconstructed models whenremoveGenes = true(solves Possible gene ID–gene symbol mismatch in ftINIT-reconstructed models #669).Background
removeLowScoreGenesregeneratedmodel.genesfromgetGenesFromGrRules, which returns a sorted list (uniquewithout'stable'), but trimmed the gene-associated annotation fields usingremInd, a logical mask in the originalmodel.genesorder. Whenmodel.geneswas not already sorted (as for Human-GEM–derived models), the annotation fields ended up shifted relative tomodel.genes— exactly the "systematic shift of gene symbols after a certain point" reported in #669. GPRs andrxnGeneMatstayed internally consistent, so only the ID↔symbol mapping was affected.The defect has been present since
removeLowScoreGenes.mwas 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 fornewModel.genesand reorder therxnGeneMatcolumns to match, so theremInd-trimmed annotation fields stay aligned.Instructions on merging this PR:
developas target branch, and will be resolved with a squash-merge.mainas target branch, and will be resolved as descriped here.