Add modelSummary, walkFluxes, traceFluxPath#660
Merged
Conversation
modelSummary (queries/): COBRApy-style model overview — prints model dimensions, objective, and when a flux vector is supplied, the objective value and exchange fluxes partitioned into uptake and secretion. walkFluxes (analysis/): interactive CLI flux navigator. Starting from a chosen reaction, shows all flux-carrying neighbours grouped by shared metabolite. The user steps to any neighbour by number; a history stack supports going back with 'b'. Useful for manually tracing how flux flows through the network without knowing the full topology. traceFluxPath (analysis/): finds the highest-flux-fraction path between two reactions. At each metabolite junction flux is split proportionally among consuming reactions; the path maximising the cumulative fraction is returned via best-first search. Returns pathRxns, pathMets, cumFrac and prints an annotated one-line path with per-junction percentages.
Function test results211 tests 190 ✅ 37s ⏱️ Results for commit d07e8ca. ♻️ This comment has been updated with latest results. |
col = model.S(:,j) is sparse, so col(m) is a sparse scalar; cellfun cannot collect sparse values into a double array. full() converts it before multiplication so the cell stores a plain double.
model.S is sparse, so col(m) and row(n) yield sparse scalars. fprintf/sprintf reject sparse inputs; arithmetic propagates the sparsity. Convert column/row extractions from model.S to full arrays at the point of extraction so all downstream math is dense.
- Add gene-protein-reaction rules (grRules) to the reaction header - Always show a reaction number, even when the same reaction appears under multiple metabolites; drop the "(same as #N)" cross-reference line - Label each neighbour as 'produces' or 'consumes' relative to the shared metabolite, making flux direction immediately readable - Simplify metabolite header: drop "here" and the redundant sign; show absolute net flux magnitude alongside consumed/produced - Rewrite prompt to explicit action labels (1-N: step, b: back, q: quit) - Skip metabolites with net flux below cutoff to avoid zero-flux noise - Apply full() to S column/row extractions to avoid sparse-scalar errors
By default (traceMaterial=true) the path search now skips common currency
and cofactor metabolites (ATP/ADP, NAD/NADH, CoA, H2O, Pi, CO2, redox
carriers, …) so the returned path represents carbon-skeleton flow rather
than energy-carrier shortcuts.
Three new name-value parameters:
traceMaterial (default true) — enable the built-in currency exclusion
carbonOnly (default false) — additionally require C≥1 from metFormulas
excludeMets (default {}) — user-supplied additions to the list
The exclusion is applied at metabolite-selection time in the best-first
search, so ATP→ADP shortcuts are simply never explored. When no material
path exists the verbose output suggests trying traceMaterial=false.
Bare comment-only lines inside a {} literal act as row separators in MATLAB,
creating a ragged cell array that fails vertcat when rows have different
element counts. Replaced section-header comments inside the cell with
inline comments after ... on data lines.
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.
Summary
Three new analysis functions for exploring and summarising flux distributions:
modelSummary(model)— COBRApy-inspired model overview: prints dimensions, objective definition, and — when a flux vector is supplied — the objective value plus uptake/secretion tables for all active exchange reactionswalkFluxes(model, fluxes, startRxn)— interactive command-line flux navigator: shows flux-carrying reactions connected through shared metabolites, grouped by metabolite with role labels; type a number to step,bto go back,qto quittraceFluxPath(model, fluxes, fromRxn, toRxn)— best-first search for the highest-flux-fraction path between two reactions; returnspathRxns,pathMets, andcumFracAll three use
parseRAVENargsfor name-value argument handling. Tests added intQueries(modelSummaryNoFluxRuns,modelSummaryWithFluxRuns) andtAnalysis(traceFluxPathReturnsCells,traceFluxPathSameReactionIsIdentity).