Repository navigation
fix: give the same result as geckopy where the parity scenarios found differences - #13
Merged
Merged
Conversation
…on, as RAVEN's FSEOF does A reaction is a target when its absolute flux correlates with the enforced production flux (absolute Pearson correlation of at least corrThreshold, default 0.9), instead of requiring a strictly monotonic flux and a slope above the 75th percentile. The targets are ranked by slope times correlation.
…a blanks the whole row above maxRSD and uses cutLowest, applyComplexData assigns the stoichiometry per protein ID, assignKcatValues drops the source of a zero kcat with its row, loadBRENDAdata finds lowercase EC codes
…out enzymes
makeEcModel (light) and addNewRxnsToEC expand a gene rule to its isozymes in disjunctive normal form, so 'G1 and (G2 or G3)' is the isozymes {G1,G2} and {G1,G3}, and read gene ids as whole words, so an id such as orfX is not split at 'or'.
makeEcModel couples a reaction to the subunits of its complex that the databases know, also when another subunit is missing from them.
mapRxnsToConv and ecFVA strip the _REV and _EXP_n suffixes only at the end of a reaction id, so an id such as R_REVX is kept.
applyKcatConstraints (light) ignores an isozyme row without enzymes when it selects the cheapest isozyme of a reaction.
…e ecFSEOF test its own label
…nd the custom kcats loadBRENDAdata drops a kcat more than four orders of magnitude below the median of its EC (filterOutlierKcats, default true). The reference of an EC is the median of the positive kcats of the max and median views of kcat.tsv and of the kcats derived from sa.tsv and mw.tsv, widened to the 3-, 2- and 1-level prefix while fewer than five values are available. On the BRENDA 2026.1 release it drops the same rows as geckopy's load_brenda_data. fuzzyKcatMatching escalates an EC number without a match to '-.-.-.-' (wildcard level 4), reports the wildcard level and origin of the selected EC when several EC numbers share the highest kcat, keeps the order and repeats of ecRxns given as indices, and returns no reactions for an empty selection other than []. kcatsFromBrenda refuses such a selection. applyCustomKcats skips an entry without a kcat, does not append an empty note, matches protein and reaction ids exactly and works on light ecModels.
…age reactions out of the ecFSEOF gene targets, forced wildcards from the right, and usable kcats in light applyKcatConstraints addNewRxnsToEC couples a new reaction to the whole-word genes of its rule. makeEcModel (light) keeps one row for a reaction with an empty gene rule, and gene rule operators in capitals are accepted there and in addNewRxnsToEC. ecFSEOF leaves the usage reactions out before the gene slopes and actions are derived, reports an empty result for a corrThreshold above every correlation, and corrThreshold is tested. fuzzyKcatMatching forceWClvl replaces the rightmost level that is not a wildcard yet, for each EC number of a reaction. applyKcatConstraints (light) lets only isozymes with a positive kcat and a positive enzyme mass set the cost.
…our levels in fuzzyKcatMatching addNewRxnsToEC writes the operators AND and OR of every gene rule in lower case before the reversible reactions are split and the rules are passed to addRxns, so a rule with a single clause such as 'Sand1 AND andA' no longer reaches RAVEN with an operator it does not parse. Gene ids that contain the letters are left as they are. fuzzyKcatMatching stops escalating an EC code that does not have four levels (for example 1.1.1) and returns the no-match values, as geckopy does, instead of indexing a fourth level that is not there. The help text of forceWClvl in fuzzyKcatMatching and kcatsFromBrenda says that it replaces extra levels from the right, on top of any wildcard already in the code. Tests: upper-case operators on a reversible single-clause rule and an OR rule, an isozyme whose enzymes have no mass, trailing wildcards and a level above the remaining levels for forceWClvl, and a code without four levels.
…findECInDB drops a wildcard code next to a specific code for a single gene Origin 5 and 6 matches come from specific activities times molecular weights and do not always beat a prediction, so they rank after DLKcat by default; topOriginLimit 6 ranks them above, as the gecko_classic preset does. A gene whose database cell holds '1.1.1.4 1.1.1.- 1.1.1.303' now gives 1.1.1.4;1.1.1.303, as an enzyme complex already did.
…ery kcat is 0, sensitivityTuning stops when growth gains less than 1e-9, getKcatAcrossIsozymes averages the isozymes with a kcat above 0
This was referenced Oct 25, 2026
Merged
Unit test results63 tests 63 ✅ 11s ⏱️ Results for commit 0b6060f. ♻️ This comment has been updated with latest results. |
…ndECInDB leaves codes with fewer than four levels alone sensitivityTuning stops with a warning when solveLP returns no objective value inside the tuning loop (full and light branches), as geckopy does for a solve that is not optimal. For a single gene, findECInDB removes a wildcard code only next to a four-level code of the same prefix and removes empty codes, so '1.1.1 1.1.1.4' keeps both codes and a trailing space leaves no empty code. The help text states that the combined EC set of a complex is not cleaned of a wildcard next to a specific code.
…to a specific code, as the set of a single gene, and leaves out genes without an EC number The cross-gene union and intersection use the same four-level wildcard rule as the single-gene clean-up, replacing the trimmed-substring comparison, and the combined set is cleaned before the codes are joined.
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.
GECKO and geckopy now give the same result on the same input in the cases below. The cases come from the scenarios of the parity harness in
CompMetEng/raven-gecko-parity(the companion changes are inCompMetEng/geckopy).Target selection and saving
ecFSEOFselects targets as RAVEN'sFSEOFdoes: a reaction is a target when its flux exceeds 1e-10 somewhere, its absolute flux varies, and the absolute correlation with the enforced flux is at least the newcorrThresholdargument (default 0.9, last name-value argument). Targets are ranked by slope times correlation. Theusage_prot_rows are dropped before the gene targets are built, and an empty target set returns empty tables.saveEcModelno longer assignsecModel.description, whichwriteYAMLmodelnever wrote.Proteomics, complexes and kcat lists
loadProtDatablanks the whole row abovemaxRSDand honourscutLowest(floor(n * cutLowest / 100)).applyComplexDataassigns the stoichiometry by protein ID.assignKcatValuesdrops the source of a zero kcat together with its row.loadBRENDAdatafinds lowercase EC codes and drops kcats more than four decades below the median of their EC (at least five reference rows), as geckopy does.filterOutlierKcatsswitches the filter off.applyCustomKcatsskips a row with a blank kcat, leaves empty notes empty, matches IDs exactly and works on light ecModels.getKcatAcrossIsozymesaverages only siblings with a kcat above 0.Model building and editing
makeEcModelexpands nested gene rules in light ecModels, couples the known subunits of a complex when another subunit is missing from the databases, and keeps a reaction with an empty gene rule.addNewRxnsToECexpands nested gene rules, reads gene IDs as whole words (Sand1stays one gene) and accepts operators in any case.mapRxnsToConvandecFVAstrip_EXP_<n>and_REVonly at the end of an ID.applyKcatConstraintsignores isozyme rows without enzymes, with a non-positive kcat or with zero enzyme mass in light ecModels, and clears the constraints of a full ecModel when every kcat is 0.findECInDBdrops a wildcard EC next to a specific EC of the same prefix for a single gene.Kcat matching and merging
fuzzyKcatMatchingescalates an unmatched EC to the all-wildcard level 4, reports the selected EC of a tie, keeps the order and repeats of a numeric subset, and does not escalate a code without four levels.forceWClvlreplaces levels from the right.kcatsFromBrendarefuses an empty selection.mergeKcatsandmergeDLKcatAndFuzzyKcatsdefault totopOriginLimit4.sensitivityTuningstops when growth gains less than 1e-9 and ends with a warning when no usage reaction carries flux.test/VerificationMatrix.tsvlists the unit tests of each changed function.Behaviour that callers may notice: the
ecFSEOFtarget list and slopes, thetopOriginLimitdefault (the manual workflow tests and the light ecModel tutorial callmergeDLKcatAndFuzzyKcatswith defaults), the outlier filter ofloadBRENDAdata, and thesensitivityTuningstop rule.Not checked: the changes on models other than the unit-test ecModel and the tutorial yeast model, a solver other than GLPK for the unit tests, and MATLAB releases other than R2024b.
Companion changes: CompMetEng/geckopy#70 (geckopy), CompMetEng/raven-gecko-parity#141 (scenarios and ledger), CompMetEng/RAVEN#14 (the
readYAMLmodelsubsystem alignment that the ecModel cross-load scenario shows).