Skip to content

Commit

Permalink
Merge branch 'master' into experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Nov 13, 2024
2 parents a1890f0 + 5f666cc commit 581ac00
Show file tree
Hide file tree
Showing 39 changed files with 3,005 additions and 249 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/non-omv-remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ jobs:
omv install jneuroml
pip install "pymetadata>=0.4.2" docker "requests<2.32.0"
- name: Final version info
run: |
omv list -V # list installed engines
pip list
env
- name: Check health status of biosimulations API
run: |
cd SBML/tests
python ./test_biosimulators_api.py
- name: Test remote biosimulators compatibility table creation
run: |
cd SBML/tests
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/non-omv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ master, development, experimental, test*, feature/* ]
pull_request:
branches: [ master, development, experimental, test*, feature/* ]

jobs:
build:

Expand Down Expand Up @@ -64,4 +64,9 @@ jobs:
run: |
omv list -V # list installed engines
pip list
env
env
- name: Create results table
run: |
cd SBML/tests
python ./test_creation_combined_results_table.py
Binary file modified SBML/tests/d1_plots_local/amici_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/bionetgen_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/boolnet_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/cbmpy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/cobrapy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/copasi_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/gillespy2_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/ginsim_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/libsbmlsim_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/masspy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/pysces_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/rbapy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_local/tellurium_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/amici_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/bionetgen_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/boolnet_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/cbmpy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/cobrapy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/copasi_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/gillespy2_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/ginsim_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/libsbmlsim_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/masspy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/pysces_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/rbapy_d1.pdf
Binary file not shown.
Binary file modified SBML/tests/d1_plots_remote/tellurium_d1.pdf
Binary file not shown.
46 changes: 23 additions & 23 deletions SBML/tests/results_compatibility_biosimulators.md

Large diffs are not rendered by default.

1,265 changes: 1,265 additions & 0 deletions SBML/tests/results_local.json

Large diffs are not rendered by default.

1,358 changes: 1,358 additions & 0 deletions SBML/tests/results_remote.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions SBML/tests/test_biosimulators_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python
"""Test health status of the BioSimulators API."""

import requests
import sys

biosimulations_api_url = "https://api.biosimulations.org/health"

r = requests.get(biosimulations_api_url)
r_status = r.json()["status"]

if r_status == "ok":
exit_status = 0
else:
exit_status = 1

sys.exit(exit_status)
18 changes: 11 additions & 7 deletions SBML/tests/test_biosimulators_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

"""
This script tests the compatibility of different biosimulation engines with a given SBML and SED-ML file.
It runs each engine and records the result (pass/fail) and any error messages encountered during the simulation.
The results are then displayed in a table and saved to a markdown file.
It runs each engine and saves a JSON file with the log.yml file (as a dict), and the d1 plot for each engine.
"""

import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) # to import utils
import utils
import argparse

engines = utils.engines
types_dict = utils.types_dict
import json

# Save the current working directory
cwd = os.getcwd()
Expand Down Expand Up @@ -41,8 +38,15 @@

print('d1 plots will be saved in:', d1_plots_local_dir)

results_local = utils.run_biosimulators_locally(sedml_file_name=sedml_file_name,
engine_keys = list(utils.ENGINES.keys())

results_local = utils.run_biosimulators_locally(engine_keys,
sedml_file_name=sedml_file_name,
sbml_file_name=sbml_file_name,
d1_plots_local_dir=d1_plots_local_dir,
engines=engines, test_folder=test_folder)
test_folder=test_folder)

results_local_path = os.path.join(path_to_sbml_folder, 'tests', 'results_local.json')
with open(results_local_path, 'w') as fp:
json.dump(results_local, fp, indent=4)

17 changes: 11 additions & 6 deletions SBML/tests/test_biosimulators_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

"""
This script tests the compatibility of different biosimulation engines with a given SBML and SED-ML file.
It runs each engine and records the result (pass/fail) and any error messages encountered during the simulation.
The results are then displayed in a table and saved to a markdown file.
It runs each engine and saves the d1 plots, and a JSON file containing the log.yml file (as dict) and the
links for accessing the remote results, for each engine.
"""

import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) # to import utils
import utils
import argparse
import json

engines = utils.engines
types_dict = utils.types_dict

# Save the current working directory
cwd = os.getcwd()
Expand Down Expand Up @@ -41,8 +40,14 @@

print('d1 plots will be saved in:', d1_plots_remote_dir)

results_remote = utils.run_biosimulators_remotely(sedml_file_name=sedml_file_name,
engine_keys = list(utils.ENGINES.keys())

results_remote = utils.run_biosimulators_remotely(engine_keys, sedml_file_name=sedml_file_name,
sbml_file_name=sbml_file_name,
d1_plots_remote_dir=d1_plots_remote_dir,
engines=engines, test_folder=test_folder)
test_folder=test_folder)

results_remote_path = os.path.join(path_to_sbml_folder, 'tests', 'results_remote.json')
with open(results_remote_path, 'w') as fp:
json.dump(results_remote, fp, indent=4)

11 changes: 7 additions & 4 deletions SBML/tests/test_compatibility_biosimulators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import utils
import argparse

engines = utils.engines
types_dict = utils.types_dict
engines = utils.ENGINES
types_dict = utils.TYPES

# Save the current working directory
cwd = os.getcwd()
Expand Down Expand Up @@ -42,8 +42,11 @@

print('d1 plots will be saved in:', d1_plots_remote_dir, 'and', d1_plots_local_dir)

utils.run_biosimulators_remotely_and_locally(sedml_file_name,
engine_keys = list(utils.ENGINES.keys())

utils.run_biosimulators_remotely_and_locally(engine_keys,
sedml_file_name,
sbml_file_name,
d1_plots_remote_dir,
d1_plots_local_dir,
engines=engines, test_folder=test_folder)
test_folder=test_folder)
54 changes: 54 additions & 0 deletions SBML/tests/test_creation_combined_results_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))) # to import utils
import utils
import argparse
import json

engines = utils.ENGINES

# Save the current working directory
cwd = os.getcwd()
print('Current working directory:', cwd)

# SBML folder is one folder up relative to cwd
path_to_sbml_folder = os.path.abspath(os.path.join(cwd, os.pardir))
print('Path to SBML folder:', path_to_sbml_folder)

# change the working directory to the SBML folder (because here the SBML and SED-ML files are located)
os.chdir(path_to_sbml_folder)
print('Changed working directory to:', os.getcwd())

sbml_file_name = 'LEMS_NML2_Ex9_FN.sbml'
sedml_file_name = 'LEMS_NML2_Ex9_FN_missing_xmlns.sedml' #xmlns:sbml missing

# output_dir is set to 'd1_plots' by default but can be changed using the --output-dir argument (required to deal with GitHub Actions permission issues)
parser = argparse.ArgumentParser(description='Test compatibility of different biosimulation engines')
parser.add_argument('--output-dir',action='store',default='d1_plots',help='prefix of the output directory where the d1 plots will be saved')
args = parser.parse_args()

test_folder = 'tests'

d1_plots_local_dir = os.path.join(test_folder, args.output_dir + '_local')
d1_plots_remote_dir = os.path.join(test_folder, args.output_dir + '_remote')

results_paths = {
"local": os.path.join(path_to_sbml_folder, 'tests', 'results_local.json'),
"remote": os.path.join(path_to_sbml_folder, 'tests', 'results_remote.json')
}

results = {}
for key, path in results_paths.items():
with open(path, 'r') as f:
results[key] = json.load(f)

results_table = utils.create_combined_results_table(results["remote"],
results["local"],
sedml_file_name,
sbml_file_name,
d1_plots_local_dir,
d1_plots_remote_dir,
test_folder='tests')

print(results_table)

1 change: 1 addition & 0 deletions test_suite/test_01186/COPASI
Submodule COPASI added at 4dfa02
2 changes: 1 addition & 1 deletion test_suite/test_test_suite_compatibility_biosimulators.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def process_cases(args):
os.path.basename(sbml_file_path),
os.path.join(test_folder,'d1_plots_remote'),
os.path.join(test_folder,'d1_plots_local'),
engines=engines, test_folder=test_folder)
test_folder=test_folder)


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit 581ac00

Please sign in to comment.