-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from biosimulators/reconcile-rbapy
remove RBApy until it can be added back via PyPI
- Loading branch information
Showing
10 changed files
with
458 additions
and
498 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.1.189' | ||
__version__ = '0.2.0' |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "biosimulators-utils" | ||
version = "0.1.188" | ||
version = "0.2.0" | ||
description = "description" | ||
license = "MIT" | ||
authors = ["Center for Reproducible Biomedical Modeling <[email protected]>"] | ||
|
@@ -21,7 +21,7 @@ include = [ | |
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "~3.10" | ||
python = "^3.10" | ||
appdirs = "*" | ||
biopython = "*" | ||
cement = "*" | ||
|
@@ -58,7 +58,7 @@ pylems = {version = "*", optional = true} | |
pyneuroml = {version = ">=0.5.18", optional = true} | ||
pint = {version = "*", optional = true} | ||
libneuroml = {version = "*", optional = true} | ||
rbapy = { git = "https://github.com/biosimulators/RBApy.git", rev="d82e1ade319cb503f6e28759a0cbeffccabd89e8", optional = true } | ||
#rbapy = { git = "https://github.com/biosimulators/RBApy.git", rev="d82e1ade319cb503f6e28759a0cbeffccabd89e8", optional = true } | ||
python-libsbml = {version = "*", optional = true} | ||
smoldyn = {version = ">=2.66", optional = true} | ||
simulariumio = {version = "*", optional = true} | ||
|
@@ -111,18 +111,17 @@ dependencies = { pylems = "*", pyneuroml = "*", pint = "*" } | |
optional = true | ||
dependencies = { libneuroml = "*", pyneuroml = ">=0.5.18" } | ||
|
||
[tool.poetry.group.rba] | ||
optional = true | ||
# in requirements.optional.txt, rbapy was specified as: | ||
# | ||
# [rba] | ||
# python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy | ||
# | ||
dependencies = { rbapy = { git = "https://github.com/biosimulators/RBApy.git", rev="d82e1ade319cb503f6e28759a0cbeffccabd89e8" } } | ||
# | ||
# if using official release (not biosimulators fork), use: | ||
# dependencies = { rbapy = "*" } | ||
|
||
#[tool.poetry.group.rba] | ||
#optional = true | ||
## in requirements.optional.txt, rbapy was specified as: | ||
## | ||
## [rba] | ||
## python -m pip install git+https://github.com/biosimulators/RBApy.git#egg=rbapy | ||
## | ||
# dependencies = { rbapy = { git = "https://github.com/biosimulators/RBApy.git", rev="d82e1ade319cb503f6e28759a0cbeffccabd89e8" } } | ||
## | ||
## if using official release (not biosimulators fork), use: | ||
## dependencies = { rbapy = "*" } | ||
|
||
[tool.poetry.group.sbml] | ||
optional = true | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,80 @@ | ||
from biosimulators_utils.model_lang.rba.utils import get_parameters_variables_outputs_for_simulation | ||
from biosimulators_utils.sedml.data_model import SteadyStateSimulation | ||
import math | ||
import os | ||
# from biosimulators_utils.model_lang.rba.utils import get_parameters_variables_outputs_for_simulation | ||
# from biosimulators_utils.sedml.data_model import SteadyStateSimulation | ||
# import math | ||
# import os | ||
import unittest | ||
|
||
|
||
class RbaUtilsTestCase(unittest.TestCase): | ||
FIXTURES_DIRNAME = os.path.join(os.path.dirname(__file__), '..', '..', 'fixtures', 'rba') | ||
|
||
def test_get_parameters_variables_for_simulation(self): | ||
filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
params, sims, vars, plots = get_parameters_variables_outputs_for_simulation(filename, None, SteadyStateSimulation) | ||
|
||
self.assertEqual(len(params), 1620) | ||
|
||
param = next(param for param in params if param.id == 'parameter_amino_acid_concentration_Y_MIN') | ||
self.assertEqual(param.name, 'Value of parameter "Y_MIN" of function "amino_acid_concentration"') | ||
self.assertEqual(param.target, 'parameters.functions.amino_acid_concentration.parameters.Y_MIN') | ||
self.assertEqual(param.new_value, '-inf') | ||
|
||
self.assertEqual(len(sims), 1) | ||
sim = sims[0] | ||
self.assertIsInstance(sim, SteadyStateSimulation) | ||
self.assertEqual(sim.algorithm.kisao_id, 'KISAO_0000669') | ||
self.assertEqual(sim.algorithm.changes, []) | ||
|
||
self.assertEqual(len(vars), 15766) | ||
|
||
self.assertEqual(vars[0].id, 'objective') | ||
self.assertEqual(vars[0].name, 'Value of objective') | ||
self.assertEqual(vars[0].target, 'objective') | ||
|
||
var = next(var for var in vars if var.id == 'M_pqq_p') | ||
self.assertEqual(var.name, 'Dual of constraint "M_pqq_p"') | ||
self.assertEqual(var.target, 'constraints.M_pqq_p') | ||
|
||
var = next(var for var in vars if var.id == 'test_process_2_machinery') | ||
self.assertEqual(var.name, 'Primal of variable "test_process_2_machinery"') | ||
self.assertEqual(var.target, 'variables.test_process_2_machinery') | ||
|
||
def test_get_parameters_variables_for_simulation_native_ids_data_types(self): | ||
filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
params, sims, vars, plots = get_parameters_variables_outputs_for_simulation(filename, None, SteadyStateSimulation, native_ids=True, native_data_types=True) | ||
|
||
self.assertEqual(len(params), 1620) | ||
|
||
param = next(param for param in params if param.id == 'amino_acid_concentration.Y_MIN') | ||
self.assertEqual(param.name, None) | ||
self.assertEqual(param.target, 'parameters.functions.amino_acid_concentration.parameters.Y_MIN') | ||
self.assertEqual(param.new_value, -math.inf) | ||
|
||
self.assertEqual(len(sims), 1) | ||
sim = sims[0] | ||
self.assertIsInstance(sim, SteadyStateSimulation) | ||
self.assertEqual(sim.algorithm.kisao_id, 'KISAO_0000669') | ||
self.assertEqual(sim.algorithm.changes, []) | ||
|
||
self.assertEqual(len(vars), 15766) | ||
|
||
self.assertEqual(vars[0].id, None) | ||
self.assertEqual(vars[0].name, None) | ||
self.assertEqual(vars[0].target, 'objective') | ||
|
||
var = next(var for var in vars if var.id == 'M_pqq_p') | ||
self.assertEqual(var.name, None) | ||
self.assertEqual(var.target, 'constraints.M_pqq_p') | ||
|
||
var = next(var for var in vars if var.id == 'test_process_2_machinery') | ||
self.assertEqual(var.name, None) | ||
self.assertEqual(var.target, 'variables.test_process_2_machinery') | ||
|
||
def test_get_parameters_variables_for_simulation_error_handling(self): | ||
with self.assertRaises(ValueError): | ||
get_parameters_variables_outputs_for_simulation(None, None, None) | ||
|
||
filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
with self.assertRaises(NotImplementedError): | ||
get_parameters_variables_outputs_for_simulation(filename, None, None) | ||
pass | ||
# FIXTURES_DIRNAME = os.path.join(os.path.dirname(__file__), '..', '..', 'fixtures', 'rba') | ||
|
||
# def test_get_parameters_variables_for_simulation(self): | ||
# filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
# params, sims, vars, plots = get_parameters_variables_outputs_for_simulation(filename, None, SteadyStateSimulation) | ||
# | ||
# self.assertEqual(len(params), 1620) | ||
# | ||
# param = next(param for param in params if param.id == 'parameter_amino_acid_concentration_Y_MIN') | ||
# self.assertEqual(param.name, 'Value of parameter "Y_MIN" of function "amino_acid_concentration"') | ||
# self.assertEqual(param.target, 'parameters.functions.amino_acid_concentration.parameters.Y_MIN') | ||
# self.assertEqual(param.new_value, '-inf') | ||
# | ||
# self.assertEqual(len(sims), 1) | ||
# sim = sims[0] | ||
# self.assertIsInstance(sim, SteadyStateSimulation) | ||
# self.assertEqual(sim.algorithm.kisao_id, 'KISAO_0000669') | ||
# self.assertEqual(sim.algorithm.changes, []) | ||
# | ||
# self.assertEqual(len(vars), 15766) | ||
# | ||
# self.assertEqual(vars[0].id, 'objective') | ||
# self.assertEqual(vars[0].name, 'Value of objective') | ||
# self.assertEqual(vars[0].target, 'objective') | ||
# | ||
# var = next(var for var in vars if var.id == 'M_pqq_p') | ||
# self.assertEqual(var.name, 'Dual of constraint "M_pqq_p"') | ||
# self.assertEqual(var.target, 'constraints.M_pqq_p') | ||
# | ||
# var = next(var for var in vars if var.id == 'test_process_2_machinery') | ||
# self.assertEqual(var.name, 'Primal of variable "test_process_2_machinery"') | ||
# self.assertEqual(var.target, 'variables.test_process_2_machinery') | ||
# | ||
# def test_get_parameters_variables_for_simulation_native_ids_data_types(self): | ||
# filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
# params, sims, vars, plots = get_parameters_variables_outputs_for_simulation(filename, None, SteadyStateSimulation, native_ids=True, native_data_types=True) | ||
# | ||
# self.assertEqual(len(params), 1620) | ||
# | ||
# param = next(param for param in params if param.id == 'amino_acid_concentration.Y_MIN') | ||
# self.assertEqual(param.name, None) | ||
# self.assertEqual(param.target, 'parameters.functions.amino_acid_concentration.parameters.Y_MIN') | ||
# self.assertEqual(param.new_value, -math.inf) | ||
# | ||
# self.assertEqual(len(sims), 1) | ||
# sim = sims[0] | ||
# self.assertIsInstance(sim, SteadyStateSimulation) | ||
# self.assertEqual(sim.algorithm.kisao_id, 'KISAO_0000669') | ||
# self.assertEqual(sim.algorithm.changes, []) | ||
# | ||
# self.assertEqual(len(vars), 15766) | ||
# | ||
# self.assertEqual(vars[0].id, None) | ||
# self.assertEqual(vars[0].name, None) | ||
# self.assertEqual(vars[0].target, 'objective') | ||
# | ||
# var = next(var for var in vars if var.id == 'M_pqq_p') | ||
# self.assertEqual(var.name, None) | ||
# self.assertEqual(var.target, 'constraints.M_pqq_p') | ||
# | ||
# var = next(var for var in vars if var.id == 'test_process_2_machinery') | ||
# self.assertEqual(var.name, None) | ||
# self.assertEqual(var.target, 'variables.test_process_2_machinery') | ||
# | ||
# def test_get_parameters_variables_for_simulation_error_handling(self): | ||
# with self.assertRaises(ValueError): | ||
# get_parameters_variables_outputs_for_simulation(None, None, None) | ||
# | ||
# filename = os.path.join(self.FIXTURES_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
# with self.assertRaises(NotImplementedError): | ||
# get_parameters_variables_outputs_for_simulation(filename, None, None) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
from biosimulators_utils.model_lang.rba import validation | ||
from biosimulators_utils.utils.core import flatten_nested_list_of_strings | ||
import os | ||
import rba | ||
# from biosimulators_utils.model_lang.rba import validation | ||
# from biosimulators_utils.utils.core import flatten_nested_list_of_strings | ||
# import os | ||
# import rba | ||
import unittest | ||
|
||
|
||
class RbaValidationTestCase(unittest.TestCase): | ||
FIXTURE_DIRNAME = os.path.join(os.path.dirname(__file__), '..', '..', 'fixtures', 'rba') | ||
pass | ||
# FIXTURE_DIRNAME = os.path.join(os.path.dirname(__file__), '..', '..', 'fixtures', 'rba') | ||
|
||
def test(self): | ||
filename = os.path.join(self.FIXTURE_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
errors, warnings, model = validation.validate_model(filename) | ||
self.assertEqual(errors, []) | ||
self.assertEqual(warnings, []) | ||
self.assertIsInstance(model, rba.model.RbaModel) | ||
|
||
filename = None | ||
errors, warnings, model = validation.validate_model(filename) | ||
self.assertIn('is not a path', flatten_nested_list_of_strings(errors)) | ||
self.assertEqual(warnings, []) | ||
self.assertEqual(model, None) | ||
|
||
filename = os.path.join(self.FIXTURE_DIRNAME, 'not exist.zip') | ||
errors, warnings, model = validation.validate_model(filename) | ||
self.assertIn('does not exist', flatten_nested_list_of_strings(errors)) | ||
self.assertEqual(warnings, []) | ||
self.assertEqual(model, None) | ||
|
||
filename = __file__ | ||
errors, warnings, model = validation.validate_model(filename) | ||
self.assertIn('is not a valid RBA', flatten_nested_list_of_strings(errors)) | ||
self.assertEqual(warnings, []) | ||
self.assertEqual(model, None) | ||
|
||
filename = os.path.join(self.FIXTURE_DIRNAME, 'Escherichia-coli-K12-WT-invalid.zip') | ||
errors, warnings, model = validation.validate_model(filename) | ||
self.assertIn('is not a valid RBA', flatten_nested_list_of_strings(errors)) | ||
self.assertEqual(warnings, []) | ||
self.assertEqual(model, None) | ||
# def test(self): | ||
# filename = os.path.join(self.FIXTURE_DIRNAME, 'Escherichia-coli-K12-WT.zip') | ||
# errors, warnings, model = validation.validate_model(filename) | ||
# self.assertEqual(errors, []) | ||
# self.assertEqual(warnings, []) | ||
# self.assertIsInstance(model, rba.model.RbaModel) | ||
# | ||
# filename = None | ||
# errors, warnings, model = validation.validate_model(filename) | ||
# self.assertIn('is not a path', flatten_nested_list_of_strings(errors)) | ||
# self.assertEqual(warnings, []) | ||
# self.assertEqual(model, None) | ||
# | ||
# filename = os.path.join(self.FIXTURE_DIRNAME, 'not exist.zip') | ||
# errors, warnings, model = validation.validate_model(filename) | ||
# self.assertIn('does not exist', flatten_nested_list_of_strings(errors)) | ||
# self.assertEqual(warnings, []) | ||
# self.assertEqual(model, None) | ||
# | ||
# filename = __file__ | ||
# errors, warnings, model = validation.validate_model(filename) | ||
# self.assertIn('is not a valid RBA', flatten_nested_list_of_strings(errors)) | ||
# self.assertEqual(warnings, []) | ||
# self.assertEqual(model, None) | ||
# | ||
# filename = os.path.join(self.FIXTURE_DIRNAME, 'Escherichia-coli-K12-WT-invalid.zip') | ||
# errors, warnings, model = validation.validate_model(filename) | ||
# self.assertIn('is not a valid RBA', flatten_nested_list_of_strings(errors)) | ||
# self.assertEqual(warnings, []) | ||
# self.assertEqual(model, None) |
Oops, something went wrong.