Skip to content

Commit

Permalink
Merge pull request #187 from HelikarLab/purge_r
Browse files Browse the repository at this point in the history
Purge R code
  • Loading branch information
JoshLoecker authored Dec 4, 2024
2 parents f8a518e + 3b83239 commit 18ad5a3
Show file tree
Hide file tree
Showing 59 changed files with 190,657 additions and 187,395 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ main/src/tests
**/.ipynb_checkpoints/
README.md
LICENSE
/.venv
84 changes: 84 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Continuous Integration
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Create Virtual Environment
run: uv venv

- name: Install Jupyter
run: uv pip install jupyter nbconvert

- name: Strip Notebook Output
run: uv run jupyter nbconvert --clear-output --inplace "main/COMO.ipynb"

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

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

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

- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: format code, Jupyter Notebook(s), and Python imports with `ruff`"
file_pattern: "main/como/*.py"


lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.10" ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: "true"
cache-suffix: "${{ matrix.python-version }}"
cache-dependency-glob: 'uv.lock'

- name: Install Dependencies
run: uv sync --python "${{ matrix.python-version }}" --all-extras --dev

- name: Run tests
run: uv run --python "${{ matrix.python-version }}" pytest --cov --junitxml=junit.xml -o junit_family=legacy

- name: Cache Clear
run: uv cache prune --ci
40 changes: 0 additions & 40 deletions .github/workflows/unit_tests.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ docs/_site
docs/Gemfile.lock

# COMO-specific files
.hypothesis
**/*.Rout
main/logs/
main/data/results/
main/data/config_sheets/*_data_inputs_auto.xlsx
main/data/gene_info.csv
main/data/Repurposing_Hub_Preproc.tsv
main/microarray.db
main/data/config_sheets/*
main/data/GSE*_RAW
main/data/gpl*entrez.csv
main/src/microarray.db
main/data/results/
main/data/config_sheets

# COMO data
main/data/data_matrices
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/opensource-nepal/commitlint
rev: v1.2.0
hooks:
- id: commitlint
name: Commit Lint
33 changes: 9 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
FROM jupyter/r-notebook:latest as builder
FROM python:3.10 AS app

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" && \
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" && \
mamba config --quiet --add channels conda-forge && \
mamba config --quiet --add channels bioconda && \
mamba config --quiet --add channels r && \
rm -rf "${HOME}/main/tests" # Tests not required for running COMO

# Update base environment
RUN mamba env update --name=base --file="${HOME}/environment.yaml" && \
R -e "devtools::install_github('babessell1/zFPKM')" && \
pip cache purge && \
mamba clean --all --yes
WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY --chown=1000:100 main /app/main/
COPY --chown=1000:100 pyproject.toml /app/pyproject.toml

RUN uv sync && uv pip install jupyterlab
EXPOSE 8888
VOLUME /home/joyvan/main/data/local_files
VOLUME "/app/main/data/local_files"
CMD ["jupyter", "lab", "--allow-root", "--no-browser", "--ip=0.0.0.0", "--port=8888", "--notebook-dir=/app/main", "--NotebookApp.token=''", "--NotebookApp.password=''"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
![GitHub release (with filter)](https://img.shields.io/github/v/release/HelikarLab/COMO?filter=v*-master&style=for-the-badge&color=blue)
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/HelikarLab/COMO/unit_tests.yml?style=for-the-badge&logo=pytest&logoColor=white&label=Tests)
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/HelikarLab/COMO/container_build.yml?style=for-the-badge&logo=docker&logoColor=white&label=Docker%20Build)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)


# Setting up COMO

Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
como:
image: ghcr.io/helikarlab/como:latest
container_name: como
ports:
- "8888:8888"
volumes:
# Map "[LOCAL_DIRECTORY]/local_files to /app/main/data/local_files
- "$(pwd)/local_files:/app/main/data/local_files"
Loading

0 comments on commit 18ad5a3

Please sign in to comment.