Repository navigation
feat: generate the animal GEMs from Human-GEM in Python - #1141
Merged
Merged
Conversation
generateAnimalGEM.py replaces the five masterScript<Species>GEM.m scripts. The species is an argument and everything species-specific is read from the Animal-GEM repository, so a developer and a CI job run the same command. It rewrites the GPRs through the Alliance orthologs, adds the species-specific network, gap-fills the essential tasks, stamps the version and date into the model metadata, and writes the model and annotation files. For Human-GEM 2.0.0-2.1.0 the cofactor pool of MAR00021 is switched from lipoyl-lysine to lipoic acid in memory, because MAR00021 cannot carry flux otherwise (#1140).
Contributor
Model quality report
Pre-existing:
✅ unchanged · ✨ improved vs Full workflow run · this comment is edited as results come in |
…ions get_model_from_homology (keep_gene_free, preserve_notes) and set_model_metadata replace the local GPR rewriting and metadata code. Gene symbols that a GPR cannot hold, such as E(spl)m3-HLH, dib[m] or the Drosophila gene "or", get a valid gene id and keep the symbol as the gene name; the species-specific metabolites that Human-GEM no longer knows by name are reported together. The lipoyl-lysine fix also applies to the unversioned develop model.
The template, orthology, annotation tables and task list now come from a Human-GEM checkout (--human-repo, normally a release tag). A model without a version (develop) is refused unless --allow-unreleased is given.
…arn on unbalanced species reactions The raven homology call left homology_source on every reaction and kept rxnFrom/metFrom, which the previous scripts removed. The lipoic acid swap in MAR00022 is now noted on the reaction, a template without a model id (older releases) no longer fails, and species-specific reactions that are not balanced against the template are reported.
Without --version an animal GEM keeps its version when its major.minor matches the Human-GEM release it is built on, and becomes <major>.<minor>.0 of that release otherwise. A requested version with another major.minor is refused.
This was referenced Oct 6, 2026
Open
Open
…ator generateAnimalGEM.m replaces the previous MATLAB animal GEM functions (updateAnimalGEM, getModelFromOrthology, addMetabolicNetwork, gapfill4EssentialTasks, updateAnimalAnnotations, extractAllianceGenomeOrthologs, countFrequency). It uses RAVEN 3's getModelFromHomology with complexPolicy, keepGeneFree and preserveNotes, and gives the same model and annotation tables as generateAnimalGEM.py for all five species. cleanGrRules, replaceGrRules and translateGrRules, which other code uses, move to code/GPRs. Both generators resolve gap-filling ties, so the gap-filled set does not depend on the solver, and keep the Human-GEM notes of gap-filled reactions.
Merged
This was referenced Oct 20, 2026
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:
Closes #421.
code/animalGEM/generateAnimalGEM.pyreplaces the fivemasterScript<Species>GEM.mscripts of the Mouse, Rat, Worm, Fruitfly and Zebrafish GEMs. The species is an argument; everything species-specific is read from the Animal-GEM repository (data/human2<Species>Orthologs.tsv,<species>SpecificRxns.tsv,<species>SpecificMets.tsv).It takes no input from the terminal and reads and writes only the repositories involved, so a developer and a CI job run the same command (
--repo/$ANIMAL_GEM_REPO,--human-repo/$HUMAN_GEM_REPO).Built on a stable release. The template, the gene and annotation tables and the task list are read from a Human-GEM checkout, normally a release tag (
git worktree add ../Human-GEM-release v2.1.0). A model without a version (develop) is refused unless--allow-unreleasedis given.Steps. Rewrite the GPRs through the Alliance of Genome Resources orthologs; add the species-specific network; gap-fill the essential tasks from Human-GEM; stamp
versionanddateinto the model metadata (the requirement of Fruitfly-GEM#7); write the yml, mat, xml and annotation tables. The draft uses raven-toolbox'sget_model_from_homology(keep_gene_free,preserve_notes) andset_model_metadata, so it needs a raven-toolbox that includes CompMetEng/raven-toolbox#166 and #167 (requirements.txtinstalls from git). Gene symbols that a GPR cannot hold (E(spl)m3-HLH,dib[m], the Drosophila geneor) get a valid gene id and keep the symbol as the gene name. The previous MATLAB functions are replaced bygenerateAnimalGEM.m, which follows the same steps and options and gives the same model and annotation tables as the Python generator for all five species (checked on Human-GEM 2.1.0). It needs RAVEN 3 with SysBioChalmers/RAVEN#757 (homology options) and SysBioChalmers/RAVEN#758 (SBML export of gene ids with a dash).cleanGrRules,replaceGrRulesandtranslateGrRules, which other code uses, move tocode/GPRs. Both generators resolve gap-filling ties (fewest, lowest-id reactions), so the gap-filled set does not depend on the solver.MAR00021. The animal GEMs keepMAR00021as their objective. In Human-GEM 2.0.0-2.1.0 it cannot carry flux on Ham's medium, because its cofactor poolMAR00022needs[protein]-N6-(lipoyl)lysine, which nothing produces since the lipoylation curation. For those releases the generator swaps it for lipoic acid in memory (asMAR10065uses), notes it on the reaction and logs it. Curating this in Human-GEM is #1140; remove the swap once it lands.--keep-biomasskeeps the human biomass reaction instead.Versioning. An animal GEM's major.minor follows the Human-GEM release it is built on; the patch number is its own. Without
--versionthe generator keeps a matching version and otherwise uses<major>.<minor>.0; a--versionwith another major.minor is refused.Regenerated models. Mouse-GEM, Rat-GEM, Worm-GEM, Fruitfly-GEM and Zebrafish-GEM each have a PR regenerating version 2.1.0 from Human-GEM 2.1.0 with this generator; they depend on this PR.
Tested.
MAR00022swap) andruffis clean.Known issues in the species data (not in this PR). Against v2.1.0, 18 of 60 Worm and 11 of 31 Fruitfly species-specific reactions are not mass or charge balanced, and Worm-GEM uses the old metabolite name
H2S2O3(nowthiosulfate). The generator reports unmatched metabolites and unbalanced reactions (not sinks or demands). Fixes are in SysBioChalmers/Worm-GEM#9 and SysBioChalmers/Fruitfly-GEM#13, carried in the regeneration PRs.I hereby confirm that I have:
developas a target branch