Skip to content

Commit 1fbe7cf

Browse files
authored
Model Checking (#167)
1 parent fa8a531 commit 1fbe7cf

31 files changed

+359
-154
lines changed

.github/workflows/container_build.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ env:
1111

1212
jobs:
1313
build-and-push-image:
14+
name: Build and Push Docker Image
1415
runs-on: ubuntu-20.04
1516
permissions:
1617
contents: read
1718
packages: write
18-
name: Build and Push Docker Image
19+
20+
# A matrix platform is used here to expand functionality for building for additional architectures
21+
# For example, intel/amd (linux/amd64) or Apple Silicon (arm64)
22+
strategy:
23+
matrix:
24+
platform: [ linux/amd64 ]
1925

2026
steps:
2127
# Checkout the repository
@@ -38,21 +44,21 @@ jobs:
3844
type=semver,pattern={{version}}
3945
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, 'master') }}
4046
41-
- name: Set up QEMU
42-
uses: docker/setup-qemu-action@v3
43-
with:
44-
platforms: linux/amd64
45-
4647
- name: Set up Docker Buildx
4748
id: buildx
4849
uses: docker/setup-buildx-action@v3
4950

51+
- name: Set up QEMU
52+
uses: docker/setup-qemu-action@v3
53+
with:
54+
platforms: ${{ matrix.platform }}
5055

51-
- name: Clean Jupyter Notebook Outputs
56+
- name: Set up Jupyter Notebook Cleaner
5257
uses: actions/setup-python@v4
5358
with:
5459
python-version: "3.10"
55-
- name: Clean Notebook Output
60+
61+
- name: Clean Jupyter Notebook Outputs
5662
run: |
5763
python -m pip install --upgrade nbstripout --no-cache-dir
5864
find $GITHUB_WORKSPACE -name "*.ipynb" -exec nbstripout "{}" \;
@@ -74,5 +80,5 @@ jobs:
7480
tags: ${{ steps.metadata.outputs.tags }}
7581
labels: ${{ steps.metadata.outputs.labels }}
7682
builder: ${{ steps.buildx.outputs.name }}
77-
platforms: linux/amd64
83+
platforms: ${{ matrix.platform }}
7884

.github/workflows/unit_tests.yml

+11-16
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,19 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Install Conda environment
25-
uses: mamba-org/provision-with-micromamba@main
25+
uses: mamba-org/setup-micromamba@v1
2626
with:
27-
environment-file: main/src/tests/environment.yaml
27+
environment-file: main/tests/environment.yaml
2828
environment-name: como_tests
29-
extra-specs: |
29+
micromamba-version: "latest"
30+
init-shell: bash
31+
cache-environment: true
32+
cache-downloads: true
33+
post-cleanup: "none"
34+
create-args: >-
3035
python=${{ matrix.python-version }}
3136
32-
- name: Lint with flake8
33-
run: |
34-
# Initialize micromamba and activate como_tests environment
35-
eval "$(micromamba shell hook --shell=bash)" && micromamba activate como_tests
36-
# stop the build if there are Python syntax errors or undefined names
37-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
39-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
40-
4137
- name: Run tests
42-
run: |
43-
# Initialize micromamba and activate como_tests environment
44-
eval "$(micromamba shell hook --shell=bash)" && micromamba activate como_tests
45-
python -m pytest
38+
run: python -m pytest
39+
shell: micromamba-shell {0}
40+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
/main/data/gene_info.csv
1717
/main/data/Repurposing_Hub_Preproc.tsv
1818
/main/microarray.db
19+
/main/data/config_sheets/*

Dockerfile

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1-
FROM jupyter/r-notebook:latest
1+
FROM jupyter/r-notebook:latest as builder
22

3-
COPY /environment.yaml "${HOME}/environment.yaml"
4-
COPY --chown=1000:100 main "${HOME}"/main
3+
COPY environment.yaml "${HOME}/environment.yaml"
4+
COPY --chown=1000:100 main "${HOME}/main"
55

66
# Install python-related items
77
# Remove "python" from the pinned file so we can install our own version
88
RUN sed -i '/^python/d' /opt/conda/conda-meta/pinned && \
99
echo "auto_activate_base: true" >> "${HOME}/.condarc" && \
10-
conda config --quiet --add channels conda-forge && \
11-
conda config --quiet --add channels bioconda && \
12-
conda config --quiet --add channels r && \
13-
# Update base environment
14-
mamba env update --name=base --file="${HOME}/environment.yaml" && \
15-
R -e "devtools::install_github('babessell1/zFPKM')" && \
16-
# Trust the jupyter notebook
1710
jupyter trust "${HOME}/main/COMO.ipynb" && \
1811
echo "c.ServerApp.ip = '0.0.0.0'" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
1912
echo "c.ServerApp.root_dir = '${HOME}/main'" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
2013
echo "c.ServerApp.token = ''" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
2114
echo "c.ServerApp.password = ''" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
22-
# Purge cache information, reducing image size
15+
conda config --quiet --add channels conda-forge && \
16+
conda config --quiet --add channels bioconda && \
17+
conda config --quiet --add channels r && \
18+
rm -rf "${HOME}/main/tests" # Remove tests, they are not required for running COMO
19+
20+
# Update base environment
21+
RUN ls "${HOME}" && \
22+
mamba env update --name=base --file="${HOME}/environment.yaml" && \
23+
R -e "devtools::install_github('babessell1/zFPKM')" && \
2324
pip cache purge && \
24-
conda clean --all --yes --force-pkgs-dirs && \
25-
rm -f "${HOME}/environment.yaml"
25+
mamba clean --all --yes
26+
27+
FROM jupyter/r-notebook:latest
28+
29+
COPY --from=builder ${HOME} ${HOME}
30+
31+
RUN pip cache purge && \
32+
conda clean --all --yes
2633

34+
EXPOSE 8888
2735
VOLUME /home/joyvan/main/data/local_files

environment.yaml

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: como
22
channels:
3-
- bioconda
43
- conda-forge
4+
- bioconda
55
- gurobi
66
- anaconda
7+
8+
# Use the ~= specifier to allow any minor updates
9+
# For example, "~=4.0" requires version 4.0, but does not allow version 5.0
710
dependencies:
811
- anaconda::lxml~=4.9.1
912
- bioconda::bioconductor-affyio~=1.64.0
@@ -16,25 +19,21 @@ dependencies:
1619
- bioconda::bioconductor-hgu133acdf~=2.18.0
1720
- bioconda::bioconductor-limma~=3.50.1
1821
- bioconda::crux-toolkit~=4.1
19-
- bioconda::escher==1.7.*
2022
- bioconda::thermorawfileparser~=1.4.0
2123
- conda-forge::aioftp~=0.21.2
22-
- conda-forge::bioservices~=1.11.2
23-
- conda-forge::cobra<=1.0.0
24+
# - conda-forge::bioservices~=1.11.2
25+
- conda-forge::cobra~=0.29.0
2426
- conda-forge::geoparse~=2.0.3
25-
- conda-forge::git~=2.37.0
26-
# - conda-forge::jupyterlab-spreadsheet-editor==0.6.*
27+
# - conda-forge::git~=2.37.0
2728
- conda-forge::jupyterlab~=4.0.0
28-
- conda-forge::markupsafe~=2.0.1
2929
- conda-forge::numpy~=1.23.0
3030
- conda-forge::openpyxl~=3.0.10
31-
- conda-forge::optlang~=1.5.2
31+
# - conda-forge::optlang~=1.5.2
3232
- conda-forge::pandas<=3.0.0
33-
- conda-forge::pip~=22.1.2
33+
- conda-forge::pip
3434
- conda-forge::python-libsbml~=5.19.2
3535
- conda-forge::python~=3.10
36-
# - conda-forge::r-base~=4
37-
# - conda-forge::r-base
36+
- conda-forge::r-base
3837
- conda-forge::r-biocmanager~=1.30.18
3938
- conda-forge::r-devtools~=2.4.3
4039
- conda-forge::r-factominer~=2.8
@@ -50,18 +49,20 @@ dependencies:
5049
- conda-forge::r-tidyverse~=1.3.1
5150
- conda-forge::r-uwot~=0.1.11
5251
- conda-forge::r-zoo~=1.8_10
53-
- conda-forge::requests~=2.28.1
52+
# - conda-forge::requests~=2.28.1
5453
- conda-forge::rpy2~=3.5.1
55-
- conda-forge::scipy~=1.8.1
54+
# - conda-forge::scipy~=1.8.1
5655
- conda-forge::sqlalchemy~=1.4.39
5756
- conda-forge::tqdm~=4.64.1
58-
- conda-forge::unidecode~=1.3.4
59-
- conda-forge::wget~=1.20.3
60-
- conda-forge::xlrd~=2.0.1
61-
- gurobi::gurobi~=10.0
57+
# - conda-forge::unidecode~=1.3.4
58+
# - conda-forge::wget~=1.20.3
59+
# - conda-forge::xlrd~=2.0.1
60+
- gurobi::gurobi
6261
- pip:
6362
- async_bioservices
63+
# - escher==1.7.3
64+
- git+https://github.com/JoshLoecker/escher.git@python38#subdirectory=py
6465
- framed==0.5.*
65-
- memote==0.13.*
66+
- memote<=1.0
6667
- git+https://github.com/JoshLoecker/cobamp.git
6768
- git+https://github.com/JoshLoecker/troppo.git

main/COMO.ipynb

+4-3
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@
786786
"import cobra\n",
787787
"import os\n",
788788
"from pathlib import Path\n",
789-
"from project import configs\n",
789+
"from src.project import configs\n",
790790
"\n",
791791
"user_map_dir = Path(f\"{configs.datadir}/local_files/maps/\")\n",
792792
"map_dict = {\n",
@@ -818,7 +818,8 @@
818818
" \"results\",\n",
819819
" context,\n",
820820
" f\"{context}_SpecificModel_{recon_algorithm}.json\")\n",
821-
" \n",
821+
"\n",
822+
" print(f\"Loading '{context}', this may take some time...\")\n",
822823
" model = cobra.io.load_json_model(model_json)\n",
823824
" for key in map_dict.keys():\n",
824825
" print(f\"Running with: {key}\")\n",
@@ -1049,7 +1050,7 @@
10491050
"name": "python",
10501051
"nbconvert_exporter": "python",
10511052
"pygments_lexer": "ipython3",
1052-
"version": "3.10.12"
1053+
"version": "3.11.6"
10531054
},
10541055
"toc-autonumbering": true,
10551056
"toc-showcode": true
Binary file not shown.
Binary file not shown.
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Abbreviation
2+
D_LACtm
3+
HEX1
4+
FBP
5+
PFK
6+
FBA2
7+
GAPD
8+
PGI
9+
PGK
10+
ENO
11+
PGM
12+
PGMT
13+
TPI
14+
PYK
15+
LDH_L
16+
PDHm
17+
PEPCK
18+
PEPCKm
19+
r0354
20+
r0355
21+
G6PPer
22+
G3PD2m
23+
CSm
24+
ACONTm
25+
ICDHxm
26+
ICDH_m
27+
AKGDm
28+
SUCD1m
29+
FUMm
30+
MDHm
31+
SUCOAS1m
32+
SUCOASm
33+
ACITL
34+
ACCOAC
35+
ADRNCPT1
36+
C160CPT1
37+
C161CPT1
38+
C161CPT12
39+
CLPNDCPT1
40+
DCSPTN1CPT1
41+
DLNLCGCPT1
42+
EICOSTETCPT1
43+
ELAIDCPT1
44+
LNELDCCPT1
45+
LNLCCPT1
46+
LNLNCACPT1
47+
LNLNCGCPT1
48+
STRDNCCPT1
49+
TETPENT3CPT1
50+
TETPENT6CPT1
51+
TETTET6CPT1
52+
TMNDNCCPT1
53+
CATC140_c
54+
HMR_2602
55+
HMR_2608
56+
HMR_2611
57+
HMR_2620
58+
HMR_2633
59+
HMR_2648
60+
HMR_2651
61+
HMR_2657
62+
HMR_2660
63+
HMR_2666
64+
HMR_2669
65+
HMR_2675
66+
HMR_2681
67+
HMR_2684
68+
HMR_2687
69+
HMR_2690
70+
HMR_2693
71+
HMR_2699
72+
HMR_2702
73+
HMR_2705
74+
HMR_2708
75+
HMR_2711
76+
HMR_2733
77+
HMR_2736
78+
HMR_2739
79+
HMR_2768
80+
HMR_2771
81+
HMR_2774
82+
ATPS4mi
83+
CYOOm2i
84+
CYOR_u10mi
85+
NADH2_u10mi
86+
CYOOm3i
87+
FADH2ETC
88+
GLYC3PFADm
89+
PGL
90+
GNDc
91+
G6PDH2c
92+
r0249

0 commit comments

Comments
 (0)