Skip to content

Commit

Permalink
Merge pull request #415 from biosustain/move_example_inputs_into_package
Browse files Browse the repository at this point in the history
Move example inputs into package
  • Loading branch information
teddygroves authored Feb 1, 2023
2 parents 8aec695 + 5e4eea7 commit 2113a0c
Show file tree
Hide file tree
Showing 42 changed files with 517 additions and 788 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: '3.9'
- name: Install Maud
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run_tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up Python 3.9
python-version: '3.9'
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install Maud
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
recursive-include tests/data *
recursive-include src/maud/stan *.stan
recursive-include src/maud/data *
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ To run the simple linear model, use the following command:
This will compile the Stan program at `src/maud/inference_model.stan
<https://github.com/biosustain/Maud/blob/master/src/maud/inference_model.stan>`_,
then run the resulting binary file using the data at `tests/data/linar.toml
<https://github.com/biosustain/Maud/blob/master/tests/data/linear.toml>`_, storing
the results in csv files starting with
then run the resulting binary file using the data at `src/maud/data/example_inputs/linear
<https://github.com/biosustain/Maud/blob/master/src/maud/data/example_inputs/linear>`_, storing
the results in a folder whose name starts with
:code:`model_output_linear`.

The `sample` command can be configured in a few ways - to check out all the
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ url = https://github.com/biosustain/Maud
download_url = https://pypi.org/project/maud-metabolic-models/
author = Novo Nordisk Foundation Center for Biosustainability, Technical University of Denmark
author_email = [email protected]
version = 0.4.0.0
version = 0.4.0.1
# Please consult https://pypi.org/classifiers/ for a full list.
classifiers =
Development Status :: 2 - Pre-Alpha
Expand All @@ -30,6 +30,7 @@ include_package_data=True
install_requires =
pip >= 20
arviz >= 0.12.1
importlib_resources >= 3.2
numpy
scipy
sympy
Expand Down
17 changes: 6 additions & 11 deletions src/maud/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@

import arviz as az
import click
import importlib_resources

from maud.data.example_inputs import linear
from maud.getting_idatas import get_idata
from maud.loading_maud_inputs import load_maud_input
from maud.running_stan import predict, sample, simulate, variational


RELATIVE_PATH_EXAMPLE = "../../tests/data/linear"


def get_example_path(relative_path_example):
"""Get absolute path to file containing example input."""

here = os.path.dirname(os.path.abspath(__file__))
return os.path.join(here, relative_path_example)
EXAMPLE_INPUT_PATH = importlib_resources.files(linear)._paths[0]


@click.group()
Expand All @@ -50,7 +45,7 @@ def cli():
@click.argument(
"data_path",
type=click.Path(exists=True, dir_okay=True, file_okay=False),
default=get_example_path(RELATIVE_PATH_EXAMPLE),
default=EXAMPLE_INPUT_PATH,
)
def sample_command(data_path, output_dir):
"""Generate MCMC samples given a user input directory.
Expand Down Expand Up @@ -149,7 +144,7 @@ def do_predict(data_path: str):
@click.argument(
"data_path",
type=click.Path(exists=True, dir_okay=True, file_okay=False),
default=get_example_path(RELATIVE_PATH_EXAMPLE),
default=EXAMPLE_INPUT_PATH,
)
def simulate_command(data_path, output_dir, n):
"""Generate draws from the initial values."""
Expand Down Expand Up @@ -266,7 +261,7 @@ def do_simulate(data_path, output_dir, n):
@click.argument(
"data_path",
type=click.Path(exists=True, dir_okay=True, file_okay=False),
default=get_example_path(RELATIVE_PATH_EXAMPLE),
default=EXAMPLE_INPUT_PATH,
)
def variational_command(data_path, output_dir):
"""Generate MCMC samples given a user input directory.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions src/maud/data/example_inputs/linear/priors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
kcat = [
{exploc = 1, scale = 0.6, reaction = "r1", enzyme = "r1"},
{exploc = 1, scale = 0.6, reaction = "r2", enzyme = "r2"},
{exploc = 1, scale = 0.6, reaction = "r3", enzyme = "r3"},
]

km = [
{exploc = 1, scale = 0.6, metabolite = "M1", compartment = "e", enzyme = "r1"},
{exploc = 1, scale = 0.6, metabolite = "M1", compartment = "c", enzyme = "r1"},
{exploc = 1, scale = 0.6, metabolite = "M1", compartment = "c", enzyme = "r2"},
{exploc = 1, scale = 0.6, metabolite = "M2", compartment = "c", enzyme = "r3"},
{exploc = 1, scale = 0.6, metabolite = "M2", compartment = "e", enzyme = "r3"},
]

transfer_constant = [
{exploc = 1, scale = 0.6, enzyme = "r1"},
{exploc = 1, scale = 0.6, enzyme = "r2"},
]

dissociation_constant = [
{exploc = 1, scale = 0.6, enzyme = "r1", metabolite = "M2", compartment = "c", modification_type = "activation"},
{exploc = 1, scale = 0.6, enzyme = "r2", metabolite = "M1", compartment = "c", modification_type = "inhibition"},
]

dgf = [
{location = -1, metabolite = "M1", scale = 0.05},
{location = -2, metabolite = "M2", scale = 0.05},
]

psi = [
{location = -0.95, scale = 0.2, experiment = "condition1"},
{location = -0.95, scale = 0.2, experiment = "condition2"},
]

ki = [
{exploc = 1, scale = 0.6, enzyme = "r2", reaction = "r2", metabolite = "M1", compartment = "c"},
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2113a0c

Please sign in to comment.