Skip to content

Fix addTransport crashing when a metabolite has no counterpart in the target compartment - #700

Merged
edkerk merged 1 commit into
develop3from
fix/addtransport-name-length-mismatch
Aug 28, 2026
Merged

Fix addTransport crashing when a metabolite has no counterpart in the target compartment#700
edkerk merged 1 commit into
develop3from
fix/addtransport-name-length-mismatch

Conversation

@edkerk

@edkerk edkerk commented Aug 28, 2026

Copy link
Copy Markdown
Member

Fixes SysBioChalmers/raven-gecko-parity#10.

addedRxnsName was built from the full, unfiltered metNames, while nRxns
counted only the metabolites that actually exist in the target compartment
(the onlyToExisting branch). The two arrays concatenated onto model.rxns
/ model.rxnNames then had different lengths whenever the requested set was
not a subset of what exists in every target compartment — including the
default call with no metNames, which transports every metabolite from one
compartment to another (the tutorial-model case in the parity issue).

A second, independent bug on the same line: strcat's result was transposed
from a column into a row, incompatible with model.rxnNames' column shape,
regardless of length.

Introduces namesInComp, filtered identically to fromMetsInComp / toMets
in each branch, and drops the erroneous transpose.

… target compartment

addedRxnsName was built from the full, unfiltered metNames while nRxns
counted only the metabolites that actually exist in the target
compartment (the onlyToExisting branch), so the two arrays concatenated
onto model.rxns/model.rxnNames had different lengths whenever the
requested set wasn't a subset of what exists in every target
compartment -- the default call with no metNames given, transporting
every metabolite from one compartment to another.

A second, independent bug in the same line: strcat's result was
transposed from a column into a row, incompatible with model.rxnNames'
column shape, regardless of length.

Introduces namesInComp, filtered identically to fromMetsInComp/toMets
in each branch, and drops the erroneous transpose.
@github-actions

Copy link
Copy Markdown

Function test results

300 tests   274 ✅  1m 1s ⏱️
 25 suites   26 💤
  1 files      0 ❌

Results for commit 0e7f2f9.

@edkerk
edkerk merged commit 869e9f5 into develop3 Aug 28, 2026
4 checks passed
@edkerk
edkerk deleted the fix/addtransport-name-length-mismatch branch August 28, 2026 07:07
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