diff --git a/README.md b/README.md index e40e0c0..f2ba0d1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Contributions to the collection are very welcome. For this, please create a new ## Overview + | PEtab Problem ID | Conditions | Estimated Parameters | Events | Preequilibration | Postequilibration | Measurements | Observables | Noise distribution(s) | Species | References | SBML4Humans | |:---------------------------------------------------------------------------------------------|-------------:|-----------------------:|---------:|-------------------:|--------------------:|---------------:|--------------:|:------------------------|----------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Alkan_SciSignal2018](Benchmark-Models/Alkan_SciSignal2018/) | 73 | 56 | 0 | 0 | 0 | 1733 | 12 | normal | 36 | [\[1\]](http://identifiers.org/doi/10.1126/scisignal.aat0229) | [\[1\]](https://sbml4humans.de/model_url?url=https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Alkan_SciSignal2018/model_Alkan_SciSignal2018.xml) | @@ -39,7 +40,7 @@ Contributions to the collection are very welcome. For this, please create a new | [Weber_BMC2015](Benchmark-Models/Weber_BMC2015/) | 2 | 36 | 0 | 1 | 0 | 135 | 8 | normal | 7 | [\[1\]](http://identifiers.org/doi/10.1186/s12918-015-0147-1) | [\[1\]](https://sbml4humans.de/model_url?url=https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Weber_BMC2015/model_Weber_BMC2015.xml) | | [Zhao_QuantBiol2020](Benchmark-Models/Zhao_QuantBiol2020/) | 7 | 28 | 0 | 0 | 0 | 82 | 1 | normal | 5 | [\[1\]](http://identifiers.org/pubmed/32219006) | [\[1\]](https://sbml4humans.de/model_url?url=https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Zhao_QuantBiol2020/SBML_Zhao_QuantBiol2020.xml) | | [Zheng_PNAS2012](Benchmark-Models/Zheng_PNAS2012/) | 1 | 46 | 0 | 1 | 0 | 60 | 15 | normal | 15 | [\[1\]](http://identifiers.org/doi/10.1073/pnas.1201240109) | [\[1\]](https://sbml4humans.de/model_url?url=https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Zheng_PNAS2012/model_Zheng_PNAS2012.xml) | - + ## License diff --git a/scripts/_helpers.py b/scripts/_helpers.py index ee3b9a0..12d56f5 100644 --- a/scripts/_helpers.py +++ b/scripts/_helpers.py @@ -1,10 +1,12 @@ from pathlib import Path -benchmark_path = Path(__file__).parent.parent / 'Benchmark-Models' +benchmark_path = Path(__file__).resolve().parent.parent / 'Benchmark-Models' petab_yamls = { petab_path.name: benchmark_path / petab_path.name / (petab_path.name + '.yaml') for petab_path in benchmark_path.glob('*') if petab_path.name != '.DS_Store' } petab_yamls = {k: petab_yamls[k] for k in sorted(petab_yamls)} + +readme_md = Path(__file__).resolve().parent.parent / "README.md" diff --git a/scripts/overview.py b/scripts/overview.py index a470858..9b27e1e 100755 --- a/scripts/overview.py +++ b/scripts/overview.py @@ -9,7 +9,7 @@ import pandas as pd import petab -from _helpers import petab_yamls +from _helpers import petab_yamls, readme_md markdown_columns = { @@ -145,8 +145,12 @@ def get_overview_table() -> pd.DataFrame: return df +start_overview_table = '\n\n' +end_overview_table = '\n\n' + def main( - markdown: bool = False, + markdown: bool = False, + update_readme: bool = False, ): df = get_overview_table() pd.options.display.width = 0 @@ -163,7 +167,24 @@ def main( ) df.index.rename(markdown_columns[index_column], inplace=True) df.rename(columns=markdown_columns, inplace=True) - print(df.to_markdown()) + markdown_overview = df.to_markdown() + if update_readme: + with open(readme_md, "r") as f: + readme_content = f.read() + before_table = readme_content.split(start_overview_table)[0] + after_table = readme_content.split(end_overview_table)[1] + new_readme_content = ( + before_table + + start_overview_table + + markdown_overview + + end_overview_table + + after_table + ) + with open(readme_md, "w") as f: + f.write(new_readme_content) + else: + print(markdown_overview) + else: print(df) @@ -172,6 +193,10 @@ def main( import sys markdown = False + update_readme = False if '--markdown' in sys.argv: markdown = True - main(markdown) + if '--update' in sys.argv: + markdown = True + update_readme = True + main(markdown=markdown, update_readme=update_readme)