pymodrev 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. pymodrev-0.1.0/.github/workflows/python-publish.yml +36 -0
  2. pymodrev-0.1.0/.gitignore +10 -0
  3. pymodrev-0.1.0/CHANGELOG.md +37 -0
  4. pymodrev-0.1.0/PKG-INFO +156 -0
  5. pymodrev-0.1.0/README.md +127 -0
  6. pymodrev-0.1.0/examples/boolean_cell_cycle/00/README +2 -0
  7. pymodrev-0.1.0/examples/boolean_cell_cycle/00/model.bnet +11 -0
  8. pymodrev-0.1.0/examples/boolean_cell_cycle/00/model.lp +136 -0
  9. pymodrev-0.1.0/examples/boolean_cell_cycle/00/model.zginml +0 -0
  10. pymodrev-0.1.0/examples/boolean_cell_cycle/00/output.txt +1 -0
  11. pymodrev-0.1.0/examples/boolean_cell_cycle/00/steadystate.csv +2 -0
  12. pymodrev-0.1.0/examples/boolean_cell_cycle/00/steadystate.lp +11 -0
  13. pymodrev-0.1.0/examples/boolean_cell_cycle/01/README +2 -0
  14. pymodrev-0.1.0/examples/boolean_cell_cycle/01/model.bnet +11 -0
  15. pymodrev-0.1.0/examples/boolean_cell_cycle/01/model.lp +136 -0
  16. pymodrev-0.1.0/examples/boolean_cell_cycle/01/model.zginml +0 -0
  17. pymodrev-0.1.0/examples/boolean_cell_cycle/01/output.txt +1 -0
  18. pymodrev-0.1.0/examples/boolean_cell_cycle/01/steadystate.csv +2 -0
  19. pymodrev-0.1.0/examples/boolean_cell_cycle/01/steadystate.lp +11 -0
  20. pymodrev-0.1.0/examples/boolean_cell_cycle/02/README +2 -0
  21. pymodrev-0.1.0/examples/boolean_cell_cycle/02/model.bnet +11 -0
  22. pymodrev-0.1.0/examples/boolean_cell_cycle/02/model.lp +115 -0
  23. pymodrev-0.1.0/examples/boolean_cell_cycle/02/model.zginml +0 -0
  24. pymodrev-0.1.0/examples/boolean_cell_cycle/02/output.txt +1 -0
  25. pymodrev-0.1.0/examples/boolean_cell_cycle/02/steadystate.csv +2 -0
  26. pymodrev-0.1.0/examples/boolean_cell_cycle/02/steadystate.lp +11 -0
  27. pymodrev-0.1.0/examples/boolean_cell_cycle/03/README +2 -0
  28. pymodrev-0.1.0/examples/boolean_cell_cycle/03/model.bnet +11 -0
  29. pymodrev-0.1.0/examples/boolean_cell_cycle/03/model.lp +115 -0
  30. pymodrev-0.1.0/examples/boolean_cell_cycle/03/model.zginml +0 -0
  31. pymodrev-0.1.0/examples/boolean_cell_cycle/03/output.txt +1 -0
  32. pymodrev-0.1.0/examples/boolean_cell_cycle/03/steadystate.csv +2 -0
  33. pymodrev-0.1.0/examples/boolean_cell_cycle/03/steadystate.lp +11 -0
  34. pymodrev-0.1.0/examples/boolean_cell_cycle/04/README +2 -0
  35. pymodrev-0.1.0/examples/boolean_cell_cycle/04/async.csv +5 -0
  36. pymodrev-0.1.0/examples/boolean_cell_cycle/04/async.lp +44 -0
  37. pymodrev-0.1.0/examples/boolean_cell_cycle/04/model.bnet +11 -0
  38. pymodrev-0.1.0/examples/boolean_cell_cycle/04/model.lp +115 -0
  39. pymodrev-0.1.0/examples/boolean_cell_cycle/04/model.zginml +0 -0
  40. pymodrev-0.1.0/examples/boolean_cell_cycle/04/output.txt +1 -0
  41. pymodrev-0.1.0/examples/boolean_cell_cycle/05/README +2 -0
  42. pymodrev-0.1.0/examples/boolean_cell_cycle/05/async.csv +13 -0
  43. pymodrev-0.1.0/examples/boolean_cell_cycle/05/async.lp +126 -0
  44. pymodrev-0.1.0/examples/boolean_cell_cycle/05/model.bnet +11 -0
  45. pymodrev-0.1.0/examples/boolean_cell_cycle/05/model.lp +115 -0
  46. pymodrev-0.1.0/examples/boolean_cell_cycle/05/model.zginml +0 -0
  47. pymodrev-0.1.0/examples/boolean_cell_cycle/05/output.txt +1 -0
  48. pymodrev-0.1.0/examples/boolean_cell_cycle/06/README +2 -0
  49. pymodrev-0.1.0/examples/boolean_cell_cycle/06/async.csv +7 -0
  50. pymodrev-0.1.0/examples/boolean_cell_cycle/06/async.lp +64 -0
  51. pymodrev-0.1.0/examples/boolean_cell_cycle/06/model.bnet +11 -0
  52. pymodrev-0.1.0/examples/boolean_cell_cycle/06/model.lp +115 -0
  53. pymodrev-0.1.0/examples/boolean_cell_cycle/06/model.zginml +0 -0
  54. pymodrev-0.1.0/examples/boolean_cell_cycle/06/output.txt +1 -0
  55. pymodrev-0.1.0/examples/boolean_cell_cycle/07/README +2 -0
  56. pymodrev-0.1.0/examples/boolean_cell_cycle/07/async.csv +19 -0
  57. pymodrev-0.1.0/examples/boolean_cell_cycle/07/async.lp +186 -0
  58. pymodrev-0.1.0/examples/boolean_cell_cycle/07/model.bnet +11 -0
  59. pymodrev-0.1.0/examples/boolean_cell_cycle/07/model.lp +115 -0
  60. pymodrev-0.1.0/examples/boolean_cell_cycle/07/model.zginml +0 -0
  61. pymodrev-0.1.0/examples/boolean_cell_cycle/07/output.txt +1 -0
  62. pymodrev-0.1.0/examples/boolean_cell_cycle/08/README +2 -0
  63. pymodrev-0.1.0/examples/boolean_cell_cycle/08/model.bnet +11 -0
  64. pymodrev-0.1.0/examples/boolean_cell_cycle/08/model.lp +119 -0
  65. pymodrev-0.1.0/examples/boolean_cell_cycle/08/model.zginml +0 -0
  66. pymodrev-0.1.0/examples/boolean_cell_cycle/08/output.txt +1 -0
  67. pymodrev-0.1.0/examples/boolean_cell_cycle/08/sync.csv +13 -0
  68. pymodrev-0.1.0/examples/boolean_cell_cycle/08/sync.lp +138 -0
  69. pymodrev-0.1.0/examples/boolean_cell_cycle/09/README +2 -0
  70. pymodrev-0.1.0/examples/boolean_cell_cycle/09/model.bnet +11 -0
  71. pymodrev-0.1.0/examples/boolean_cell_cycle/09/model.lp +115 -0
  72. pymodrev-0.1.0/examples/boolean_cell_cycle/09/model.zginml +0 -0
  73. pymodrev-0.1.0/examples/boolean_cell_cycle/09/output.txt +1 -0
  74. pymodrev-0.1.0/examples/boolean_cell_cycle/09/sync.csv +5 -0
  75. pymodrev-0.1.0/examples/boolean_cell_cycle/09/sync.lp +47 -0
  76. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/README +2 -0
  77. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/model.bnet +11 -0
  78. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/model.lp +134 -0
  79. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/model.zginml +0 -0
  80. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/output.txt +1 -0
  81. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/steadystate.csv +13 -0
  82. pymodrev-0.1.0/examples/fissionYeastDavidich2008/00/steadystate.lp +146 -0
  83. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/README +2 -0
  84. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/async.csv +5 -0
  85. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/async.lp +45 -0
  86. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/model.bnet +11 -0
  87. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/model.lp +110 -0
  88. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/model.zginml +0 -0
  89. pymodrev-0.1.0/examples/fissionYeastDavidich2008/01/output.txt +1 -0
  90. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/async.csv +5 -0
  91. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/async.lp +45 -0
  92. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/model.bnet +11 -0
  93. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/model.lp +110 -0
  94. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/model.zginml +0 -0
  95. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/output.txt +1 -0
  96. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/steadystate.csv +3 -0
  97. pymodrev-0.1.0/examples/fissionYeastDavidich2008/02/steadystate.lp +25 -0
  98. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/README +2 -0
  99. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/model.bnet +11 -0
  100. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/model.lp +134 -0
  101. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/model.zginml +0 -0
  102. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/output.txt +1 -0
  103. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_01.csv +2 -0
  104. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_01.lp +11 -0
  105. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_02.csv +2 -0
  106. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_02.lp +11 -0
  107. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_03.csv +2 -0
  108. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_03.lp +11 -0
  109. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_04.csv +2 -0
  110. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_04.lp +11 -0
  111. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_05.csv +2 -0
  112. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_05.lp +11 -0
  113. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_06.csv +2 -0
  114. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_06.lp +11 -0
  115. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_07.csv +2 -0
  116. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_07.lp +11 -0
  117. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_08.csv +2 -0
  118. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_08.lp +11 -0
  119. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_09.csv +2 -0
  120. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_09.lp +11 -0
  121. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_10.csv +2 -0
  122. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_10.lp +11 -0
  123. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_11.csv +2 -0
  124. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_11.lp +11 -0
  125. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_12.csv +2 -0
  126. pymodrev-0.1.0/examples/fissionYeastDavidich2008/03/steadystate_12.lp +11 -0
  127. pymodrev-0.1.0/examples/toy/00/README +3 -0
  128. pymodrev-0.1.0/examples/toy/00/model.bnet +4 -0
  129. pymodrev-0.1.0/examples/toy/00/model.lp +9 -0
  130. pymodrev-0.1.0/examples/toy/00/output.txt +3 -0
  131. pymodrev-0.1.0/examples/toy/00/sync.lp +1 -0
  132. pymodrev-0.1.0/pyproject.toml +49 -0
  133. pymodrev-0.1.0/requirements.txt +4 -0
  134. pymodrev-0.1.0/setup.cfg +4 -0
  135. pymodrev-0.1.0/src/pymodrev/__init__.py +0 -0
  136. pymodrev-0.1.0/src/pymodrev/__main__.py +5 -0
  137. pymodrev-0.1.0/src/pymodrev/asp_rules/async.lp +28 -0
  138. pymodrev-0.1.0/src/pymodrev/asp_rules/base.lp +17 -0
  139. pymodrev-0.1.0/src/pymodrev/asp_rules/complete.lp +15 -0
  140. pymodrev-0.1.0/src/pymodrev/asp_rules/steady_state.lp +30 -0
  141. pymodrev-0.1.0/src/pymodrev/asp_rules/sync.lp +20 -0
  142. pymodrev-0.1.0/src/pymodrev/asp_rules/time_series.lp +33 -0
  143. pymodrev-0.1.0/src/pymodrev/cli.py +171 -0
  144. pymodrev-0.1.0/src/pymodrev/configuration.py +87 -0
  145. pymodrev-0.1.0/src/pymodrev/network/__init__.py +0 -0
  146. pymodrev-0.1.0/src/pymodrev/network/edge.py +70 -0
  147. pymodrev-0.1.0/src/pymodrev/network/exceptions.py +27 -0
  148. pymodrev-0.1.0/src/pymodrev/network/function.py +455 -0
  149. pymodrev-0.1.0/src/pymodrev/network/inconsistency_solution.py +420 -0
  150. pymodrev-0.1.0/src/pymodrev/network/inconsistent_node.py +168 -0
  151. pymodrev-0.1.0/src/pymodrev/network/network.py +182 -0
  152. pymodrev-0.1.0/src/pymodrev/network/node.py +49 -0
  153. pymodrev-0.1.0/src/pymodrev/network/observation.py +31 -0
  154. pymodrev-0.1.0/src/pymodrev/network/repair_set.py +146 -0
  155. pymodrev-0.1.0/src/pymodrev/parsers/__init__.py +0 -0
  156. pymodrev-0.1.0/src/pymodrev/parsers/boolean_expression.py +563 -0
  157. pymodrev-0.1.0/src/pymodrev/parsers/network_parser.py +32 -0
  158. pymodrev-0.1.0/src/pymodrev/parsers/parser_asp.py +236 -0
  159. pymodrev-0.1.0/src/pymodrev/parsers/parser_bnet.py +154 -0
  160. pymodrev-0.1.0/src/pymodrev/parsers/parser_factory.py +31 -0
  161. pymodrev-0.1.0/src/pymodrev/parsers/parser_ginml.py +348 -0
  162. pymodrev-0.1.0/src/pymodrev/repair/__init__.py +1 -0
  163. pymodrev-0.1.0/src/pymodrev/repair/consistency.py +181 -0
  164. pymodrev-0.1.0/src/pymodrev/repair/engine.py +118 -0
  165. pymodrev-0.1.0/src/pymodrev/repair/function_search.py +275 -0
  166. pymodrev-0.1.0/src/pymodrev/repair/repair.py +52 -0
  167. pymodrev-0.1.0/src/pymodrev/repair/topology.py +335 -0
  168. pymodrev-0.1.0/src/pymodrev/updaters/__init__.py +0 -0
  169. pymodrev-0.1.0/src/pymodrev/updaters/async_updater.py +154 -0
  170. pymodrev-0.1.0/src/pymodrev/updaters/complete_updater.py +152 -0
  171. pymodrev-0.1.0/src/pymodrev/updaters/steady_state_updater.py +113 -0
  172. pymodrev-0.1.0/src/pymodrev/updaters/sync_updater.py +140 -0
  173. pymodrev-0.1.0/src/pymodrev/updaters/time_series_updater.py +57 -0
  174. pymodrev-0.1.0/src/pymodrev/updaters/updater.py +173 -0
  175. pymodrev-0.1.0/src/pymodrev.egg-info/PKG-INFO +156 -0
  176. pymodrev-0.1.0/src/pymodrev.egg-info/SOURCES.txt +190 -0
  177. pymodrev-0.1.0/src/pymodrev.egg-info/dependency_links.txt +1 -0
  178. pymodrev-0.1.0/src/pymodrev.egg-info/entry_points.txt +2 -0
  179. pymodrev-0.1.0/src/pymodrev.egg-info/requires.txt +3 -0
  180. pymodrev-0.1.0/src/pymodrev.egg-info/top_level.txt +1 -0
  181. pymodrev-0.1.0/tests/compare_outputs.py +149 -0
  182. pymodrev-0.1.0/tests/conftest.py +43 -0
  183. pymodrev-0.1.0/tests/test_apply_repair.py +327 -0
  184. pymodrev-0.1.0/tests/test_bnet_parser.py +317 -0
  185. pymodrev-0.1.0/tests/test_edge.py +42 -0
  186. pymodrev-0.1.0/tests/test_function.py +98 -0
  187. pymodrev-0.1.0/tests/test_inconsistency_solution.py +36 -0
  188. pymodrev-0.1.0/tests/test_inconsistent_node.py +39 -0
  189. pymodrev-0.1.0/tests/test_model_files.py +170 -0
  190. pymodrev-0.1.0/tests/test_network.py +63 -0
  191. pymodrev-0.1.0/tests/test_node.py +27 -0
  192. pymodrev-0.1.0/tests/test_repair_set.py +57 -0
@@ -0,0 +1,36 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*' # Trigger workflow on tags that start with "v" (e.g., v1.0.0)
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ name: Build and publish to PyPI
11
+ runs-on: ubuntu-latest
12
+
13
+ # Required for trusted publishing to PyPI
14
+ permissions:
15
+ id-token: write
16
+ contents: read
17
+
18
+ steps:
19
+ - name: Checkout Code
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0 # Important for setuptools_scm to get the full git history and tags
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.x"
28
+
29
+ - name: Install build dependencies
30
+ run: python -m pip install --upgrade pip build
31
+
32
+ - name: Build sdist and wheel
33
+ run: python -m build
34
+
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,10 @@
1
+ __pycache__
2
+ .DS_Store
3
+ .vscode
4
+ venv
5
+ build
6
+ ModRev
7
+ pyfunctionhood
8
+ bin
9
+ GINsim-data
10
+ *.egg-info/
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ---
6
+
7
+ ## v1.0 - Feb 2026
8
+
9
+ ### Added
10
+ - Added `.csv` format support as a proposal for observation files.
11
+ - Option to write and export repaired model files under a new unified parser module.
12
+ - Full `model.zginml` support with unified parsing of Boolean expressions.
13
+ - Added `vertex` node support.
14
+ - Fully functioning `asp_reader` with example files and `pytest` integration.
15
+ - Replaced custom shell test scripts (`run_tests.sh`) with native `pytest` testing (`test_model_files.py`).
16
+ - Extensively populated the `examples/` directory for test automation.
17
+ - Introduced a standard logging system, including a specific debug mode for updaters.
18
+ - Support for multiple observation files of the same topology in a single run.
19
+
20
+ ### Changed
21
+ - Readers have been redesigned as polymorphic **Parsers** (`parser_ginml.py`, `parser_bnet.py`, `parser_asp.py`), capable of both `read()` and `write()` operations.
22
+ - The **BNET** parser now evaluates functions comprehensively using Quine-McCluskey logic reduction, dropping degenerate regulators, and assuming monotonicity (defaulting to positive).
23
+ - Repaired `GINsim` networks now retain their original `.ginml` XML layout styling and preserve the inner files of `.zginml` zip archives.
24
+ - Edge signs are explicitly displayed in function repair proposals.
25
+ - Significant refactoring of the repair engine, and simplified dynamic loading of updater classes.
26
+ - Changed configuration class structures, now utilizing elegant pythonic `@property` getters and setters.
27
+ - Migrated all command-line interface arguments to `argparse`.
28
+ - Cleaned up unneeded dependencies such as `asp_helper` and consolidated the code.
29
+
30
+ ### Fixed
31
+ - Fixed node order sorting in multiple `.lp` model test files.
32
+ - Resolved severe syntax errors causing invalid `JSON` outputs.
33
+
34
+ ---
35
+
36
+ ## v0.x - Feb 2025
37
+ - First base stable release with consistency check and repair operations
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymodrev
3
+ Version: 0.1.0
4
+ Summary: Model Revision tool for computing Boolean network repair operations.
5
+ Author-email: "Pedro T. Monteiro" <Pedro.Tiago.Monteiro@tecnico.ulisboa.pt>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ptgm/pymodrev
8
+ Project-URL: Repository, https://github.com/ptgm/pymodrev
9
+ Keywords: boolean,revision,repair,network,function
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
21
+ Classifier: Intended Audience :: Science/Research
22
+ Classifier: Topic :: Scientific/Engineering
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Requires-Python: >=3.7
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: bitarray
27
+ Requires-Dist: pyfunctionhood
28
+ Requires-Dist: clingo
29
+
30
+ ## pymodrev: A python Model Revision tool for Boolean logical models
31
+
32
+ **pymodrev** is a Python-based reimplementation of [ModRev](https://github.com/FilipeGouveia/ModRev), a tool for automated **consistency checking** and **repair** of Boolean network models using **Answer Set Programming (ASP)**. Given a Boolean model and a set of experimental observations (steady-state or time-series), pymodrev determines whether the model explains the data. If inconsistencies are found, it identifies **minimal repair operations** to fix the model.
33
+
34
+ Built on top of the [Clingo](https://potassco.org/clingo/) ASP solver and the [`pyfunctionhood`](https://github.com/ptgm/pyfunctionhood) library, pymodrev brings modern usability and extensibility to the model revision process by offering:
35
+
36
+ * ✅ **Full parity with [ModRev](https://filipegouveia.github.io/ModRev/)'s core logic**, using the same ASP encodings
37
+ * ✅ **Modular architecture** with pluggable update policies (synchronous, asynchronous, complete, steady-state)
38
+ * ✅ **Pure Python interface**, ideal for integration with scientific workflows
39
+ * ✅ **In-memory model and observation management**, enabling multiple consistency checks without reloading
40
+ * ✅ **Command-line interface** for batch processing and reproducibility
41
+
42
+ ---
43
+ ### Install
44
+
45
+ You can install **pymodrev** directly from source or via PyPI.
46
+
47
+ To install from source (when you are inside the pymodrev directory):
48
+ ```bash
49
+ $ pip install .
50
+ ```
51
+
52
+ To install from PyPI:
53
+ ```bash
54
+ $ pip install pymodrev
55
+ ```
56
+
57
+ This will automatically install dependencies like `bitarray`, `pyfunctionhood`, and `clingo`.
58
+
59
+ ---
60
+
61
+ ### Getting Started
62
+
63
+ Boolean models can be specified using the following formats:
64
+
65
+ * `.lp` - using original [ModRev](https://filipegouveia.github.io/ModRev/) ASP encoding
66
+ * `.bnet` - using the BoolNet format (only boolean rules)
67
+ * `.ginml` / `.zginml` - using the widely used GINsim format (conserving the model layout information)
68
+
69
+ To run **pymodrev**, use the following command structure:
70
+
71
+ ```bash
72
+ $ pymodrev -h
73
+ ```
74
+ ```bash
75
+ usage: pymodrev [-h] -m MODEL -obs OBS [UPDATER ...] -t {c,r,m} [--exhaustive-search] [--sub-opt] [--all-opt]
76
+ [-v {0,1,2}] [-d]
77
+
78
+ options:
79
+ -h, --help show this help message and exit
80
+ -m, --model MODEL Input model file.
81
+ -obs, --observations OBS [UPDATER ...]
82
+ List of observation files and updater pairs.
83
+ Each observation must be followed by its updater type.
84
+ Example: -obs obs1.lp asyncupdater obs2.lp syncupdater
85
+ -t, --task {c,r,m} Specify the task to perform (default=r):
86
+ c - check for consistency
87
+ r - get repairs
88
+ m - get repaired models
89
+ --exhaustive-search Force exhaustive search of function repair operations (default=false).
90
+ --sub-opt Show sub-optimal solutions found (default=false).
91
+ --all-opt Computes all optimal solutions (default=true).
92
+ Stops at first optimal solution if false.
93
+ -v, --verbose {0,1,2}
94
+ Specify output verbose level (default=2):
95
+ 0 - compact format
96
+ 1 - json format
97
+ 2 - human-readable format
98
+ -d, --debug Enable debug mode.
99
+ ```
100
+
101
+
102
+ #### Example: check consistency
103
+
104
+ Using option `-t c`, `pymodrev` will report the minimal set of nodes that need to be repaired in order to make the model consistent with the given observations.
105
+
106
+ ```bash
107
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t c
108
+ ```
109
+ ```bash
110
+ This network is inconsistent!
111
+ node(s) needing repair: "p27", "rb", "cdc20", "cycd"
112
+ present in profile(s): "p1"
113
+ ```
114
+
115
+ #### Example: get repairs
116
+
117
+ Using option `-t r`, `pymodrev` will report the minimal set of repair operations for the model to be consistent with the given observations.
118
+
119
+ ```bash
120
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t r
121
+ ```
122
+ ```bash
123
+ ### Found solution with 4 repair operations.
124
+ Inconsistent node p27.
125
+ Repair #1:
126
+ Change function of p27 to: (cyca && !cycb && cycd && !p27) || (!cycb && !cyce)
127
+ Inconsistent node rb.
128
+ Repair #1:
129
+ Change function of rb to: (!cycb && cycd && !p27) || (!cycb && cycd && cyce) || (!cycb && !cyca)
130
+ Inconsistent node cdc20.
131
+ Repair #1:
132
+ Flip sign of edge (cycb,cdc20) to: positive
133
+ Inconsistent node cycd.
134
+ Repair #1:
135
+ Flip sign of edge (cycd,cycd) to: positive
136
+ ```
137
+
138
+ #### Example: get repaired models
139
+
140
+ Using option `-t m`, `pymodrev` will apply the repairs to the model and write to disk the repaired models consistent with the given observations.
141
+
142
+ ```bash
143
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t m
144
+ ```
145
+ Repaired models keep the original name followed by a number, representing the number of minimal alternative repairs.
146
+ For example, one could have:
147
+
148
+ * `model_1.bnet ... model_2.bnet`, if there were only two possible minimal repaired models.
149
+ * `model_01.bnet ... model_18.bnet`, if there were eighteen possible minimal repaired models.
150
+
151
+ ---
152
+
153
+ ### Authors
154
+ * Filipe Gouveia ([https://github.com/FilipeGouveia](https://github.com/FilipeGouveia))
155
+ * Antonio Romeu ([https://github.com/antonioromeu](https://github.com/antonioromeu))
156
+ * Pedro T. Monteiro ([https://github.com/ptgm](https://github.com/ptgm))
@@ -0,0 +1,127 @@
1
+ ## pymodrev: A python Model Revision tool for Boolean logical models
2
+
3
+ **pymodrev** is a Python-based reimplementation of [ModRev](https://github.com/FilipeGouveia/ModRev), a tool for automated **consistency checking** and **repair** of Boolean network models using **Answer Set Programming (ASP)**. Given a Boolean model and a set of experimental observations (steady-state or time-series), pymodrev determines whether the model explains the data. If inconsistencies are found, it identifies **minimal repair operations** to fix the model.
4
+
5
+ Built on top of the [Clingo](https://potassco.org/clingo/) ASP solver and the [`pyfunctionhood`](https://github.com/ptgm/pyfunctionhood) library, pymodrev brings modern usability and extensibility to the model revision process by offering:
6
+
7
+ * ✅ **Full parity with [ModRev](https://filipegouveia.github.io/ModRev/)'s core logic**, using the same ASP encodings
8
+ * ✅ **Modular architecture** with pluggable update policies (synchronous, asynchronous, complete, steady-state)
9
+ * ✅ **Pure Python interface**, ideal for integration with scientific workflows
10
+ * ✅ **In-memory model and observation management**, enabling multiple consistency checks without reloading
11
+ * ✅ **Command-line interface** for batch processing and reproducibility
12
+
13
+ ---
14
+ ### Install
15
+
16
+ You can install **pymodrev** directly from source or via PyPI.
17
+
18
+ To install from source (when you are inside the pymodrev directory):
19
+ ```bash
20
+ $ pip install .
21
+ ```
22
+
23
+ To install from PyPI:
24
+ ```bash
25
+ $ pip install pymodrev
26
+ ```
27
+
28
+ This will automatically install dependencies like `bitarray`, `pyfunctionhood`, and `clingo`.
29
+
30
+ ---
31
+
32
+ ### Getting Started
33
+
34
+ Boolean models can be specified using the following formats:
35
+
36
+ * `.lp` - using original [ModRev](https://filipegouveia.github.io/ModRev/) ASP encoding
37
+ * `.bnet` - using the BoolNet format (only boolean rules)
38
+ * `.ginml` / `.zginml` - using the widely used GINsim format (conserving the model layout information)
39
+
40
+ To run **pymodrev**, use the following command structure:
41
+
42
+ ```bash
43
+ $ pymodrev -h
44
+ ```
45
+ ```bash
46
+ usage: pymodrev [-h] -m MODEL -obs OBS [UPDATER ...] -t {c,r,m} [--exhaustive-search] [--sub-opt] [--all-opt]
47
+ [-v {0,1,2}] [-d]
48
+
49
+ options:
50
+ -h, --help show this help message and exit
51
+ -m, --model MODEL Input model file.
52
+ -obs, --observations OBS [UPDATER ...]
53
+ List of observation files and updater pairs.
54
+ Each observation must be followed by its updater type.
55
+ Example: -obs obs1.lp asyncupdater obs2.lp syncupdater
56
+ -t, --task {c,r,m} Specify the task to perform (default=r):
57
+ c - check for consistency
58
+ r - get repairs
59
+ m - get repaired models
60
+ --exhaustive-search Force exhaustive search of function repair operations (default=false).
61
+ --sub-opt Show sub-optimal solutions found (default=false).
62
+ --all-opt Computes all optimal solutions (default=true).
63
+ Stops at first optimal solution if false.
64
+ -v, --verbose {0,1,2}
65
+ Specify output verbose level (default=2):
66
+ 0 - compact format
67
+ 1 - json format
68
+ 2 - human-readable format
69
+ -d, --debug Enable debug mode.
70
+ ```
71
+
72
+
73
+ #### Example: check consistency
74
+
75
+ Using option `-t c`, `pymodrev` will report the minimal set of nodes that need to be repaired in order to make the model consistent with the given observations.
76
+
77
+ ```bash
78
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t c
79
+ ```
80
+ ```bash
81
+ This network is inconsistent!
82
+ node(s) needing repair: "p27", "rb", "cdc20", "cycd"
83
+ present in profile(s): "p1"
84
+ ```
85
+
86
+ #### Example: get repairs
87
+
88
+ Using option `-t r`, `pymodrev` will report the minimal set of repair operations for the model to be consistent with the given observations.
89
+
90
+ ```bash
91
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t r
92
+ ```
93
+ ```bash
94
+ ### Found solution with 4 repair operations.
95
+ Inconsistent node p27.
96
+ Repair #1:
97
+ Change function of p27 to: (cyca && !cycb && cycd && !p27) || (!cycb && !cyce)
98
+ Inconsistent node rb.
99
+ Repair #1:
100
+ Change function of rb to: (!cycb && cycd && !p27) || (!cycb && cycd && cyce) || (!cycb && !cyca)
101
+ Inconsistent node cdc20.
102
+ Repair #1:
103
+ Flip sign of edge (cycb,cdc20) to: positive
104
+ Inconsistent node cycd.
105
+ Repair #1:
106
+ Flip sign of edge (cycd,cycd) to: positive
107
+ ```
108
+
109
+ #### Example: get repaired models
110
+
111
+ Using option `-t m`, `pymodrev` will apply the repairs to the model and write to disk the repaired models consistent with the given observations.
112
+
113
+ ```bash
114
+ $ pymodrev -m examples/boolean_cell_cycle/03/model.bnet -obs examples/boolean_cell_cycle/03/steadystate.lp steadystateupdater -t m
115
+ ```
116
+ Repaired models keep the original name followed by a number, representing the number of minimal alternative repairs.
117
+ For example, one could have:
118
+
119
+ * `model_1.bnet ... model_2.bnet`, if there were only two possible minimal repaired models.
120
+ * `model_01.bnet ... model_18.bnet`, if there were eighteen possible minimal repaired models.
121
+
122
+ ---
123
+
124
+ ### Authors
125
+ * Filipe Gouveia ([https://github.com/FilipeGouveia](https://github.com/FilipeGouveia))
126
+ * Antonio Romeu ([https://github.com/antonioromeu](https://github.com/antonioromeu))
127
+ * Pedro T. Monteiro ([https://github.com/ptgm](https://github.com/ptgm))
@@ -0,0 +1,2 @@
1
+ boolean_cell_cycle/original/boolean_cell_cycle.lp
2
+ boolean_cell_cycle/original/attractors.lp with obs_vlabel(p1,cycb,0).
@@ -0,0 +1,11 @@
1
+ targets, factors
2
+ cycb, !cdc20 & !cdh1
3
+ cdc20, cycb
4
+ cdh1, !cyca & !cycb | !cycb & p27 | cdc20
5
+ rb, !cycd & !cyce & !cyca & !cycb | !cycd & p27 & !cycb
6
+ cyca, !rb & cyca & !cdc20 & !cdh1 | !rb & cyca & !cdc20 & !ubch10 | !rb & e2f & !cdc20 & !cdh1 | !rb & e2f & !cdc20 & !ubch10
7
+ ubch10, cdc20 & ubch10 | cycb & ubch10 | cyca & ubch10 | !cdh1
8
+ e2f, !rb & !cyca & !cycb | !rb & p27 & !cycb
9
+ cycd, cycd
10
+ cyce, !rb & e2f
11
+ p27, !cycd & !cyce & !cyca & !cycb | !cycd & !cyca & p27 & !cycb | !cycd & !cyce & p27 & !cycb
@@ -0,0 +1,136 @@
1
+ vertex(cyca).
2
+ vertex(rb).
3
+ vertex(cycb).
4
+ vertex(cdc20).
5
+ vertex(cdh1).
6
+ vertex(cycd).
7
+ vertex(cyce).
8
+ vertex(e2f).
9
+ vertex(p27).
10
+ vertex(ubch10).
11
+
12
+ edge(cycb, cdc20, 1).
13
+ edge(cdh1, cdc20, 1).
14
+
15
+ functionOr(cdc20, 1).
16
+ functionAnd(cdc20, 1, cycb).
17
+
18
+ edge(rb, cyca, 0).
19
+ edge(cyca, cyca, 1).
20
+ edge(cdc20, cyca, 0).
21
+ edge(cdh1, cyca, 0).
22
+ edge(ubch10, cyca, 0).
23
+ edge(e2f, cyca, 1).
24
+
25
+ functionOr(cyca, 1..4).
26
+ functionAnd(cyca, 1, rb).
27
+ functionAnd(cyca, 1, cyca).
28
+ functionAnd(cyca, 1, cdc20).
29
+ functionAnd(cyca, 1, cdh1).
30
+ functionAnd(cyca, 2, rb).
31
+ functionAnd(cyca, 2, cyca).
32
+ functionAnd(cyca, 2, cdc20).
33
+ functionAnd(cyca, 2, ubch10).
34
+ functionAnd(cyca, 3, rb).
35
+ functionAnd(cyca, 3, e2f).
36
+ functionAnd(cyca, 3, cdc20).
37
+ functionAnd(cyca, 3, cdh1).
38
+ functionAnd(cyca, 4, rb).
39
+ functionAnd(cyca, 4, e2f).
40
+ functionAnd(cyca, 4, cdc20).
41
+ functionAnd(cyca, 4, ubch10).
42
+
43
+ edge(cdc20, cycb, 0).
44
+ edge(cdh1, cycb, 0).
45
+
46
+ functionOr(cycb, 1).
47
+ functionAnd(cycb, 1, cdc20).
48
+ functionAnd(cycb, 1, cdh1).
49
+
50
+ edge(cycd, cycd, 1).
51
+
52
+ functionOr(cycd, 1).
53
+ functionAnd(cycd, 1, cycd).
54
+
55
+ edge(rb, cyce, 0).
56
+ edge(e2f, cyce, 1).
57
+
58
+ functionOr(cyce, 1).
59
+ functionAnd(cyce, 1, rb).
60
+ functionAnd(cyce, 1, e2f).
61
+
62
+ edge(rb, e2f, 0).
63
+ edge(cyca, e2f, 0).
64
+ edge(cycb, e2f, 0).
65
+ edge(p27, e2f, 1).
66
+
67
+ functionOr(e2f, 1..2).
68
+ functionAnd(e2f, 1, rb).
69
+ functionAnd(e2f, 1, cyca).
70
+ functionAnd(e2f, 1, cycb).
71
+ functionAnd(e2f, 2, rb).
72
+ functionAnd(e2f, 2, p27).
73
+ functionAnd(e2f, 2, cycb).
74
+
75
+ edge(cycd, rb, 0).
76
+ edge(cyce, rb, 0).
77
+ edge(cyca, rb, 0).
78
+ edge(cycb, rb, 0).
79
+ edge(p27, rb, 1).
80
+
81
+ functionOr(rb, 1..2).
82
+ functionAnd(rb, 1, cycd).
83
+ functionAnd(rb, 1, cyce).
84
+ functionAnd(rb, 1, cyca).
85
+ functionAnd(rb, 1, cycb).
86
+ functionAnd(rb, 2, cycd).
87
+ functionAnd(rb, 2, p27).
88
+ functionAnd(rb, 2, cycb).
89
+
90
+ edge(cdc20, ubch10, 1).
91
+ edge(ubch10, ubch10, 1).
92
+ edge(cycb, ubch10, 1).
93
+ edge(cyca, ubch10, 1).
94
+ edge(cdh1, ubch10, 0).
95
+
96
+ functionOr(ubch10, 1..4).
97
+ functionAnd(ubch10, 1, cdc20).
98
+ functionAnd(ubch10, 1, ubch10).
99
+ functionAnd(ubch10, 2, cycb).
100
+ functionAnd(ubch10, 2, ubch10).
101
+ functionAnd(ubch10, 3, cyca).
102
+ functionAnd(ubch10, 3, ubch10).
103
+ functionAnd(ubch10, 4, cdh1).
104
+
105
+ edge(cyca, cdh1, 0).
106
+ edge(cycb, cdh1, 0).
107
+ edge(p27, cdh1, 1).
108
+ edge(cdc20, cdh1, 1).
109
+
110
+ functionOr(cdh1, 1..3).
111
+ functionAnd(cdh1, 1, cyca).
112
+ functionAnd(cdh1, 1, cycb).
113
+ functionAnd(cdh1, 2, cycb).
114
+ functionAnd(cdh1, 2, p27).
115
+ functionAnd(cdh1, 3, cdc20).
116
+
117
+ edge(cycd, p27, 0).
118
+ edge(cyce, p27, 0).
119
+ edge(cyca, p27, 0).
120
+ edge(cycb, p27, 0).
121
+ edge(p27, p27, 1).
122
+
123
+ functionOr(p27, 1..3).
124
+ functionAnd(p27, 1, cycd).
125
+ functionAnd(p27, 1, cyce).
126
+ functionAnd(p27, 1, cyca).
127
+ functionAnd(p27, 1, cycb).
128
+ functionAnd(p27, 2, cycd).
129
+ functionAnd(p27, 2, cyca).
130
+ functionAnd(p27, 2, p27).
131
+ functionAnd(p27, 2, cycb).
132
+ functionAnd(p27, 3, cycd).
133
+ functionAnd(p27, 3, cyce).
134
+ functionAnd(p27, 3, p27).
135
+ functionAnd(p27, 3, cycb).
136
+
@@ -0,0 +1 @@
1
+ Consistent!
@@ -0,0 +1,2 @@
1
+ ,cycb,cyca,cdc20,ubch10,cycd,p27,cyce,rb,cdh1,e2f
2
+ p1,0,0,0,0,0,1,0,1,1,0
@@ -0,0 +1,11 @@
1
+ exp(p1).
2
+ obs_vlabel(p1,cycb,0).
3
+ obs_vlabel(p1,cyca,0).
4
+ obs_vlabel(p1,cdc20,0).
5
+ obs_vlabel(p1,ubch10,0).
6
+ obs_vlabel(p1,cycd,0).
7
+ obs_vlabel(p1,p27,1).
8
+ obs_vlabel(p1,cyce,0).
9
+ obs_vlabel(p1,rb,1).
10
+ obs_vlabel(p1,cdh1,1).
11
+ obs_vlabel(p1,e2f,0).
@@ -0,0 +1,2 @@
1
+ boolean_cell_cycle/original/boolean_cell_cycle.lp
2
+ boolean_cell_cycle/original/attractors.lp with obs_vlabel(p1,cycb,0).
@@ -0,0 +1,11 @@
1
+ targets, factors
2
+ cycb, !cdc20 & !cdh1
3
+ cdc20, cycb
4
+ cdh1, !cyca & !cycb | !cycb & p27 | cdc20
5
+ rb, !cycd & !cyce & !cyca & !cycb | !cycd & p27 & !cycb
6
+ cyca, !rb & cyca & !cdc20 & !cdh1 | !rb & cyca & !cdc20 & !ubch10 | !rb & e2f & !cdc20 & !cdh1 | !rb & e2f & !cdc20 & !ubch10
7
+ ubch10, cdc20 & ubch10 | cycb & ubch10 | cyca & ubch10 | !cdh1
8
+ e2f, !rb & !cyca & !cycb | !rb & p27 & !cycb
9
+ cycd, cycd
10
+ cyce, !rb & e2f
11
+ p27, !cycd & !cyce & !cyca & !cycb | !cycd & !cyca & p27 & !cycb | !cycd & !cyce & p27 & !cycb