Skip to content

Commit

Permalink
Fixed pull conflics
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLoecker committed Oct 7, 2022
2 parents 4046ab3 + bccc5b8 commit 9819783
Show file tree
Hide file tree
Showing 328 changed files with 19,858 additions and 9,535 deletions.
9 changes: 5 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# A list of items to ignore when building the docker image
/.github
/doc
/docs
/docker_old
/.gitattributes
/Dockerfile_test
/.gitignore
/README.md
/pipelines/py/rlogs
/pipelines/py/.ipynb_checkpoints
/main/py/tests
/main/py/.pytest_cache
/main/py/rlogs
/main/py/.Rhistory
88 changes: 39 additions & 49 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,64 @@ on:
# - 'bulk_dev'
# - "master"
workflow_dispatch:
schedule:
# Every day at midnight
- cron: '0 0 * * *'
push:
tags:
- "*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DEBIAN_FRONTEND: noninteractive

jobs:
# This job will check if there has been a push to the master branch within the past day
# If there has been a push to the master branch, then it will run the build job
# From: https://github.com/doxygen/doxygen/blob/68b134f1457aa88553665c3bb77b85154436bf4c/.github/workflows/coverity.yml#L16
check_build:
build-and-push-image:
runs-on: ubuntu-20.04
name: Check Latest Commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- name: Get Latest Commit Hash
run: echo ${{ github.sha }}

- id: should_run
continue-on-error: true
name: Check if commit <24 hours
if: ${{ github.event_name == 'schedule' }}
run: test -z $(github rev-list --after="24 hours" %{{ github.sha }}) && echo "::set-output name=should_run::false"


dockerhub:

# Only run the docker build if we have a commit within the past 24 hours
needs: check_build
if: ${{ needs.check_build.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
name: Build Docker Image

env:
DEBIAN_FRONTEND: noninteractive

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/[email protected]
uses: actions/checkout@v3
with:
ref: ${{ github.GITHUB_REF }}

- name: Log in to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Get tag/release information for docker tags
- name: Docker Metadata
id: metadata
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
prefix=
suffix=
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/master') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


# Set the tag based on the current branch
- name: Test if Master Branch
continue-on-error: true
if: ${{ github.ref_name == 'master' }}
run: echo 'DOCKER_TAG=development' >> $GITHUB_ENV
- name: Set non-Master Branch Tag
continue-on-error: true
if: ${{ github.ref_name != 'master' }}
run: echo 'DOCKER_TAG=${{ github.ref_name }}' >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: babessell/madrid:${{env.DOCKER_TAG}}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
42 changes: 42 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Unit Tests
on:
push:
tags:
- "*"
pull_request:
workflow_dispatch:


jobs:
unit_tests:
runs-on: ubuntu-latest

# Using a matrix lets us define additional versions of Python to test against
strategy:
matrix:
python-version: ["3.10"]

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --requirement main/py/tests/requirements.txt
- name: Lint with flake8
run: |
# 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
# Change into the GITHUB_WORKSPACE /home/runner/work/REPO/REPO and execute tests
- name: Run tests
run: pytest
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ docker_old/*
/**/.ipynb_checkpoints/

# R logs
/work/py/rlogs/
/main/py/rlogs/
*.Rhistory

# Microsoft temporary files
~$*

# Python cache files
/**/__pycache__
work/py/tests/.pytest_cache
**/*.pytest_cache

# Do not track output files
/work/output
/main/output

# Local GitHub Pages build location
/docs/_site
**/.jekyll-cache
/docs/Gemfile.lock

35 changes: 35 additions & 0 deletions Clustering ToDo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Call clustering after merging
Want to all cluster replicates at replicate level, batch level, and source level
S1R* (replicate)
S*R* (sample/batch)
transcriptomics (source)

Follow combine_distributions.R script as template
Memory usage may be an issue
Create a dataframe for all samples?

1. Read clustering R script
2. Read merging R script


--------------
Steps
--------------
1. Add flag to merge_xomics.py that turns on clustering
- If this flag is ON, require the option to use binarized data or z scores, and clustering parameter arguments
2. Modify (or rewrite) combine_distributions.R (which is called from merge_xomics.py) that:
- reads zFPKMs/TPM/CPM for each replicate
+ binarizes them if given zFPKM argument in #1
+ Look at the kOverA function in RNAseq.R to see how to binarize zFPKM data

3. Cluster all replicates for all batches/studies across all cell types (contexts) within a single data source
4. Cluster all replicates for all batches/studies across all data sources within one cell type
5. Cluster all batches/studies across all cell types (contexts) within one data source at a time
6. Cluster all batches/studies across all data sources within one cell type


[X] So add a flag to merge that turns on clustering.
[ ] This flag also demands args that tell it whether to use binarzied data or z scores, and clustering parameter args
[ ] Also take args for which data sources to check.
[ ] If the args are using binarized data, it should take argument specifying z-transformed, tpm-quantile, or cpm
[ ] If using proteomics at all, tpm-quantile and cpm should return an error saying that proteomics and transcriptomics can only be compared with z-transform
42 changes: 19 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,45 @@ FROM jupyter/r-notebook:latest
ARG GRB_SHORT_VERSION=9.5
ARG GRB_VERSION=9.5.0
ARG PYTHON_VERSION=3.10
ARG HOME="/home/jovyan"
ARG ENVIRONMENT_FILE="${HOME}/environment.yaml"
ARG JUPYTER_NOTEBOOK="${HOME}/work/py/pipeline.ipynb"
ARG JUPYTER_CONFIG="${HOME}/.jupyter/jupyter_notebook_config.py"
ENV DEBIAN_FRONTEND=noninteractive

COPY /build_scripts/pip_install.txt "${HOME}/pip_install.txt"
COPY /build_scripts/mamba_install.txt "${HOME}/mamba_install.txt"
COPY /environment.yaml "${ENVIRONMENT_FILE}"
COPY /environment.yaml "${HOME}/environment.yaml"

# Give ownership to jovyan user
COPY --chown=1000:100 /work "${HOME}"/work
#
COPY --chown=1000:100 main "${HOME}"/main

# Install python-related items
RUN conda config --add channels conda-forge \
&& conda config --add channels bioconda \
&& conda config --add channels r \
RUN conda config --quiet --add channels conda-forge \
&& conda config --quiet --add channels bioconda \
&& conda config --quiet --add channels r \
# Remove python from pinned versions; this allows us to update python. From: https://stackoverflow.com/a/11245372/13885200 \
&& sed -i "s/^python 3.*//" /opt/conda/conda-meta/pinned \
&& mamba install --yes python=${PYTHON_VERSION} \
&& mamba env update --name base --file "${ENVIRONMENT_FILE}" \
&& mamba install --quiet --yes python=${PYTHON_VERSION} \
&& mamba env update --quiet --name=base --file="${HOME}/environment.yaml" \
# && mamba install --file "${HOME}/mamba_install.txt" \
# && python3 -m pip install -r "${HOME}/pip_install.txt" \
#&& mamba env update --name base --file "${ENVIRONMENT_FILE}" \
&& mamba clean --all --force-pkgs-dirs --yes \
&& R -e 'devtools::install_github("babessell1/zFPKM")' \
&& mamba clean --quiet --all --force-pkgs-dirs --yes \
&& R -e "devtools::install_github('babessell1/zFPKM')" \
# Install jupyter extensions
&& jupyter labextension install @jupyter-widgets/jupyterlab-manager \
&& jupyter labextension install escher \
&& jupyter trust "${JUPYTER_NOTEBOOK}" \
&& rm -f "${ENVIRONMENT_FILE}" "${HOME}/pip_install.txt" "${HOME}/mamba_install.txt"
&& jupyter trust "${HOME}/main/py/pipeline.ipynb" \
&& rm -f "${HOME}/pip_install.txt" \
&& rm -f "${HOME}/mamba_install.txt"

# Install gurbori
RUN wget https://packages.gurobi.com/${GRB_SHORT_VERSION}/gurobi${GRB_VERSION}_linux64.tar.gz \
RUN wget --quiet https://packages.gurobi.com/${GRB_SHORT_VERSION}/gurobi${GRB_VERSION}_linux64.tar.gz \
&& tar -xf gurobi${GRB_VERSION}_linux64.tar.gz \
&& rm -f gurobi${GRB_VERSION}_linux64.tar.gz \
&& mv -f gurobi* gurobi \
&& rm -rf gurobi/linux64/docs

# Update jupyter notebook configuration \
RUN echo "c.ServerApp.ip = '0.0.0.0'" >> "${JUPYTER_CONFIG}" \
&& echo "c.ServerApp.root_dir = '${HOME}/work'" >> "${JUPYTER_CONFIG}" \
&& echo "c.ServerApp.token = ''" >> "${JUPYTER_CONFIG}" \
&& echo "c.ServerApp.password = ''" >> "${JUPYTER_CONFIG}"
RUN 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"

VOLUME /home/joyvan/work
VOLUME /home/joyvan/main
16 changes: 16 additions & 0 deletions Exchange Reactions
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Lower bound: Uptake of nutrients
- "-1" = 1 mmol/hour
Upper bound: Secretion of nutrients
Forward or Reverse direction (reverse only for reversible directions)


For basal metabolites, set -1000/1000 lower/upper bounds
Glucose is primary carbon source when proliferating
All amino acids are required
- Tight constraints: not in abundance in the body, residues can act as limiting factor
- Set lower bound as -1 to limit uptake
Fatty Acids
- Make lower bound 0 if I am positive NK cell does not uptake


Table w/ all media conditions
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# MADRID: a pipeline for MetAbolic Drug Repurposing IDentification

[![Continuous Integration](https://github.com/HelikarLab/MADRID/actions/workflows/dockerhub.yml/badge.svg)](https://github.com/HelikarLab/MADRID/actions/workflows/dockerhub.yml)
[![Unit Tests](https://github.com/HelikarLab/MADRID/actions/workflows/unit_tests.yml/badge.svg?branch=master)](https://github.com/HelikarLab/MADRID/actions/workflows/unit_tests.yml)
[![pages-build-deployment](https://github.com/HelikarLab/MADRID/actions/workflows/pages/pages-build-deployment/badge.svg?branch=master)](https://github.com/HelikarLab/MADRID/actions/workflows/pages/pages-build-deployment)

This is the home page for MADRID pipeline.

[View the documentation](https://helikarlab.github.io/MADRID)

[Create and view Issues](https://joshl.youtrack.cloud/dashboard?id=7bb0e449-3a4f-4fe8-a253-a445efd15ea4)
[Create and view Issues](https://github.com/HelikarLab/MADRID/issues)

## How To Run application
- [Install Docker](https://docs.docker.com/install/)
- `docker login`
- `sudo docker login`
- `sudo docker pull babessell/madrid:development`
- `sudo docker run --cpus=4 -p 4000:8888 --volume=$HOME/gurobi.lic:/opt/gurobi/gurobi.lic:ro -v /$HOME/saghamiri/Desktop/LocalMadrid:/home/jovyan/work/data/local_files --rm --name jupyteruser --rm -it babessell/madrid:development` Run docker image and assign 2 CPUs to it.
- Open [http://127.0.0.1:4000](http://127.0.0.1:4000) from your browser
- Alternatively, you can copy and paste the command under the prompt "or copy and paste one of these URLs:" and replace the "8888" port with "4000"
- Run docker image and assign 2 CPUs to it.
- `sudo docker run --cpus=4 -p 8888:8888 --volume=$HOME/gurobi.lic:/opt/gurobi/gurobi.lic:ro -v /$HOME/LocalMadrid:/home/jovyan/work/data/local_files --rm --name madrid --rm -it ghcr.io/helikarlab/madrid:latest`
- Open [http://127.0.0.1:8888](http://127.0.0.1:8888) from your browser
- Alternatively, you can copy and paste the command under the prompt "or copy and paste one of these URLs:"
- In your jupyter notebook, open `/work/py/pipeline.ipynb`
- Upload your configuration files `/work/data/config_files` and data files to `/work/data/data_matrices` according to the instructions in the notebook and provided templates, update the file names in the jupyter notebook accordingly.
- Upload your configuration files to `/work/data/config_files` and data files to `/work/data/data_matrices` according to the instructions in the notebook and provided templates
- Update the file names in the jupyter notebook accordingly.
- Run the notebook step by step, or run the step(s) by your needs


Expand Down
2 changes: 0 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,3 @@

# import mapping
from . import apps

# import dev
6 changes: 6 additions & 0 deletions docs/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Page Not Found"
search: exclude
---

Sorry, but the page you were trying to view does not exist. Try searching for it or looking at the URL to see if it looks correct.
Loading

0 comments on commit 9819783

Please sign in to comment.