Skip to content

chore: Human2 repository and code cleanup#1055

Merged
edkerk merged 9 commits into
developfrom
chore/human2-code-cleanup
Jul 12, 2026
Merged

chore: Human2 repository and code cleanup#1055
edkerk merged 9 commits into
developfrom
chore/human2-code-cleanup

Conversation

@edkerk

@edkerk edkerk commented Jul 12, 2026

Copy link
Copy Markdown
Member

Main improvements in this PR:

Repository and code/ cleanup for the Human2 (v2.0.0) era, plus one model data-integrity fix.

Model fix

  • Remove a duplicate empty name: "" field from reaction MAR01801 (it carried both a descriptive name and a leftover empty one). The duplicate made cobra.io.load_yaml_model raise a duplicate-key error, which was failing qcModelChecks.py (checks) and memoteTest.py (yaml-validation) on develop, independent of this PR. The descriptive name thioredoxin-disulfide reductase (NADPH) (ubiquinone) (EC 1.8.1.9) is kept; both scripts pass locally after the fix. No reactions or metabolites are added or removed.

Repository pruning

  • Prune .deprecated/ (136 archived Human1-era files) to a single README.md that points to where they remain available: the git history and the last Human1 release, v1.19.0.
  • Remove the completed one-off curation scripts (code/modelCuration/* and code/curateReactionNames.py) together with their input data.
  • Remove stale external dumps in data/modelCuration/ (SwissProt / Cell Atlas / DeepLoc2 subcellular locations, Rhea reaction associations, metabolite SMILES/InChI); these are better queried fresh from the source when needed.

code/ function cleanup

  • Remove 15 functions that have no remaining callers or are superseded by RAVEN (e.g. removeReactionsFull, standardizeMetFormulas, orphaned misc/ and qc/ utilities, GPRs/updateGrRules, GPRs/fetch_ensembl_gene_annotations.py).
  • Merge getCompNetwork into its only caller getSubNetworksInComp (as a local function).
  • Group the animal-GEM derivation and its helpers under a new code/animalGEM/ subfolder (10 functions).
  • Replace the local addBoundaryMets with RAVEN's closeModel, verified functionally equivalent on Human-GEM (identical checkTasks outcomes: essential 57/57, verification 21/21).

Validated locally in MATLAB R2024b (the merged getSubNetworksInComp runs on the model; testMetabolicTasks passes with closeModel) and in Python (qcModelChecks.py and memoteTest.py pass after the model fix).

I hereby confirm that I have:

  • Any removed reactions and metabolites have been moved to the corresponding deprecated identifier lists in data/deprecatedIdentifiers/.
  • 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 with a merge commit.

edkerk added 5 commits July 12, 2026 11:37
Remove the archived Human1-era scripts, data and model files from
.deprecated/ (they remain in the git history and in the last Human1
release, v1.19.0) and leave a README pointing there.
Remove the Human1-era one-off curation scripts (code/modelCuration/*,
code/curateReactionNames.py) with their input data, and the static
external dumps (SwissProt/Cell Atlas/DeepLoc2 compartments, Rhea
associations, metabolite SMILES/InChI) that had gone stale. The compartment
data they produced is already in genes.tsv; the dumps are better queried
fresh. All remain in the git history and in v1.19.0. READMEs updated.
Human2 code/ cleanup, no model changes. Continues the chore/human2-cleanup
branch.

Remove functions with no remaining callers or superseded by RAVEN:
- root: removeReactionsFull, standardizeMetFormulas, addMetCompsField
- misc: countEmpty, flattenCell, getNonEmptyList, nestCell, prettyJson,
  reformatElements
- qc: overlapRxnDetection, identifyMassVariableRxns, detectDuplicateRxns
- GPRs: addComplexesToGeneRules, updateGrRules, fetch_ensembl_gene_annotations.py

Merge getCompNetwork into getSubNetworksInComp as a local function (it was
the only caller).

Group the animal-GEM derivation and its helpers under code/animalGEM/:
updateAnimalGEM, updateAnimalAnnotations, getModelFromOrthology,
gapfill4EssentialTasks, cleanGrRules, translateGrRules, replaceGrRules,
extractAllianceGenomeOrthologs, countFrequency.
addBoundaryMets and RAVEN's closeModel both add boundary metabolites for
metabolic task checking. Verified functionally equivalent on Human-GEM:
identical essential (57/57) and verification (21/21) checkTasks outcomes.

Migrate all callers to closeModel and remove addBoundaryMets:
- test/testMetabolicTasks, animalGEM/gapfill4EssentialTasks (calls)
- test/estimateEssentialGenes (call)
- tINIT/getINITModel2, test/evalGeneEssentialityPred (doc/error text)
Its only caller is updateAnimalGEM (now under animalGEM/), which returns its
modelChanges log as speciesSpecNetwork. Keep the encapsulation and move it
alongside the other animal-GEM functions rather than inlining it.
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown

Model quality report

Model QC checks fine, no changes compared to develop.

Model QC checks

Check Result Δ vs develop
Growth (biomass producible) 125 0
Metabolites missing formula 7 0
Metabolites missing charge 0 0
Reaction bound / GPR issues 0 0
Malformed cross-references 59 0
Cross-refs inconsistent across compartments 59 0
MEMOTE score (%) 20.2 new 🆕

MACAW and mass/charge balance

MACAW: dead-end and duplicate tests

Starting dead-end test...
 - Found 1384 dead-end metabolites.
 - Found 1141 reactions incapable of sustaining steady-state fluxes in either direction due to these dead-ends.
 - Found 1369 reversible reactions that can only carry steady-state fluxes in a single direction due to dead-ends.
Starting duplicate test...
 - Skipping redox duplicates because no redox_pairs and/or proton_ids were provided.
 - Found 377 reactions that were some type of duplicate:
   - 0 were completely identical to at least one other reaction.
   - 13 involve the same metabolites but go in the opposite direction or have the opposite reversibility as at least one other reaction.
   - 377 involve the same metabolites but with different coefficients as at least one other reaction.

Mass and charge balance

Unbalanced reactions (excluding boundary and biomass): 277 (87 mass, 240 charge)

Gene essentiality (Hart 2015)

cellLine TP TN FP FN accuracy sensitivity specificity F1 MCC
DLD1 38 2158 60 280 0.8659 0.1195 0.9729 0.1827 0.1588
GBM 34 2137 64 300 0.8564 0.1018 0.9709 0.1574 0.1276
HCT116 47 2181 55 308 0.8599 0.1324 0.9754 0.2057 0.1906
HELA 32 2241 70 250 0.8766 0.1135 0.9697 0.1667 0.1332
RPE1 15 2179 83 258 0.8655 0.05495 0.9633 0.08086 0.02935
all 7 2379 95 112 0.9202 0.05882 0.9616 0.06335 0.02199

Per-finding detail is committed to data/testResults/ (qc_metabolite_completeness.csv, qc_reaction_sanity.csv, qc_annotation_issues.csv, macaw_results.csv, balance_results.csv, gene-essential.csv); the full MEMOTE result is uploaded as a build artifact.

Results for commit 01ee965.

Full workflow run · this comment is edited on subsequent runs

edkerk and others added 4 commits July 12, 2026 18:16
MAR01801 had two name fields: the descriptive name and a leftover empty
`name: ""`. This made cobra.io.load_yaml_model raise a duplicate-key
AssertionError, which was failing qcModelChecks.py (checks) and
memoteTest.py (yaml-validation) on develop, independent of the cleanup.

Remove the empty duplicate, keeping "thioredoxin-disulfide reductase
(NADPH) (ubiquinone)" (EC 1.8.1.9). Both scripts pass locally after the fix.
@edkerk

edkerk commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

No structural model changes (except a small fix of duplicate name entry)

@edkerk
edkerk merged commit d7ac8bd into develop Jul 12, 2026
@edkerk
edkerk deleted the chore/human2-code-cleanup branch July 12, 2026 19:19
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