Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
41599e2
Update version number for minor release.
luciansmith Feb 17, 2026
da6426f
Merge pull request #1308 from sys-bio/v2.9.1
luciansmith Feb 18, 2026
1ca005e
As a first pass at fixing named stoichiometries, throw on invalid nam…
luciansmith Feb 20, 2026
c2eb664
Add more test.
luciansmith Mar 4, 2026
5fb073b
Update swig version.
luciansmith Mar 5, 2026
a342d42
Merge pull request #1310 from sys-bio/fix-swig-bug
luciansmith Mar 5, 2026
06c4a1e
Merge pull request #1309 from sys-bio/fix-named-stoich
luciansmith Mar 5, 2026
a06aa56
Just the efficiency fixes in roadrunner.
luciansmith Mar 20, 2026
2dc3736
Don't try to convert when we don't need to.
luciansmith Mar 20, 2026
287bd36
Fix getting changed stoichs in getCurrentSBML.
luciansmith Mar 20, 2026
74afe65
Don't reset stoichiometries when conserved moiety analysis is on.
luciansmith Mar 20, 2026
e28849d
Named stoichs still not quite working for steady state, but closer.
luciansmith Mar 21, 2026
7ae9c1c
The test issue1306_named_stoich_steadyState was moved.
luciansmith Mar 23, 2026
1e19e95
Clean things up in preparation of actual fix.
luciansmith Mar 23, 2026
f238d99
Reset the model when turning on conserved moieties only!
luciansmith Mar 23, 2026
c522108
Remove long commented bit.
luciansmith Mar 24, 2026
25d4947
Re-enable test!
luciansmith Mar 24, 2026
9591c09
More support for increasingly-obscure things to do with named stoichs:
luciansmith Mar 24, 2026
ca31b2d
Comment out now-missing functions.
luciansmith Mar 24, 2026
8978ca5
Don't test models with assignment rules to named stoichiometries.
luciansmith Mar 24, 2026
20a62c8
Update workflow versions.
luciansmith Mar 24, 2026
0185247
Merge pull request #1312 from sys-bio/new-stoich-fixes
luciansmith Mar 24, 2026
4c4daf3
Fixes using a stoichiometry name as an ID on a roadrunner object.
luciansmith Mar 25, 2026
01563f3
Fix misspelling (sigh)
luciansmith Mar 25, 2026
a2830b8
Some python tests were named 'Python'.
luciansmith Mar 25, 2026
e69702f
Add functions to support named stoichiometries.
luciansmith Mar 25, 2026
41b9408
Don't imitate getInitialAssignmentIds, which is completely different,…
luciansmith Mar 25, 2026
fa1b939
Fixed the bug!
luciansmith Mar 25, 2026
8ebac8a
Cleanup.
luciansmith Mar 25, 2026
cfd019e
Fix ubuntu regex.
luciansmith Mar 25, 2026
0c36b00
Try re-enabling python tests on mac.
luciansmith Mar 25, 2026
bf028ef
Try checking against named CSUM elements.
luciansmith Mar 26, 2026
2a48f20
Sort the list for comparison, so it'll work on MacOS.
luciansmith Mar 26, 2026
ea1c77c
Merge pull request #1314 from sys-bio/named-stoich-props
luciansmith Mar 26, 2026
84b0c3d
Merge pull request #1315 from sys-bio/enable-mac-python-tests
luciansmith Mar 26, 2026
acd23c7
Clean up indenting from fix.
luciansmith Mar 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: BuildRoadRunner
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' #for seanmiddleditch/gha-setup-ninja and ilammy/msvc-dev-cmd.

on:
push:
Expand Down Expand Up @@ -90,11 +92,11 @@ jobs:
echo "python_v4_name=v4" >> $GITHUB_ENV

- name: Checkout RoadRunner
uses: actions/checkout@v4
uses: actions/checkout@main

- name: Setup Python for non-Manylinux platforms
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type != 'manylinux'
uses: actions/setup-python@v5
uses: actions/setup-python@main
id: four_pythons
with:
python-version: |
Expand Down Expand Up @@ -230,6 +232,7 @@ jobs:
fi

- name: Setup Ninja
if: matrix.platform.os_type == 'manylinux'
uses: seanmiddleditch/gha-setup-ninja@master

- name: Get Host Architecture
Expand Down Expand Up @@ -283,7 +286,7 @@ jobs:

- name: Cache ccache files on non-Windows
if: matrix.platform.os_type != 'windows'
uses: actions/cache@v4
uses: actions/cache@main
with:
path: ${RUNNER_WORKSPACE}/.ccache
key:
Expand All @@ -300,31 +303,31 @@ jobs:
brew install pcre pcre2
mkdir -p ${RUNNER_WORKSPACE}/swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.4.0/swig-4.4.0.tar.gz/download > swig.tar.gz
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.4.1/swig-4.4.1.tar.gz/download > swig.tar.gz
tar -zxf swig.tar.gz
rm swig.tar.gz
mkdir -p install-swig
cd swig-4.4.0/
cd swig-4.4.1/
./configure --prefix=${RUNNER_WORKSPACE}/swig/install-swig
make
make install
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/bin/swig" >> $GITHUB_ENV
elif [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
mkdir -p swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.4.0/swigwin-4.4.0.zip/download > swig.zip
curl -L https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.4.1/swigwin-4.4.1.zip/download > swig.zip
unzip -q swig.zip -d install-swig
rm swig.zip
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/swigwin-4.4.0/" >> "${GITHUB_PATH}"
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/swigwin-4.4.1/" >> "${GITHUB_PATH}"
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
dnf install -y pcre-devel pcre2-devel
mkdir -p swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.4.0/swig-4.4.0.tar.gz/download > swig.tar.gz
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.4.1/swig-4.4.1.tar.gz/download > swig.tar.gz
tar -zxf swig.tar.gz
rm swig.tar.gz
mkdir -p install-swig
cd swig-4.4.0/
cd swig-4.4.1/
./configure --disable-dependency-tracking --prefix=${RUNNER_WORKSPACE}/swig/install-swig
make
make install
Expand All @@ -334,11 +337,11 @@ jobs:
sudo sed -i "681,684d;686d" /usr/share/swig4.0/swig.swg
# mkdir -p swig
# cd swig
# curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.3.0/swig-4.3.0.tar.gz/download > swig.tar.gz
# curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.4.1/swig-4.4.1.tar.gz/download > swig.tar.gz
# tar -zxf swig.tar.gz
# rm swig.tar.gz
# mkdir -p install-swig
# cd swig-4.3.0/
# cd swig-4.4.1/
# sed -i "677,680d;682d" Lib/swig.swg
# ./configure --disable-dependency-tracking --prefix=${RUNNER_WORKSPACE}/swig/install-swig
# make
Expand Down Expand Up @@ -451,21 +454,21 @@ jobs:
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest --output-on-failure --verbose --extra-verbose --progress --exclude-regex python_tests
ctest --output-on-failure --verbose --extra-verbose --progress --exclude-regex ython

- name: Run C RoadRunner tests (Ubuntu; skip plugins)
if: matrix.platform.build_type == 'Release' && matrix.build_tests == 'ON' && matrix.platform.os_type == 'ubuntu'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest --output-on-failure --verbose --extra-verbose --progress --exclude-regex python_tests --exclude-regex Plugin
ctest --output-on-failure --verbose --extra-verbose --progress --exclude-regex "ython|Plugin"

- name: Run Python Roadrunner tests (first Python version)
if: matrix.platform.build_python == 'ON' && matrix.build_tests == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress --tests-regex python_tests
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress --tests-regex ython

- name: Save roadrunner version
shell: bash
Expand All @@ -483,7 +486,7 @@ jobs:
echo "artifacts_path=${RUNNER_WORKSPACE}/install-roadrunner" >> $GITHUB_ENV

- name: Upload roadrunner binaries
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@main
with:
name: ${{ env.artifacts_name }}
path: ${{ env.artifacts_path }}
Expand Down Expand Up @@ -588,7 +591,7 @@ jobs:
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress --tests-regex python_tests
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress --tests-regex ython


- name: Create fourth Python wheel artifacts and rename
Expand Down Expand Up @@ -622,7 +625,7 @@ jobs:

- name: Upload RoadRunner Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@main
with:
name: ${{ env.roadrunner_python_wheel_artifacts_name }}
path: ${{ env.roadrunner_python_wheel_artifacts_file }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.16)

set(ROADRUNNER_VERSION_MAJOR 2)
set(ROADRUNNER_VERSION_MINOR 9)
set(ROADRUNNER_VERSION_PATCH 0)
set(ROADRUNNER_VERSION_PATCH 2)

set(ROADRUNNER_VERSION "${ROADRUNNER_VERSION_MAJOR}.${ROADRUNNER_VERSION_MINOR}.${ROADRUNNER_VERSION_PATCH}")

Expand Down
148 changes: 125 additions & 23 deletions source/llvm/LLVMExecutableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ void LLVMExecutableModel::getIds(int types, std::list<std::string> &ids)
if (getStoichiometry(s, r) != 0)
{
string rid = getReactionId(r);
ids.push_back("stoich(" + sid + ", " + rid + ")");
ids.push_back(symbols->getStoichiometryIdFor(sid, rid));
}
}
}
Expand Down Expand Up @@ -1478,15 +1478,19 @@ double LLVMExecutableModel::getValue(const std::string& id)
case SelectionRecord::INITIAL_GLOBAL_PARAMETER:
getGlobalParameterInitValues(1, &index, &result);
break;
case SelectionRecord::STOICHIOMETRY:
case SelectionRecord::INITIAL_STOICHIOMETRY:
result = getStoichiometry(index);
break;
case SelectionRecord::EVENT:
{
bool trigger = getEventTrigger(index);
result = trigger ? 1.0 : -1.0;
}
break;
default:
rrLog(Logger::LOG_ERROR) << "A new SelectionRecord should not have this value: "
<< sel.to_repr();
//rrLog(Logger::LOG_ERROR) << "A new SelectionRecord should not have this value: "
//<< sel.to_repr();
throw LLVMException("Invalid selection '" + id + "' for setting value");
break;
}
Expand Down Expand Up @@ -1603,6 +1607,10 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&
sel.selectionType = SelectionRecord::INITIAL_GLOBAL_PARAMETER;
sel.index = index;
break;
case LLVMModelDataSymbols::STOICHIOMETRY:
sel.selectionType = SelectionRecord::INITIAL_STOICHIOMETRY;
sel.index = index;
break;
default:
std::string msg = "Invalid Id for initial value: '" + str + "'";
throw LLVMException(msg);
Expand Down Expand Up @@ -1630,12 +1638,26 @@ const rr::SelectionRecord& LLVMExecutableModel::getSelection(const std::string&
}
break;
case SelectionRecord::STOICHIOMETRY:
sel.index = getStoichiometryIndex(sel.p1, sel.p2);
if (sel.p2.empty()) {
sel.index = getStoichiometryIndex(sel.p1);
if (sel.index == -1) {
throw LLVMException("Invalid id '" + str + "': could not find a stoichiometry with the ID '" + sel.p1 + "'.");
break;
}
}
else {
sel.index = getStoichiometryIndex(sel.p1, sel.p2);
if (sel.index == -1) {
throw LLVMException("Invalid id '" + str + "': could not find a species with the ID '" + sel.p1 + "', and/or a reaction with the ID '" + sel.p2 + "'");
break;
}
}

break;

default:
rrLog(Logger::LOG_ERROR) << "A new SelectionRecord should not have this value: "
<< sel.to_repr();
//rrLog(Logger::LOG_ERROR) << "A new SelectionRecord should not have this value: "
// << sel.to_repr();
throw LLVMException("Invalid selection '" + str + "' for setting value");
break;
}
Expand Down Expand Up @@ -1739,7 +1761,8 @@ void LLVMExecutableModel::setValue(const std::string& id, double value)
setGlobalParameterInitValues(1, &index, &value);
break;
case SelectionRecord::STOICHIOMETRY:
setStoichiometries(1, &index, &value);
case SelectionRecord::INITIAL_STOICHIOMETRY:
setStoichiometry(index, value);
break;
default:
throw LLVMException("Invalid selection '" + sel.to_string() + "' for setting value");
Expand Down Expand Up @@ -2314,25 +2337,73 @@ int LLVMExecutableModel::setCompartmentVolumes(size_t len, const int* indx,
return result;
}

int LLVMExecutableModel::setStoichiometries(size_t len, const int* indx,
const double* values)
{
return setStoichiometries(len, indx, values, true);
}
//int LLVMExecutableModel::setStoichiometries(size_t len, const int* indx,
// const double* values)
//{
// return setStoichiometries(len, indx, values, true);
//}

//int LLVMExecutableModel::setStoichiometries(size_t len, const int* indx,
// const double* values, bool strict)
//{
// if (len == 1) {
// int index = *indx;
// double value = *values;
// return setStoichiometry(index, value);
// }
//
// return -1;
//}

int LLVMExecutableModel::setStoichiometries(size_t len, const int* indx,
const double* values, bool strict)
int LLVMExecutableModel::setStoichiometry(int index, double value)
{
if (len == 1) {
int index = *indx;
double value = *values;
return setStoichiometry(index, value);
}
if (std::signbit(value))
throw LLVMException("Invalid stoichiometry value");

if (symbols->isConservedMoietyAnalysis())
throw LLVMException("Unable to set stoichiometries when conserved moieties are on");

std::list <LLVMModelDataSymbols::SpeciesReferenceInfo> stoichiometryIndx = symbols->getStoichiometryList();
std::list<LLVMModelDataSymbols::SpeciesReferenceInfo>::const_iterator stoichiometry = stoichiometryIndx.begin();
for (int i = 0; i < index; i++)
++stoichiometry;
if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Product)
return setStoichiometry(stoichiometry->row, stoichiometry->column, value);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Reactant)
return setStoichiometry(stoichiometry->row, stoichiometry->column, -1 * value);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::MultiReactantProduct)
throw LLVMException("Cannot set stoichiometry for a MultiReactantProduct");
else
throw LLVMException("Cannot set stoichiometry for a Modifier");

return -1;
}

int LLVMExecutableModel::setStoichiometry(int index, double value)
int LLVMExecutableModel::setStoichiometry(int speciesIndex, int reactionIndex, double value)
{
double result = csr_matrix_set_nz(modelData->stoichiometry, speciesIndex, reactionIndex, value);
return isnan(result) ? 0 : result;
}

//int LLVMExecutableModel::setInitStoichiometries(size_t len, const int* indx,
// const double* values)
//{
// return setInitStoichiometries(len, indx, values, true);
//}

//int LLVMExecutableModel::setInitStoichiometries(size_t len, const int* indx,
// const double* values, bool strict)
//{
// if (len == 1) {
// int index = *indx;
// double value = *values;
// return setInitStoichiometry(index, value);
// }
//
// return -1;
//}

int LLVMExecutableModel::setInitStoichiometry(int index, double value)
{
if (std::signbit(value))
throw LLVMException("Invalid stoichiometry value");
Expand All @@ -2345,9 +2416,9 @@ int LLVMExecutableModel::setStoichiometry(int index, double value)
for (int i = 0; i < index; i++)
++stoichiometry;
if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Product)
return setStoichiometry(stoichiometry->row, stoichiometry->column, value);
return setInitStoichiometry(stoichiometry->row, stoichiometry->column, value);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Reactant)
return setStoichiometry(stoichiometry->row, stoichiometry->column, -1 * value);
return setInitStoichiometry(stoichiometry->row, stoichiometry->column, -1 * value);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::MultiReactantProduct)
throw LLVMException("Cannot set stoichiometry for a MultiReactantProduct");
else
Expand All @@ -2356,8 +2427,10 @@ int LLVMExecutableModel::setStoichiometry(int index, double value)
return -1;
}

int LLVMExecutableModel::setStoichiometry(int speciesIndex, int reactionIndex, double value)
int LLVMExecutableModel::setInitStoichiometry(int speciesIndex, int reactionIndex, double value)
{
//For now, we don't store 'initStoichiometry' separately. Essentially, every stoichiometry set is to the initial value.
//double result = csr_matrix_set_nz(modelData->initStoichiometry, speciesIndex, reactionIndex, value);
double result = csr_matrix_set_nz(modelData->stoichiometry, speciesIndex, reactionIndex, value);
return isnan(result) ? 0 : result;
}
Expand Down Expand Up @@ -2389,6 +2462,35 @@ double LLVMExecutableModel::getStoichiometry(int speciesIndex, int reactionIndex
return isnan(result) ? 0 : result;
}

double LLVMExecutableModel::getInitStoichiometry(int index)
{
if (symbols->isConservedMoietyAnalysis())
throw LLVMException("Unable to get stoichiometries when conserved moieties are on");

if (index < 0)
throw LLVMException("The stoichiometry index is not valid");
std::list<LLVMModelDataSymbols::SpeciesReferenceInfo> stoichiometryIndx = symbols->getStoichiometryList();
std::list<LLVMModelDataSymbols::SpeciesReferenceInfo>::const_iterator stoichiometry = stoichiometryIndx.begin();
for (int i = 0; i < index; i++)
++stoichiometry;
if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Reactant)
return -1 * getInitStoichiometry(stoichiometry->row, stoichiometry->column);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::Product)
return getInitStoichiometry(stoichiometry->row, stoichiometry->column);
else if (stoichiometry->type == LLVMModelDataSymbols::SpeciesReferenceType::MultiReactantProduct)
throw LLVMException("Cannot return stoichiometry for a MultiReactantProduct");
else
throw LLVMException("Cannot return stoichiometry for a Modifier");
}

double LLVMExecutableModel::getInitStoichiometry(int speciesIndex, int reactionIndex)
{
//For now, we don't store 'initStoichiometry' separately. Essentially, every stoichiometry set is to the initial value.
//double result = csr_matrix_get_nz(modelData->initStoichiometry, speciesIndex, reactionIndex);
double result = csr_matrix_get_nz(modelData->stoichiometry, speciesIndex, reactionIndex);
return isnan(result) ? 0 : result;
}

/******************************* Events Section *******************************/
#if (1) /**********************************************************************/
/******************************************************************************/
Expand Down
Loading
Loading