Skip to content

Commit

Permalink
check if osqp is there
Browse files Browse the repository at this point in the history
  • Loading branch information
cdiener committed Oct 27, 2023
1 parent a48642d commit 74fe9d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: |
python -m pip install --upgrade pip cryptography
pip install wheel numpy Cython
pip install biom-format
pip install biom-format highspy
- name: Install MICOM
run: pip install -e .
- name: install CPLEX
Expand Down
8 changes: 4 additions & 4 deletions micom/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def rank_prefixes(manifest: pd.DataFrame) -> pd.Series:
The detected prefix for each taxonomic rank in the manifest.
"""
ranks = [c for c in manifest.columns if c.lower() in RANKS]
prefixes = pd.Series({r: manifest[r].str.extract(r"^([a-z]__)").iloc[0, 0] for r in ranks})
prefixes = pd.Series(
{r: manifest[r].str.extract(r"^([a-z]__)").iloc[0, 0] for r in ranks}
)

return prefixes

Expand Down Expand Up @@ -131,9 +133,7 @@ def unify_rank_prefixes(taxonomy: pd.DataFrame, manifest: pd.DataFrame) -> pd.Da
ranks = [c for c in taxonomy.columns if c.lower() in RANKS]
if db_prefixes.isna().all():
for r in ranks:
taxonomy[r] = taxonomy[r].str.replace(
r"^[a-z]__", "", regex=True
)
taxonomy[r] = taxonomy[r].str.replace(r"^[a-z]__", "", regex=True)
else:
for r in ranks:
taxonomy[r] = db_prefixes[r] + taxonomy[r]
Expand Down
3 changes: 3 additions & 0 deletions tests/test_osqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

from .fixtures import community
import cobra.util.solver as su
import micom.data as md
from micom.workflows import (
build,
Expand All @@ -17,6 +18,8 @@
import pytest
from pytest import approx

pytestmark = pytest.mark.skipif("osqp" not in su.solvers)

medium = load_qiime_medium(md.test_medium)
db = md.test_db

Expand Down

0 comments on commit 74fe9d8

Please sign in to comment.