Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Integrate simularium file generation in exec combine function #137

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading