cobrak 0.0.1__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 (50) hide show
  1. cobrak-0.0.1/LICENSE +201 -0
  2. cobrak-0.0.1/PKG-INFO +283 -0
  3. cobrak-0.0.1/README.md +255 -0
  4. cobrak-0.0.1/cobrak/__init__.py +100 -0
  5. cobrak-0.0.1/cobrak/_efms.py +189 -0
  6. cobrak-0.0.1/cobrak/bigg_metabolites_functionality.py +76 -0
  7. cobrak-0.0.1/cobrak/brenda_functionality.py +833 -0
  8. cobrak-0.0.1/cobrak/cobrapy_model_functionality.py +153 -0
  9. cobrak-0.0.1/cobrak/constants.py +162 -0
  10. cobrak-0.0.1/cobrak/dataclasses.py +319 -0
  11. cobrak-0.0.1/cobrak/equilibrator_functionality.py +249 -0
  12. cobrak-0.0.1/cobrak/evolution.py +996 -0
  13. cobrak-0.0.1/cobrak/example_models.py +171 -0
  14. cobrak-0.0.1/cobrak/expasy_functionality.py +30 -0
  15. cobrak-0.0.1/cobrak/genetic.py +216 -0
  16. cobrak-0.0.1/cobrak/io.py +1002 -0
  17. cobrak-0.0.1/cobrak/lps.py +1857 -0
  18. cobrak-0.0.1/cobrak/model_instantiation.py +574 -0
  19. cobrak-0.0.1/cobrak/ncbi_taxonomy_functionality.py +202 -0
  20. cobrak-0.0.1/cobrak/nlps.py +1090 -0
  21. cobrak-0.0.1/cobrak/plotting.py +814 -0
  22. cobrak-0.0.1/cobrak/printing.py +799 -0
  23. cobrak-0.0.1/cobrak/pso_parallel.py +262 -0
  24. cobrak-0.0.1/cobrak/pyomo_functionality.py +274 -0
  25. cobrak-0.0.1/cobrak/sabio_rk_functionality.py +779 -0
  26. cobrak-0.0.1/cobrak/spreadsheet_functionality.py +1363 -0
  27. cobrak-0.0.1/cobrak/standard_solvers.py +104 -0
  28. cobrak-0.0.1/cobrak/tellurium_functionality.py +299 -0
  29. cobrak-0.0.1/cobrak/uniprot_functionality.py +150 -0
  30. cobrak-0.0.1/cobrak/utilities.py +2284 -0
  31. cobrak-0.0.1/cobrak.egg-info/PKG-INFO +283 -0
  32. cobrak-0.0.1/cobrak.egg-info/SOURCES.txt +48 -0
  33. cobrak-0.0.1/cobrak.egg-info/dependency_links.txt +1 -0
  34. cobrak-0.0.1/cobrak.egg-info/requires.txt +13 -0
  35. cobrak-0.0.1/cobrak.egg-info/top_level.txt +1 -0
  36. cobrak-0.0.1/pyproject.toml +75 -0
  37. cobrak-0.0.1/setup.cfg +4 -0
  38. cobrak-0.0.1/setup.py +17 -0
  39. cobrak-0.0.1/tests/test_bigg_metabolites_functionality.py +11 -0
  40. cobrak-0.0.1/tests/test_brenda_functionality.py +20 -0
  41. cobrak-0.0.1/tests/test_cobrapy_model_functionality.py +15 -0
  42. cobrak-0.0.1/tests/test_constants.py +8 -0
  43. cobrak-0.0.1/tests/test_dataclasses.py +41 -0
  44. cobrak-0.0.1/tests/test_io.py +215 -0
  45. cobrak-0.0.1/tests/test_ncbi_taxonomy_functionality.py +30 -0
  46. cobrak-0.0.1/tests/test_pyomo_functionality.py +49 -0
  47. cobrak-0.0.1/tests/test_tellurium_functionality.py +100 -0
  48. cobrak-0.0.1/tests/test_toymodel.py +0 -0
  49. cobrak-0.0.1/tests/test_uniprot_functionality.py +126 -0
  50. cobrak-0.0.1/tests/test_utilities.py +383 -0
cobrak-0.0.1/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
cobrak-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: cobrak
3
+ Version: 0.0.1
4
+ Summary: Implementation of COBRA-k
5
+ Author: Pavlos Stephanos Bekiaris
6
+ Project-URL: Homepage, https://github.com/klamt-lab/cobrak
7
+ Project-URL: Issues, https://github.com/klamt-lab/cobrak/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: ==3.10.*
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: dataclasses-json
15
+ Requires-Dist: matplotlib
16
+ Requires-Dist: numpy
17
+ Requires-Dist: openpyxl
18
+ Requires-Dist: pyomo
19
+ Requires-Dist: requests
20
+ Requires-Dist: pyscipopt
21
+ Requires-Dist: cobra
22
+ Requires-Dist: equilibrator_api
23
+ Requires-Dist: tellurium
24
+ Requires-Dist: joblib
25
+ Requires-Dist: rich
26
+ Requires-Dist: pydantic
27
+ Dynamic: license-file
28
+
29
+ # COBRA-k Package
30
+
31
+ <table style="border: none; border-collapse: collapse;">
32
+ <tr>
33
+ <td>
34
+ <div style="background-color: #2E4053; padding: 4px 8px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
35
+ <a style="color: #FFFFFF; text-decoration: none; font-weight: bold;" href="XXXXX">
36
+ pip &#124; version preAlpha
37
+ </a>
38
+ </div>
39
+ </td>
40
+ <td>
41
+ <div style="background-color: #964B00; padding: 4px 8px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
42
+ <a style="color: #FFFFFF; text-decoration: none; font-weight: bold;" href="XXXXX">
43
+ Documentation
44
+ </a>
45
+ </div>
46
+ </td>
47
+ <td>
48
+ <div style="background-color: #3E8E41; padding: 4px 8px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
49
+ <a style="color: #FFFFFF; text-decoration: none; font-weight: bold;" href="XXXXX">
50
+ GitHub issues
51
+ </a>
52
+ </div>
53
+ </td>
54
+ <td>
55
+ <div style="background-color: #666666; padding: 4px 8px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
56
+ <a style="color: #FFFFFF; text-decoration: none; font-weight: bold;" href="XXXXX">
57
+ Contact
58
+ </a>
59
+ </div>
60
+ </td>
61
+ <td>
62
+ <div style="background-color: #444444; padding: 4px 8px; border-radius: 4px; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
63
+ <a style="color: #FFFFFF; text-decoration: none; font-weight: bold;" href="XXXXX">
64
+ Publication
65
+ </a>
66
+ </div>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+
71
+ <details>
72
+ <summary>Index</summary>
73
+
74
+ * [Introduction](#introduction)
75
+ * [Installation](#installation)
76
+ * [Documentation](#documentation)
77
+ * [Troubleshooting and contact](#troubleshooting-and-contact)
78
+ * [Contributing](#contributing)
79
+ * [License](#license)
80
+ </details>
81
+
82
+ ## Graphical Abstract
83
+
84
+ <img src="docs/img/COBRAk_figure.png" alt="Graphical COBRA-k abstract" style="max-height:450px;">
85
+
86
+ ## Introduction
87
+
88
+ COBRA-k stands for "Constraint-Based Reconstruction and Analysis (COBRA) **with kinetics**" [[Paper]](#publication), a generalized variant of the metabolic modeling framework known as COBRA. Both frameworks allow one to analyze constraint-based metabolic models with the help of optimization approaches. While COBRA uses exclusively linear constraints to describe steady state flux distributions in a given metabolic network, COBRA-k expands COBRA by allowing also the integration of non-linear kinetic rate laws (herein we use reversible Michaelis-Menten kinetics. In particular, this enables also a consistent integration of (steady state) fluxes, metabolite concentration and enzyme abundances in COBRA models. While classical COBRA model are usually formulated as linear or mixed-integer linear program (LP / MILP), COBRA-k requires solving mixed-integer **non-liner** programs (MINLP).
89
+
90
+ The COBRA-k package is a general COBRA/COBRA-k suite written as a Python module, while also being the reference implementation of COBRA-k. Some of COBRA-k's major features are:
91
+
92
+ 1. "Classical" COBRA methods such as:
93
+ * Flux Balance Analysis (FBA) [[Review]](https://doi.org/10.1038/nbt.1614)
94
+ * Parsimonious Flux Balance Analysis (pFBA) [[Paper]](https://doi.org/10.1038/msb.2010.47)
95
+ * Flux Variability Analysis (FVA) [[Paper]](https://doi.org/10.1016/j.ymben.2003.09.002) (written, as all other provided variability analyses, in a multi-core-parallelized way)
96
+
97
+ These standard methods can also optionally be treated in combination with general enzyme constraints *and/or* thermodynamic constraints, enabling methods such as:
98
+
99
+ * Enzyme-constrained FBA based on MOMENT [[Paper]](https://doi.org/10.1371/journal.pcbi.1002575), GECKO [[Paper]](https://doi.org/10.15252/msb.20167411) or sMOMENT [[Paper]](https://doi.org/10.1186/s12859-019-3329-9)
100
+ * Thermodynamic Flux Balance Analysis (TFBA) [[Paper]](https://doi.org/10.1529/biophysj.106.093138)
101
+ * OptMDFpathway [[Paper]](https://doi.org/10.1371/journal.pcbi.1006492)
102
+ * Concentration Variability Analysis (CVA) [[Paper]](https://doi.org/10.1371/journal.pcbi.1009093)
103
+ * ...and more!
104
+
105
+ You may also freely choose your constraints and objectives, allowing you to construct new COBRA methods.
106
+
107
+
108
+ 2. COBRA-k methods operating on extended COBRA models with *reversible Michaelis-Menten kinetics* [[Paper]](https://www.sciencedirect.com/science/article/pii/S0014579313005577):
109
+
110
+ * Our developed COBRA-k solver (combining a genetic algorithm with enzyme-constrained FBA + non-linear optimization) to solve also larger COBRA-k problems.
111
+ * A MINLP formulation that can be used in combination with global MINLP solvers (works only with small models).
112
+
113
+ Again, you can freely choose whether you want to enable enzymatic *and/or* thermodynamic constraints, even on the reaction level.
114
+
115
+ 3. Automatic thermodynamic and/or enzyme-kinetic data retrieval for your model:
116
+
117
+ * $k_{cat}$ (turnover numbers) and $K_M$ (Michaelis constants) using the databases SABIO-RK [[Website]](http://sabio.h-its.org/) and BRENDA [[Website]](https://www.brenda-enzymes.org/) as well as taxonomic information from NCBI TAXONOMY [[Website]](https://www.ncbi.nlm.nih.gov/taxonomy); this retrieval algorithm is similar to the one used by AutoPACMEN [[GitHub]](https://github.com/klamt-lab/autopacmen)
118
+ * $Δ_rG'°$ (standard reaction-based Gibb's free energies) using the fantastic eQuilibrator-API [[GitLab]](https://gitlab.com/equilibrator/equilibrator-api)
119
+ * $W_i$ (molecular weights of enzymes) using Uniprot [[Website]](https://www.uniprot.org/)
120
+ * Of course, you can also manually change or set any parameters at your will
121
+
122
+ 4. Pretty-printing and exporting results:
123
+
124
+ * With the help of rich [[GitHub]](https://github.com/Textualize/rich), COBRA-k allows one to display colored tables of any COBRA(k) analysis results, as well as models themselves.
125
+ * As storage options, results can be saved and loaded as JSON text files, and also exported as XLSX spreadsheets.
126
+ * Results can also be directly exported as CNApy [[GitHub]](https://github.com/cnapy-org/CNApy) scenarios, making it possible to visualize them on *interactive* metabolic maps.
127
+
128
+ 5. Interoperable loading, editing and saving of metabolic models:
129
+
130
+ * Metabolic models and their components (reactions, metabolites, enzymes and related parameters) can be freely constructed, changed and/or augmented using COBRA-k.
131
+ * Models can be imported and exported in the widely used SBML format [[Site]](https://sbml.org/) with the help of COBRApy [[GitHub]](https://github.com/opencobra/cobrapy). Thereby, COBRA-k can store and reload any additional kinetic and/or thermodynamic information in SBML annotations. The SBML format is also used by other popular constraint-based packages for various programming languages.
132
+ * Additionally, models, model components and results can be quickly saved and loaded in COBRA-k's custom JSON format.
133
+ * Also, models with an associated COBRA-k solution can be directly exported as kinetic models in the Antimony and/or SBML format, making it possible to use them with popular kinetic systems biology packages such as Tellurium [[GitHub]](https://github.com/sys-bio/tellurium) and COPASI [[GitHub]](https://github.com/copasi/COPASI).
134
+
135
+ Programmatically, COBRA-k relies on the optimization framework pyomo [[GitHub]](https://github.com/Pyomo/pyomo), making it compatible with any solver supported by it (see [here in pyomo's documentation](https://pyomo.readthedocs.io/en/6.8.0/solving_pyomo_models.html#supported-solvers) for more). For the conversion of COBRA-k models into kinetic models, Tellurium [[GitHub]](https://github.com/sys-bio/tellurium) is used.
136
+ <br>
137
+
138
+ ## Installation
139
+
140
+ Note: The pip command doesn't work yet, please follow the "Python code environment instructions" below
141
+
142
+ COBRA-k will be provided as a PyPI package (follows) and can be simply installed through the following command:
143
+
144
+ ```sh
145
+ pip install cobrak
146
+ ```
147
+
148
+ After the installation, which should just take a few minutes, the package can be imported as ```cobrak```.
149
+
150
+ Note that COBRA-k requires Python≥3.10, making it work on Python-3.10-compatible OS such as Windows, MacOS and Linux.
151
+
152
+ Also note that only the open-source solvers SCIP and IPOPT are pre-installed. For more on how to install commercial solvers, visit the respective documentation page:
153
+
154
+ *(follows, in the emantime, look up the installation.md file in the ./docs subfolder)*
155
+
156
+ COBRA-k is mainly tested on Ubuntu 20.04 on an x86-64 computer and on a MacBook with an ARM processor.
157
+
158
+ <br>
159
+
160
+ ## Documentation
161
+
162
+ An introduction to using COBRA-k, including a tutorial with integrated quickstart sections, is provided through its documentation:
163
+
164
+ *(follows, in the emantime, look up the .md files in the ./docs subfolder)*
165
+
166
+ Also, you may check out COBRA-k's standard examples, provided in the "examples" subfolder of this repository. They also contain all the files to reproduce the results of COBRA-k's publication, as also further explained in the respective chapter in COBRA-k's documentation.
167
+
168
+ <br>
169
+
170
+ ## Troubleshooting and Contact
171
+
172
+ If you encounter any issues with COBRA-k, don't hesitate to open a GitHub issue here:
173
+
174
+ [https://github.com/klamt-lab/COBRA-k/issues](https://github.com/klamt-lab/COBRA-k/issues)
175
+
176
+ Or write an e-mail, which is provided on the COBRA-k package's main maintainer [employer page profile](https://www.mpi-magdeburg.mpg.de/person/98416).
177
+
178
+ <br>
179
+
180
+ ## Contributing to COBRA-k
181
+
182
+ You're welcome to contribute to COBRA-k :-), feel free to open pull requests. Keep in mind that you have to be ok with COBRA-k's open-source license (see next paragraph).
183
+
184
+ ### Code structure
185
+
186
+ * Main folder: The PyPI descriptions and environment settings can be found in the main folder's "pyproject.toml" and "setup.py". The "mkdocs.yml" contains COBRA-k's documentation index and module settings.
187
+ * Subfolder "cobrak": Here, you can find all COBRA-k package Python functionalities
188
+ * Subfolder "docs": Contains the mkdocs Markdown text for COBRA-k's documentation
189
+ * Subfolder "examples": Contains all main COBRA-k examples, as mentioned in COBRA-k's publication; "examples/common_needed_external_resources" contains files that are used by multiple examples, and are created by the .py files in "examples" itself. For a short demo that usually takes only up to a minute, run and look at "examples/toymodel/run_toymodel_calculations.py".
190
+ * Subfolder "tests": Contains pytest tests for many COBRA-k functions; also imports the toymodel generation and analyses as test in "tests/test_toymodel.py"
191
+
192
+
193
+ ### Python code environment
194
+
195
+ In any code contribution, Python's mypy typing capabilities should be used [(see this mypy cheat sheet)](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html). Also, ruff [[GitHub]](https://github.com/astral-sh/ruff) format is used for code formatting, together with the ruff linter import sorter. As testing framework for testable functions, pytest is used.
196
+
197
+ To set up a development environment, you may e.g. use uv [[GitHub]](https://github.com/astral-sh/uv) as follows:
198
+
199
+ 1. Make sure you've installed uv and ruff:
200
+
201
+ ```
202
+ pip install uv
203
+ uv pip install ruff
204
+ ```
205
+
206
+ 2. Checkout the latest COBRA-k development version using git
207
+
208
+ ```
209
+ git clone https://github.com/klamt-lan/COBRA-k.git
210
+ ```
211
+
212
+ 3. (optional) Run the toy model example
213
+
214
+ ```
215
+ cd COBRA-k
216
+ uv run examples/toymodel/run_toymodel_calculations.py
217
+ ```
218
+
219
+ uv will automatically install a correct Python version ≥ 3.10 and COBRA-k dependencies.
220
+
221
+ 4. After code changes: Apply ruff
222
+
223
+ To maintain a consistent style, please apply ruff on you code before you create a pull request as follows (you may run these commands in COBRA-k's main folder):
224
+
225
+ ```
226
+ ruff check --select I --fix
227
+ ruff format
228
+ ruff check
229
+ # All three commands can also be found in this reposiroty's format_code.sh
230
+ ```
231
+
232
+ The first command sorts imports, the second one fixes code formatting. The third command tells you remaining issues that you have to change manually. If you want to deviate from ruff's rules, you can e.g. use a ```# noqa: $RULE_NAME``` command at the end of each affected line. This will make ruff ignore the found issue.
233
+
234
+ 5. After code changes: Test with pytest
235
+
236
+ If applicable, you are invited to write new or changed tests in COBRA-k's code. Tests are located in the "tests" subfolder and use pytest [[GitHub]](https://github.com/pytest-dev/pytest) which you may install as follows:
237
+
238
+ ```
239
+ uv pip install pytest
240
+ ```
241
+
242
+ You can then run the tests in the "test" subfolder as follows:
243
+
244
+ ```
245
+ pytest tests
246
+ ```
247
+
248
+ Please make sure that your code changes do not unintendently break any tests.
249
+
250
+ ### Documentation development
251
+
252
+ To work on COBRA-k's documentation, you need mkdocs [[GitHub]](https://www.mkdocs.org/) and some dependencies. To install them, you may run the following commands using uv:
253
+
254
+ ```
255
+ uv pip install mkdocs
256
+ uv pip install mkdocs-material
257
+ uv pip install pymdown-extensions
258
+ uv pip install mkdocstrings[python]
259
+ ```
260
+
261
+ To now self-run the documentation on a local server, you can use mkdocs itself with the following command in COBRA-k's main folder:
262
+
263
+ ```
264
+ mkdocs serve
265
+ ```
266
+
267
+ <br>
268
+
269
+ ## License
270
+
271
+ COBRA-k is free and open-source and licensed under the Apache License, Version 2.0
272
+
273
+ Note that COBRA-k's documentation integrated the open-source JavaScript packages KaTeX [[Link to its open-source license]](docs/javascript/katex/LICENSE.txt), iframe-worker [[Link to its open-source license]](docs/javascript/.cache/assets/external/unpkg.com/iframe-worker/LICENSE.txt) and mermaid [[Link to its open-source license]](docs/javascript/.cache/assets/external/unpkg.com/mermaid@11/LICENSE.txt).
274
+
275
+ Some of COBRA-k's code is also adapted and modified from AutoPACMEN [[GitHub]](https://github.com/klamt-lab/autopacmen) and TCOSA [[GitHub]](https://github.com/klamt-lab/TCOSA). For both repositories, their main author is the same as the one of COBRA-k and both packages use the same license type as COBRA-k.
276
+
277
+ <br>
278
+
279
+ ## Publication
280
+
281
+ If you use COBRA-k in your academic work, please cite its publication:
282
+
283
+ * Bekiaris PS & Klamt S (2025). COBRA-k: a powerful framework bridging constraint-based and kinetic metabolic modeling. *Submitted*.