Skip to content

Commit

Permalink
Model Checking (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLoecker authored Nov 30, 2023
1 parent fa8a531 commit 1fbe7cf
Show file tree
Hide file tree
Showing 31 changed files with 359 additions and 154 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/container_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ env:

jobs:
build-and-push-image:
name: Build and Push Docker Image
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
name: Build and Push Docker Image

# A matrix platform is used here to expand functionality for building for additional architectures
# For example, intel/amd (linux/amd64) or Apple Silicon (arm64)
strategy:
matrix:
platform: [ linux/amd64 ]

steps:
# Checkout the repository
Expand All @@ -38,21 +44,21 @@ jobs:
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, 'master') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}

- name: Clean Jupyter Notebook Outputs
- name: Set up Jupyter Notebook Cleaner
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Clean Notebook Output

- name: Clean Jupyter Notebook Outputs
run: |
python -m pip install --upgrade nbstripout --no-cache-dir
find $GITHUB_WORKSPACE -name "*.ipynb" -exec nbstripout "{}" \;
Expand All @@ -74,5 +80,5 @@ jobs:
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64
platforms: ${{ matrix.platform }}

27 changes: 11 additions & 16 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,19 @@ jobs:
uses: actions/checkout@v4

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

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
/main/data/gene_info.csv
/main/data/Repurposing_Hub_Preproc.tsv
/main/microarray.db
/main/data/config_sheets/*
34 changes: 21 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
FROM jupyter/r-notebook:latest
FROM jupyter/r-notebook:latest as builder

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

# Install python-related items
# Remove "python" from the pinned file so we can install our own version
RUN sed -i '/^python/d' /opt/conda/conda-meta/pinned && \
echo "auto_activate_base: true" >> "${HOME}/.condarc" && \
conda config --quiet --add channels conda-forge && \
conda config --quiet --add channels bioconda && \
conda config --quiet --add channels r && \
# Update base environment
mamba env update --name=base --file="${HOME}/environment.yaml" && \
R -e "devtools::install_github('babessell1/zFPKM')" && \
# Trust the jupyter notebook
jupyter trust "${HOME}/main/COMO.ipynb" && \
echo "c.ServerApp.ip = '0.0.0.0'" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
echo "c.ServerApp.root_dir = '${HOME}/main'" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
echo "c.ServerApp.token = ''" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
echo "c.ServerApp.password = ''" >> "${HOME}/.jupyter/jupyter_notebook_config.py" && \
# Purge cache information, reducing image size
conda config --quiet --add channels conda-forge && \
conda config --quiet --add channels bioconda && \
conda config --quiet --add channels r && \
rm -rf "${HOME}/main/tests" # Remove tests, they are not required for running COMO

# Update base environment
RUN ls "${HOME}" && \
mamba env update --name=base --file="${HOME}/environment.yaml" && \
R -e "devtools::install_github('babessell1/zFPKM')" && \
pip cache purge && \
conda clean --all --yes --force-pkgs-dirs && \
rm -f "${HOME}/environment.yaml"
mamba clean --all --yes

FROM jupyter/r-notebook:latest

COPY --from=builder ${HOME} ${HOME}

RUN pip cache purge && \
conda clean --all --yes

EXPOSE 8888
VOLUME /home/joyvan/main/data/local_files
37 changes: 19 additions & 18 deletions environment.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: como
channels:
- bioconda
- conda-forge
- bioconda
- gurobi
- anaconda

# Use the ~= specifier to allow any minor updates
# For example, "~=4.0" requires version 4.0, but does not allow version 5.0
dependencies:
- anaconda::lxml~=4.9.1
- bioconda::bioconductor-affyio~=1.64.0
Expand All @@ -16,25 +19,21 @@ dependencies:
- bioconda::bioconductor-hgu133acdf~=2.18.0
- bioconda::bioconductor-limma~=3.50.1
- bioconda::crux-toolkit~=4.1
- bioconda::escher==1.7.*
- bioconda::thermorawfileparser~=1.4.0
- conda-forge::aioftp~=0.21.2
- conda-forge::bioservices~=1.11.2
- conda-forge::cobra<=1.0.0
# - conda-forge::bioservices~=1.11.2
- conda-forge::cobra~=0.29.0
- conda-forge::geoparse~=2.0.3
- conda-forge::git~=2.37.0
# - conda-forge::jupyterlab-spreadsheet-editor==0.6.*
# - conda-forge::git~=2.37.0
- conda-forge::jupyterlab~=4.0.0
- conda-forge::markupsafe~=2.0.1
- conda-forge::numpy~=1.23.0
- conda-forge::openpyxl~=3.0.10
- conda-forge::optlang~=1.5.2
# - conda-forge::optlang~=1.5.2
- conda-forge::pandas<=3.0.0
- conda-forge::pip~=22.1.2
- conda-forge::pip
- conda-forge::python-libsbml~=5.19.2
- conda-forge::python~=3.10
# - conda-forge::r-base~=4
# - conda-forge::r-base
- conda-forge::r-base
- conda-forge::r-biocmanager~=1.30.18
- conda-forge::r-devtools~=2.4.3
- conda-forge::r-factominer~=2.8
Expand All @@ -50,18 +49,20 @@ dependencies:
- conda-forge::r-tidyverse~=1.3.1
- conda-forge::r-uwot~=0.1.11
- conda-forge::r-zoo~=1.8_10
- conda-forge::requests~=2.28.1
# - conda-forge::requests~=2.28.1
- conda-forge::rpy2~=3.5.1
- conda-forge::scipy~=1.8.1
# - conda-forge::scipy~=1.8.1
- conda-forge::sqlalchemy~=1.4.39
- conda-forge::tqdm~=4.64.1
- conda-forge::unidecode~=1.3.4
- conda-forge::wget~=1.20.3
- conda-forge::xlrd~=2.0.1
- gurobi::gurobi~=10.0
# - conda-forge::unidecode~=1.3.4
# - conda-forge::wget~=1.20.3
# - conda-forge::xlrd~=2.0.1
- gurobi::gurobi
- pip:
- async_bioservices
# - escher==1.7.3
- git+https://github.com/JoshLoecker/escher.git@python38#subdirectory=py
- framed==0.5.*
- memote==0.13.*
- memote<=1.0
- git+https://github.com/JoshLoecker/cobamp.git
- git+https://github.com/JoshLoecker/troppo.git
7 changes: 4 additions & 3 deletions main/COMO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@
"import cobra\n",
"import os\n",
"from pathlib import Path\n",
"from project import configs\n",
"from src.project import configs\n",
"\n",
"user_map_dir = Path(f\"{configs.datadir}/local_files/maps/\")\n",
"map_dict = {\n",
Expand Down Expand Up @@ -818,7 +818,8 @@
" \"results\",\n",
" context,\n",
" f\"{context}_SpecificModel_{recon_algorithm}.json\")\n",
" \n",
"\n",
" print(f\"Loading '{context}', this may take some time...\")\n",
" model = cobra.io.load_json_model(model_json)\n",
" for key in map_dict.keys():\n",
" print(f\"Running with: {key}\")\n",
Expand Down Expand Up @@ -1049,7 +1050,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.11.6"
},
"toc-autonumbering": true,
"toc-showcode": true
Expand Down
Binary file not shown.
Binary file not shown.
File renamed without changes.
92 changes: 92 additions & 0 deletions main/data/force_rxns/smB_force_rxns.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Abbreviation
D_LACtm
HEX1
FBP
PFK
FBA2
GAPD
PGI
PGK
ENO
PGM
PGMT
TPI
PYK
LDH_L
PDHm
PEPCK
PEPCKm
r0354
r0355
G6PPer
G3PD2m
CSm
ACONTm
ICDHxm
ICDH_m
AKGDm
SUCD1m
FUMm
MDHm
SUCOAS1m
SUCOASm
ACITL
ACCOAC
ADRNCPT1
C160CPT1
C161CPT1
C161CPT12
CLPNDCPT1
DCSPTN1CPT1
DLNLCGCPT1
EICOSTETCPT1
ELAIDCPT1
LNELDCCPT1
LNLCCPT1
LNLNCACPT1
LNLNCGCPT1
STRDNCCPT1
TETPENT3CPT1
TETPENT6CPT1
TETTET6CPT1
TMNDNCCPT1
CATC140_c
HMR_2602
HMR_2608
HMR_2611
HMR_2620
HMR_2633
HMR_2648
HMR_2651
HMR_2657
HMR_2660
HMR_2666
HMR_2669
HMR_2675
HMR_2681
HMR_2684
HMR_2687
HMR_2690
HMR_2693
HMR_2699
HMR_2702
HMR_2705
HMR_2708
HMR_2711
HMR_2733
HMR_2736
HMR_2739
HMR_2768
HMR_2771
HMR_2774
ATPS4mi
CYOOm2i
CYOR_u10mi
NADH2_u10mi
CYOOm3i
FADH2ETC
GLYC3PFADm
PGL
GNDc
G6PDH2c
r0249
Loading

0 comments on commit 1fbe7cf

Please sign in to comment.