From 322f948ce9f387d1c3f8dc0ecf12e46c2f0d1982 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Tue, 10 Dec 2024 16:26:18 -0600 Subject: [PATCH 01/15] refactor: remove troppo and cobamp for CC testing Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 7 ++++++- pyproject.toml | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index 2628eac3..bb7324ee 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -419,7 +419,12 @@ def _build_model( # noqa: C901 force excluded even if they meet GPR association requirements using the force exclude file. """ config = Config() - cobra.Configuration().solver = solver.lower() + + cobra_config = cobra.Configuration() + print(cobra_config.solver) + cobra_config.solver = solver.lower() + print(cobra_config.solver) + reference_model: cobra.Model match general_model_file.suffix: case ".mat": diff --git a/pyproject.toml b/pyproject.toml index 2c6d42c5..f10dc4fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ dependencies = [ "openpyxl>=3.1.5", "aiofiles>=24.1.0", "aioftp>=0.23.1", - "troppo", - "cobamp", +# "troppo", +# "cobamp", ] [build-system] @@ -48,5 +48,5 @@ dev-dependencies = [ ] [tool.uv.sources] -troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } -cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } +#troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } +#cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } From 6cc2a7b1f6e89d160b019f41ed1e5340cefc5b78 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 09:10:29 -0600 Subject: [PATCH 02/15] chore: bump version --- main/como/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/como/__init__.py b/main/como/__init__.py index 05100d09..f92ebf4b 100644 --- a/main/como/__init__.py +++ b/main/como/__init__.py @@ -4,7 +4,7 @@ from como.utils import stringlist_to_list __all__ = ["stringlist_to_list", "Config"] -__version__ = "1.10.0" +__version__ = "1.11.0" def return_placeholder_data() -> pd.DataFrame: From 3e495f6e6edd137e56dbd44640a3e22e15ad3b62 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 09:12:28 -0600 Subject: [PATCH 03/15] revert: require troppo and cobamp This requires troppo and cobamp but does not yet set their version Signed-off-by: Josh Loecker --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f10dc4fe..67cb76f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ dependencies = [ "openpyxl>=3.1.5", "aiofiles>=24.1.0", "aioftp>=0.23.1", -# "troppo", -# "cobamp", + "troppo", + "cobamp", ] [build-system] @@ -47,6 +47,6 @@ dev-dependencies = [ "pytest-cov>=6.0.0", ] -[tool.uv.sources] +#[tool.uv.sources] #troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } #cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } From 74d55c9e52dc261ebc13091c0f2517d97dc0ad45 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 11:57:55 -0600 Subject: [PATCH 04/15] revert: install troppo and cobamp from modified repo Signed-off-by: Josh Loecker --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 67cb76f6..2c6d42c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,6 @@ dev-dependencies = [ "pytest-cov>=6.0.0", ] -#[tool.uv.sources] -#troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } -#cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } +[tool.uv.sources] +troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } +cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } From b2a6e0f21e38e6aa86233bdf54beb84eb85fafee Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 11:58:22 -0600 Subject: [PATCH 05/15] feat: set troppo solver This also sets the downstream sovler in cobamp Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index bb7324ee..970f82da 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -308,9 +308,16 @@ def _build_with_imat( expr_vector: npt.NDArray, expr_thesh: tuple[float, float], force_gene_ids: Sequence[int], + solver: str, ) -> (cobra.Model, pd.DataFrame): expr_vector = np.array(expr_vector) - properties = IMATProperties(exp_vector=expr_vector, exp_thresholds=expr_thesh, core=force_gene_ids, epsilon=0.01) + properties = IMATProperties( + exp_vector=expr_vector, + exp_thresholds=expr_thesh, + core=force_gene_ids, + epsilon=0.01, + solver=solver, + ) algorithm = IMAT(s_matrix, np.array(lb), np.array(ub), properties) context_rxns: npt.NDArray = algorithm.run() fluxes: pd.Series = algorithm.sol.to_series() From baca9e769d4113c10928f91144ffcdc57ddee606 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 12:02:15 -0600 Subject: [PATCH 06/15] fix: provide solver to imat build function Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index 970f82da..9abf0d3f 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -520,7 +520,14 @@ def _build_model( # noqa: C901 elif recon_algorithm == Algorithm.IMAT: context_model_cobra: cobra.Model context_model_cobra, flux_df = _build_with_imat( - reference_model, s_matrix, lb, ub, expr_vector, exp_thresh, idx_force + reference_model, + s_matrix, + lb, + ub, + expr_vector, + exp_thresh, + idx_force, + solver=solver, ) imat_reactions = flux_df.rxn model_reactions = [reaction.id for reaction in context_model_cobra.reactions] From bb2611c5c85a7c597e4de15ea02f3eebfea6cd86 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 12:05:34 -0600 Subject: [PATCH 07/15] fix: temporarily install troppo from develop Signed-off-by: Josh Loecker --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2c6d42c5..465173e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,5 +48,5 @@ dev-dependencies = [ ] [tool.uv.sources] -troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "update_dependencies" } +troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "feat/allow-setting-solver" } cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } From cced1b6f34f9f2c862a4e23dc9c7549412f00687 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 12:11:26 -0600 Subject: [PATCH 08/15] fix: install from branch Signed-off-by: Josh Loecker --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 465173e6..b1c10adf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,5 +48,5 @@ dev-dependencies = [ ] [tool.uv.sources] -troppo = { git = "https://github.com/JoshLoecker/troppo", rev = "feat/allow-setting-solver" } -cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" } +troppo = { git = "https://github.com/JoshLoecker/troppo", branch = "feat/allow-setting-solver" } +cobamp = { git = "https://github.com/JoshLoecker/cobamp", branch = "update_packages" } From 2e64db496d6ae46c6aa613d2bd0d79fc37b09938 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 12:16:16 -0600 Subject: [PATCH 09/15] refactor: install troppo/cobamp from github Signed-off-by: Josh Loecker --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b1c10adf..e4535908 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ dependencies = [ "openpyxl>=3.1.5", "aiofiles>=24.1.0", "aioftp>=0.23.1", - "troppo", - "cobamp", + "git+https://github.com/JoshLoecker/troppo@feat/allow-setting-solver", + "git+https://github.com/JoshLoecker/cobamp@update_packages", ] [build-system] @@ -47,6 +47,6 @@ dev-dependencies = [ "pytest-cov>=6.0.0", ] -[tool.uv.sources] -troppo = { git = "https://github.com/JoshLoecker/troppo", branch = "feat/allow-setting-solver" } -cobamp = { git = "https://github.com/JoshLoecker/cobamp", branch = "update_packages" } +#[tool.uv.sources] +#troppo = { git = "https://github.com/JoshLoecker/troppo", branch = "feat/allow-setting-solver" } +#cobamp = { git = "https://github.com/JoshLoecker/cobamp", branch = "update_packages" } From 1c6743b2c7b67c49141cf01593151915a124e3eb Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 13:03:48 -0600 Subject: [PATCH 10/15] fix: use proper installation for troppo/cobamp Signed-off-by: Josh Loecker --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e4535908..58bc6129 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ dependencies = [ "openpyxl>=3.1.5", "aiofiles>=24.1.0", "aioftp>=0.23.1", - "git+https://github.com/JoshLoecker/troppo@feat/allow-setting-solver", - "git+https://github.com/JoshLoecker/cobamp@update_packages", + "troppo@git+https://github.com/JoshLoecker/troppo@feat/allow-setting-solver", + "cobamp@git+https://github.com/JoshLoecker/cobamp@update_packages", ] [build-system] From 0a0ac4d51127398dbd8c6326becbce1d9ad1620d Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 13:04:54 -0600 Subject: [PATCH 11/15] fix: use correct branch for cobamp Signed-off-by: Josh Loecker --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 58bc6129..2dd7d11c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "aiofiles>=24.1.0", "aioftp>=0.23.1", "troppo@git+https://github.com/JoshLoecker/troppo@feat/allow-setting-solver", - "cobamp@git+https://github.com/JoshLoecker/cobamp@update_packages", + "cobamp@git+https://github.com/JoshLoecker/cobamp@master", ] [build-system] From 091f4bc6a02e7424cf85c38620848d503a3d34d9 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 13:56:51 -0600 Subject: [PATCH 12/15] chore: reset troppo branch Signed-off-by: Josh Loecker --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2dd7d11c..2f4fdb2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ dependencies = [ "openpyxl>=3.1.5", "aiofiles>=24.1.0", "aioftp>=0.23.1", - "troppo@git+https://github.com/JoshLoecker/troppo@feat/allow-setting-solver", + "troppo@git+https://github.com/JoshLoecker/troppo@master", "cobamp@git+https://github.com/JoshLoecker/cobamp@master", ] @@ -46,7 +46,3 @@ dev-dependencies = [ "hypothesis>=6.122.1", "pytest-cov>=6.0.0", ] - -#[tool.uv.sources] -#troppo = { git = "https://github.com/JoshLoecker/troppo", branch = "feat/allow-setting-solver" } -#cobamp = { git = "https://github.com/JoshLoecker/cobamp", branch = "update_packages" } From 5417157ef5fa4fd846c658ead7e8467cfb9e15f7 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 13:59:52 -0600 Subject: [PATCH 13/15] fix: solver must be uppercase Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index 9abf0d3f..fc6ce6be 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -316,7 +316,7 @@ def _build_with_imat( exp_thresholds=expr_thesh, core=force_gene_ids, epsilon=0.01, - solver=solver, + solver=solver.upper(), ) algorithm = IMAT(s_matrix, np.array(lb), np.array(ub), properties) context_rxns: npt.NDArray = algorithm.run() From 157f2e513ce682b4c79c126e52d735d2baf0553d Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 14:04:30 -0600 Subject: [PATCH 14/15] chore: remove print Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index fc6ce6be..3d280d4e 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -316,7 +316,8 @@ def _build_with_imat( exp_thresholds=expr_thesh, core=force_gene_ids, epsilon=0.01, - solver=solver.upper(), + solver=solver.upper()z + , ) algorithm = IMAT(s_matrix, np.array(lb), np.array(ub), properties) context_rxns: npt.NDArray = algorithm.run() @@ -426,12 +427,6 @@ def _build_model( # noqa: C901 force excluded even if they meet GPR association requirements using the force exclude file. """ config = Config() - - cobra_config = cobra.Configuration() - print(cobra_config.solver) - cobra_config.solver = solver.lower() - print(cobra_config.solver) - reference_model: cobra.Model match general_model_file.suffix: case ".mat": From 4fa324c5208501cf765830372d2d39aca2c700c5 Mon Sep 17 00:00:00 2001 From: Josh Loecker Date: Wed, 11 Dec 2024 14:09:36 -0600 Subject: [PATCH 15/15] chore: fix typo Signed-off-by: Josh Loecker --- main/como/create_context_specific_model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/como/create_context_specific_model.py b/main/como/create_context_specific_model.py index 3d280d4e..f6ac8b91 100644 --- a/main/como/create_context_specific_model.py +++ b/main/como/create_context_specific_model.py @@ -316,8 +316,7 @@ def _build_with_imat( exp_thresholds=expr_thesh, core=force_gene_ids, epsilon=0.01, - solver=solver.upper()z - , + solver=solver.upper(), ) algorithm = IMAT(s_matrix, np.array(lb), np.array(ub), properties) context_rxns: npt.NDArray = algorithm.run()