Skip to content

Commit

Permalink
Merge pull request #137 from ssandrews/integrate-simularium
Browse files Browse the repository at this point in the history
feat: Integrate simularium file generation in exec combine function
  • Loading branch information
ssandrews authored Feb 1, 2024
2 parents 58e9198 + 687fb8e commit dfda744
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ log

.coverage
htmlcov/
.idea/
build-install.sh
Binary file added examples/S99_more/Min/Min1.omex
Binary file not shown.
1 change: 1 addition & 0 deletions source/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ setuptools.setup(
"biosimulators-utils[logging]>=0.1.124",
"numpy",
"pandas",
"biosimulators-simularium>=0.5.24"
],
"biosimulators-dev": [
"flake8",
Expand Down
26 changes: 23 additions & 3 deletions source/python/smoldyn/biosimulators/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
Symbol)
from biosimulators_utils.sedml.exec import exec_sed_doc as base_exec_sed_doc
from biosimulators_utils.utils.core import validate_str_value, parse_value, raise_errors_warnings
from biosimulators_simularium.exec import execute as exec_biosimularium
from smoldyn import smoldyn
import functools
import os
import numpy
import pandas
import re
import tempfile
import zipfile
import types # noqa: F401

__all__ = ['exec_sedml_docs_in_combine_archive', 'exec_sed_task', 'exec_sed_doc', 'preprocess_sed_task']
Expand All @@ -57,9 +59,27 @@ def exec_sedml_docs_in_combine_archive(archive_filename, out_dir, config=None):
* :obj:`SedDocumentResults`: results
* :obj:`CombineArchiveLog`: log
'''
return exec_sedml_docs_in_archive(exec_sed_doc, archive_filename, out_dir,
apply_xml_model_changes=False,
config=config)

print('GENERATING A SIMULARIUM FILE ------------- ')
# extract contents from archive
temp_archive_root = tempfile.mkdtemp()
with zipfile.ZipFile(archive_filename, 'r') as ref:
ref.extractall(temp_archive_root)

# process simularium file generation
exec_biosimularium(
working_dir=temp_archive_root,
output_dir=out_dir,
use_json=True
)

print('RUNNING A SEDML SIMULATION ------------------ ')
# process sed result
results, log = exec_sedml_docs_in_archive(exec_sed_doc, archive_filename, out_dir,
apply_xml_model_changes=False,
config=config)

return results, log


def exec_sed_doc(doc, working_dir, base_out_path, rel_out_path=None,
Expand Down

0 comments on commit dfda744

Please sign in to comment.