Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b0e4801
chore(deps): bump astral-sh/setup-uv from 3 to 4
dependabot[bot] Dec 10, 2024
db6e683
chore(deps): bump astral-sh/ruff-action from 1 to 2
dependabot[bot] Dec 10, 2024
dd3eb0d
fix: set solver using cobra configuration
JoshLoecker Dec 10, 2024
e8d3fd5
fix: set cobra solver earlier
JoshLoecker Dec 10, 2024
322f948
refactor: remove troppo and cobamp for CC testing
JoshLoecker Dec 10, 2024
6cc2a7b
chore: bump version
JoshLoecker Dec 11, 2024
4a33180
chore: bump version
JoshLoecker Dec 11, 2024
3e495f6
revert: require troppo and cobamp
JoshLoecker Dec 11, 2024
74d55c9
revert: install troppo and cobamp from modified repo
JoshLoecker Dec 11, 2024
b2a6e0f
feat: set troppo solver
JoshLoecker Dec 11, 2024
baca9e7
fix: provide solver to imat build function
JoshLoecker Dec 11, 2024
bb2611c
fix: temporarily install troppo from develop
JoshLoecker Dec 11, 2024
cced1b6
fix: install from branch
JoshLoecker Dec 11, 2024
2e64db4
refactor: install troppo/cobamp from github
JoshLoecker Dec 11, 2024
1c6743b
fix: use proper installation for troppo/cobamp
JoshLoecker Dec 11, 2024
0a0ac4d
fix: use correct branch for cobamp
JoshLoecker Dec 11, 2024
091f4bc
chore: reset troppo branch
JoshLoecker Dec 11, 2024
5417157
fix: solver must be uppercase
JoshLoecker Dec 11, 2024
157f2e5
chore: remove print
JoshLoecker Dec 11, 2024
4fa324c
chore: fix typo
JoshLoecker Dec 11, 2024
93c263e
Merge pull request #202 from HelikarLab/fix/troppo-cobamp-requirement
JoshLoecker Dec 11, 2024
97137d2
Merge pull request #201 from HelikarLab/dependabot/github_actions/ast…
JoshLoecker Dec 11, 2024
6a544f1
Merge pull request #200 from HelikarLab/dependabot/github_actions/ast…
JoshLoecker Dec 11, 2024
6c08b7b
chore: bump version
JoshLoecker Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4

- name: Create Virtual Environment
run: uv venv
Expand All @@ -26,17 +26,17 @@ jobs:
run: uv run jupyter nbconvert --clear-output --inplace "main/COMO.ipynb"

- name: Format Python Imports
uses: astral-sh/ruff-action@v1
uses: astral-sh/ruff-action@v2
with:
args: "check --fix --select I"

- name: Format code
uses: astral-sh/ruff-action@v1
uses: astral-sh/ruff-action@v2
with:
args: "format"

- name: Format Notebook
uses: astral-sh/ruff-action@v1
uses: astral-sh/ruff-action@v2
with:
args: "format main/COMO.ipynb"

Expand All @@ -54,7 +54,7 @@ jobs:
uses: actions/checkout@v4

- name: Check Lint
uses: astral-sh/ruff-action@v1
uses: astral-sh/ruff-action@v2
with:
args: "check --no-fix --verbose"

Expand Down
2 changes: 1 addition & 1 deletion main/como/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from como.utils import stringlist_to_list

__all__ = ["stringlist_to_list", "Config"]
__version__ = "1.10.0"
__version__ = "1.11.1"


def return_placeholder_data() -> pd.DataFrame:
Expand Down
24 changes: 19 additions & 5 deletions main/como/create_context_specific_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.upper(),
)
algorithm = IMAT(s_matrix, np.array(lb), np.array(ub), properties)
context_rxns: npt.NDArray = algorithm.run()
fluxes: pd.Series = algorithm.sol.to_series()
Expand Down Expand Up @@ -507,7 +514,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]
Expand Down Expand Up @@ -626,10 +640,10 @@ def create_context_specific_model( # noqa: C901
raise ValueError(f"Output file type {output_type} not recognized. Must be one of: 'xml', 'mat', 'json'")

if algorithm not in Algorithm:
raise ValueError(f"Algorithm {algorithm} not supported. Please use one of: GIMME, FASTCORE, or IMAT")
raise ValueError(f"Algorithm {algorithm} not supported. Use one of {', '.join(a.value for a in Algorithm)}")

if solver not in Solver:
raise ValueError(f"Solver '{solver}' not supported. Use 'GLPK' or 'GUROBI'")
raise ValueError(f"Solver '{solver}' not supported. Use one of {', '.join(s.value for s in Solver)}")

if boundary_rxns_filepath:
boundary_reactions = _collect_boundary_reactions(boundary_rxns_filepath)
Expand Down Expand Up @@ -662,7 +676,7 @@ def create_context_specific_model( # noqa: C901
bound_ub=boundary_reactions.upper_bounds,
exclude_rxns=exclude_rxns,
force_rxns=force_rxns,
solver=solver.value,
solver=solver.value.lower(),
low_thresh=low_threshold,
high_thresh=high_threshold,
)
Expand Down
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ dependencies = [
"openpyxl>=3.1.5",
"aiofiles>=24.1.0",
"aioftp>=0.23.1",
"troppo",
"cobamp",
"troppo@git+https://github.com/JoshLoecker/troppo@master",
"cobamp@git+https://github.com/JoshLoecker/cobamp@master",
]

[build-system]
Expand Down Expand Up @@ -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", rev = "update_dependencies" }
cobamp = { git = "https://github.com/JoshLoecker/cobamp", rev = "update_packages" }