generated from vivarium-collective/vivarium-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from vivarium-collective/process-setup
feat: added deps to requirements and configured setup file
- Loading branch information
Showing
10 changed files
with
214 additions
and
134 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.egg | ||
*.egg-info | ||
/idea |
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 |
---|---|---|
|
@@ -11,4 +11,6 @@ | |
# pip install -r requirements.txt | ||
# | ||
|
||
-e . | ||
vivarium-core | ||
tellurium | ||
pytest |
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,35 +1,30 @@ | ||
import os | ||
import glob | ||
import setuptools | ||
from distutils.core import setup | ||
# import os | ||
from setuptools import setup | ||
|
||
with open("README.md", 'r') as readme: | ||
long_description = readme.read() | ||
|
||
setup( | ||
name='', # TODO: Put your package name here. | ||
name='vivarium-tellurium', | ||
version='0.0.1', | ||
packages=[ | ||
# TODO: Replace 'template' with the name of your folder. | ||
'template', | ||
'template.processes', | ||
'template.composites', | ||
'template.experiments', | ||
'vivarium_tellurium', | ||
'vivarium_tellurium.composites', | ||
'vivarium_tellurium.experiments', | ||
'vivarium_tellurium.library', | ||
'vivarium_tellurium.processes', | ||
], | ||
author='', # TODO: Put your name here. | ||
author_email='', # TODO: Put your email here. | ||
url='', # TODO: Put your project URL here. | ||
license='', # TODO: Choose a license. | ||
entry_points={ | ||
'console_scripts': []}, | ||
short_description='', # TODO: Describe your project briefely. | ||
author='Eran Agmon, Alexander Patrie', | ||
author_email='', | ||
url='https://github.com/vivarium-collective/vivarium-tellurium', | ||
license='', | ||
description='A Vivarium interface for Tellurium', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
package_data={}, | ||
include_package_data=True, | ||
install_requires=[ | ||
'vivarium-core>=1.0.0', | ||
'vivarium-core', | ||
'tellurium', | ||
'pytest', | ||
# TODO: Add other dependencies. | ||
], | ||
) | ||
) |
Binary file not shown.
55 changes: 0 additions & 55 deletions
55
vivarium_tellurium/composites/injected_glc_phosphorylation.py
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,113 @@ | ||
""" | ||
================== | ||
Template Composite | ||
================== | ||
This is a toy composite that loads in two template processes and combines them. | ||
""" | ||
|
||
# TODO: Delete this file before publishing your project. | ||
|
||
from vivarium.core.engine import Engine, pp | ||
from vivarium.core.composer import Composer | ||
from vivarium.library.pretty import format_dict | ||
from vivarium.processes.injector import Injector | ||
|
||
from vivarium_tellurium.processes.tellurium_process import Template | ||
|
||
|
||
class TemplateComposer(Composer): | ||
|
||
defaults = { | ||
'template1': { | ||
'parameter1': 2.0, | ||
}, | ||
'template2': { | ||
'parameter1': 5.0, | ||
}, | ||
} | ||
|
||
def __init__(self, config=None): | ||
super().__init__(config) | ||
|
||
def generate_processes(self, config): | ||
template1 = Template(self.config['template1']) | ||
template2 = Template(self.config['template2']) | ||
|
||
return { | ||
'template1': template1, | ||
'template2': template2, | ||
} | ||
|
||
def generate_topology(self, config): | ||
return { | ||
'template1': { | ||
'internal': ('internal_1',), | ||
'external': ('external_shared', ), | ||
}, | ||
'template2': { | ||
'internal': ('internal_2',), | ||
'external': ('external_shared', ), | ||
}, | ||
} | ||
|
||
|
||
def test_template_composite(): | ||
'''Run a simulation of the composite. | ||
Returns: | ||
The simulation output. | ||
''' | ||
|
||
# 1.) Declare the initial state, mirroring the ports structure. May be passed as a parsable argument. | ||
initial_state = { | ||
'internal_1': { | ||
'A': 0.0 | ||
}, | ||
'internal_2': { | ||
'A': 10.0 | ||
}, | ||
'external_shared': { | ||
'A': 1.0 | ||
}, | ||
} | ||
|
||
# 2.) Create the simulation run parameters for the simulator | ||
config = { | ||
'template1': { | ||
'parameter1': 4.0, | ||
}, | ||
'template2': { | ||
'parameter1': 4.0, | ||
} | ||
} | ||
|
||
# 3.) Initialize the composer by passing in a config dict | ||
template_composer = TemplateComposer(config) | ||
|
||
# 4.) Generate a composite by calling the Composers' generate method | ||
template_composite = template_composer.generate() | ||
|
||
# 5.) Feed the compsite instance you just created to the vivarium Engine | ||
sim = Engine( | ||
composite=template_composite, | ||
initial_state=initial_state | ||
) | ||
|
||
# 6.) Call update with that sim object, which calls the next_update method in the implementation you created above using total_time | ||
total_time = 3 | ||
sim.update( | ||
interval=total_time | ||
) | ||
|
||
# 7.) Get the data which is emitted from the sim object. | ||
data = sim.emitter.get_timeseries() | ||
|
||
# 7a.) Observe the data which is return from running the process: | ||
print(f'RESULTS: {pp(data)}') | ||
return data | ||
|
||
|
||
# run module with python template/processes/template_composite.py | ||
if __name__ == '__main__': | ||
test_template_composite() |
Oops, something went wrong.