From c7a991acebefa30322627404f9b874287043106c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:52:09 +0000 Subject: [PATCH 1/5] Initial plan From c58eacf145810034df0a050a338511080c9c0fa0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 16:58:51 +0000 Subject: [PATCH 2/5] Add complete Docker support with Dockerfile, docker-compose, and documentation Co-authored-by: abearab <53412130+abearab@users.noreply.github.com> --- .dockerignore | 15 +++++++++++ Dockerfile | 64 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 27 +++++++++++++++++++ docker-compose.yml | 19 ++++++++++++++ docker_test.sh | 48 ++++++++++++++++++++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 docker_test.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..baf434b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# Docker ignore file for pager +.git +.gitignore +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env +pip-log.txt +pip-delete-this-directory.txt +.ipynb_checkpoints +.DS_Store +README.md +LICENSE \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..977ff57 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,64 @@ +# Dockerfile for pager - PAGE algorithm and data curation container +FROM ubuntu:22.04 + +# Set environment variables to avoid interactive prompts +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=UTC + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + perl \ + wget \ + curl \ + git \ + build-essential \ + unzip \ + gzip \ + && rm -rf /var/lib/apt/lists/* + +# Install Python dependencies +# Using system packages to avoid SSL issues in some environments +RUN apt-get update && apt-get install -y \ + python3-pandas \ + python3-numpy \ + python3-matplotlib \ + && rm -rf /var/lib/apt/lists/* + +# Alternative: Install from PyPI (uncomment if pip works in your environment) +# RUN pip3 install --no-cache-dir pandas numpy matplotlib + +# Create working directory +WORKDIR /opt/pager + +# Copy pager code +COPY . . + +# Set up environment variables for iPAGE and TEISER +# These should be set when running the container or can be overridden +ENV PAGEDIR=/opt/PAGE +ENV TEISERDIR=/opt/TEISER + +# Create directories for external tools +RUN mkdir -p $PAGEDIR $TEISERDIR + +# Make shell scripts executable +RUN chmod +x *.sh + +# Create a script to help users set up external dependencies +RUN echo '#!/bin/bash' > /opt/setup_tools.sh && \ + echo 'echo "To use pager fully, you need to install iPAGE and TEISER:"' >> /opt/setup_tools.sh && \ + echo 'echo "1. iPAGE: https://github.com/hanig/PAGE"' >> /opt/setup_tools.sh && \ + echo 'echo "2. TEISER: https://github.com/hanig/TEISER"' >> /opt/setup_tools.sh && \ + echo 'echo ""' >> /opt/setup_tools.sh && \ + echo 'echo "Mount these tools into the container at:"' >> /opt/setup_tools.sh && \ + echo 'echo " - iPAGE: $PAGEDIR"' >> /opt/setup_tools.sh && \ + echo 'echo " - TEISER: $TEISERDIR"' >> /opt/setup_tools.sh && \ + echo 'echo ""' >> /opt/setup_tools.sh && \ + echo 'echo "Example run command:"' >> /opt/setup_tools.sh && \ + echo 'echo "docker run -v /path/to/PAGE:/opt/PAGE -v /path/to/TEISER:/opt/TEISER -v /path/to/data:/data pager"' >> /opt/setup_tools.sh && \ + chmod +x /opt/setup_tools.sh + +# Default command shows setup instructions +CMD ["/opt/setup_tools.sh"] \ No newline at end of file diff --git a/README.md b/README.md index e5f3cf0..4d56404 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,33 @@ Container of codes and data to run PAGE algorithm and enable further data curati ## Installation +**Option 1: Docker (Recommended)** + +The easiest way to use pager is with Docker. Build and run the container: + +```bash +# Build the Docker image +docker build -t pager . + +# Run with setup instructions +docker run pager + +# Run with your data mounted +docker run -v /path/to/your/data:/data -it pager /bin/bash + +# If you have iPAGE and TEISER installed locally +docker run -v /path/to/PAGE:/opt/PAGE -v /path/to/TEISER:/opt/TEISER -v /path/to/data:/data -it pager /bin/bash +``` + +Or use docker-compose: + +```bash +# Edit docker-compose.yml to mount your local directories +docker-compose run pager +``` + +**Option 2: Manual Installation** + **Requirements:** Follw the instructions to install iPAGE and TEISER from the following links: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..05d7bfe --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.8' + +services: + pager: + build: . + image: pager:latest + container_name: pager + volumes: + # Mount your local data directory + - ./data:/data + # Mount iPAGE and TEISER tools if available locally + # - /path/to/your/PAGE:/opt/PAGE + # - /path/to/your/TEISER:/opt/TEISER + working_dir: /data + environment: + - PAGEDIR=/opt/PAGE + - TEISERDIR=/opt/TEISER + # Override default command to start interactive shell + command: /bin/bash \ No newline at end of file diff --git a/docker_test.sh b/docker_test.sh new file mode 100755 index 0000000..9d8bcc9 --- /dev/null +++ b/docker_test.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Example script to test pager functionality in Docker container +# This script demonstrates basic pager module functionality + +echo "=== Pager Docker Container Test ===" +echo "" + +# Test Python import +echo "Testing Python environment..." +python3 -c " +import sys +sys.path.append('/opt/pager') +import pager +import pandas as pd +import os + +print('✓ Python 3 available') +print('✓ pager module imported successfully') +print('✓ pandas available:', pd.__version__) +print('✓ Working directory:', os.getcwd()) +" + +echo "" +echo "=== Environment Variables ===" +echo "PAGEDIR: $PAGEDIR" +echo "TEISERDIR: $TEISERDIR" + +echo "" +echo "=== Available Scripts ===" +ls -la /opt/pager/*.sh + +echo "" +echo "=== Test Data ===" +if [ -f "/opt/pager/test/input.txt" ]; then + echo "Test input data found:" + head -n 5 /opt/pager/test/input.txt + echo "... (showing first 5 lines)" +else + echo "No test data found in /opt/pager/test/" +fi + +echo "" +echo "=== Docker Container Ready ===" +echo "To get started:" +echo "1. Mount your data: docker run -v /path/to/data:/data pager" +echo "2. Mount iPAGE/TEISER tools for full functionality" +echo "3. Use 'python3 -c \"import pager; help(pager)\"' to explore the module" \ No newline at end of file From 05c860cdfbf256684bb14cacb13a1ceb1654d319 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:00:06 +0000 Subject: [PATCH 3/5] Improve Docker documentation and remove obsolete docker-compose version Co-authored-by: abearab <53412130+abearab@users.noreply.github.com> --- README.md | 30 +++++++++++++++++++++++++++--- docker-compose.yml | 2 -- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4d56404..e2cdc78 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,42 @@ docker build -t pager . # Run with setup instructions docker run pager -# Run with your data mounted +# Run with your data mounted (interactive shell) docker run -v /path/to/your/data:/data -it pager /bin/bash # If you have iPAGE and TEISER installed locally docker run -v /path/to/PAGE:/opt/PAGE -v /path/to/TEISER:/opt/TEISER -v /path/to/data:/data -it pager /bin/bash + +# Test the container functionality +docker run pager /opt/pager/docker_test.sh ``` -Or use docker-compose: +Or use docker-compose for easier management: ```bash # Edit docker-compose.yml to mount your local directories -docker-compose run pager +docker compose build +docker compose run pager + +# Or run specific commands +docker compose run pager python3 -c "import pager; help(pager)" +``` + +**Docker Examples:** + +```bash +# Run iPAGE analysis (assuming you have the tools mounted) +docker run -v /local/data:/data -v /local/PAGE:/opt/PAGE pager \ + bash /opt/pager/iPAGE_loop.sh /data/input.txt + +# Run Python pager functions +docker run -v /local/data:/data pager \ + python3 -c " +import sys; sys.path.append('/opt/pager') +import pager +df = pager.read_pvmatrix('/data/pvmatrix.txt') +print(df.head()) +" ``` **Option 2: Manual Installation** diff --git a/docker-compose.yml b/docker-compose.yml index 05d7bfe..07c3a3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: pager: build: . From 07db9e71ee6b50f6319ca745d70019b38bb66e4f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:00:53 +0000 Subject: [PATCH 4/5] Finalize Docker implementation - improve .dockerignore and validate complete functionality Co-authored-by: abearab <53412130+abearab@users.noreply.github.com> --- .dockerignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index baf434b..675165d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,5 @@ # Docker ignore file for pager .git -.gitignore __pycache__ *.pyc *.pyo @@ -10,6 +9,4 @@ env pip-log.txt pip-delete-this-directory.txt .ipynb_checkpoints -.DS_Store -README.md -LICENSE \ No newline at end of file +.DS_Store \ No newline at end of file From 4d6853e772fe3cbe89b113e4401f552fa3dbce40 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 Aug 2025 23:42:01 +0000 Subject: [PATCH 5/5] Update Docker implementation to use conda as described in README Co-authored-by: abearab <53412130+abearab@users.noreply.github.com> --- Dockerfile | 57 +++++++++++++++++++++++++++++++++----------------- README.md | 4 ++-- docker_test.sh | 6 +++--- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 977ff57..be00779 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,6 @@ ENV TZ=UTC # Install system dependencies RUN apt-get update && apt-get install -y \ - python3 \ - python3-pip \ perl \ wget \ curl \ @@ -18,16 +16,25 @@ RUN apt-get update && apt-get install -y \ gzip \ && rm -rf /var/lib/apt/lists/* -# Install Python dependencies -# Using system packages to avoid SSL issues in some environments -RUN apt-get update && apt-get install -y \ - python3-pandas \ - python3-numpy \ - python3-matplotlib \ - && rm -rf /var/lib/apt/lists/* +# Install Miniconda +RUN wget --no-check-certificate https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \ + bash miniconda.sh -b -p /opt/conda && \ + rm miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" -# Alternative: Install from PyPI (uncomment if pip works in your environment) -# RUN pip3 install --no-cache-dir pandas numpy matplotlib +# Initialize conda and create pager environment as described in README +RUN conda init bash && \ + conda config --set ssl_verify false && \ + conda tos accept --override-channels --channel defaults && \ + conda create -n pager -y && \ + echo "conda activate pager" >> ~/.bashrc + +# Install Python dependencies in the pager environment +RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \ + conda activate pager && \ + conda install -y pandas numpy matplotlib" # Create working directory WORKDIR /opt/pager @@ -35,16 +42,18 @@ WORKDIR /opt/pager # Copy pager code COPY . . -# Set up environment variables for iPAGE and TEISER -# These should be set when running the container or can be overridden -ENV PAGEDIR=/opt/PAGE -ENV TEISERDIR=/opt/TEISER +# Set up environment variables for iPAGE and TEISER using conda env config vars +# This follows the README conda setup instructions +RUN /bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && \ + conda activate pager && \ + conda env config vars set PAGEDIR=/opt/PAGE && \ + conda env config vars set TEISERDIR=/opt/TEISER" # Create directories for external tools -RUN mkdir -p $PAGEDIR $TEISERDIR +RUN mkdir -p /opt/PAGE /opt/TEISER # Make shell scripts executable -RUN chmod +x *.sh +RUN find . -name "*.sh" -exec chmod +x {} \; # Create a script to help users set up external dependencies RUN echo '#!/bin/bash' > /opt/setup_tools.sh && \ @@ -53,12 +62,22 @@ RUN echo '#!/bin/bash' > /opt/setup_tools.sh && \ echo 'echo "2. TEISER: https://github.com/hanig/TEISER"' >> /opt/setup_tools.sh && \ echo 'echo ""' >> /opt/setup_tools.sh && \ echo 'echo "Mount these tools into the container at:"' >> /opt/setup_tools.sh && \ - echo 'echo " - iPAGE: $PAGEDIR"' >> /opt/setup_tools.sh && \ - echo 'echo " - TEISER: $TEISERDIR"' >> /opt/setup_tools.sh && \ + echo 'echo " - iPAGE: /opt/PAGE"' >> /opt/setup_tools.sh && \ + echo 'echo " - TEISER: /opt/TEISER"' >> /opt/setup_tools.sh && \ echo 'echo ""' >> /opt/setup_tools.sh && \ echo 'echo "Example run command:"' >> /opt/setup_tools.sh && \ echo 'echo "docker run -v /path/to/PAGE:/opt/PAGE -v /path/to/TEISER:/opt/TEISER -v /path/to/data:/data pager"' >> /opt/setup_tools.sh && \ chmod +x /opt/setup_tools.sh +# Create entrypoint script that activates conda environment +RUN echo '#!/bin/bash' > /opt/entrypoint.sh && \ + echo 'source /opt/conda/etc/profile.d/conda.sh' >> /opt/entrypoint.sh && \ + echo 'conda activate pager' >> /opt/entrypoint.sh && \ + echo 'exec "$@"' >> /opt/entrypoint.sh && \ + chmod +x /opt/entrypoint.sh + +# Set the entrypoint to activate conda environment +ENTRYPOINT ["/opt/entrypoint.sh"] + # Default command shows setup instructions CMD ["/opt/setup_tools.sh"] \ No newline at end of file diff --git a/README.md b/README.md index e2cdc78..6d0a270 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ docker compose build docker compose run pager # Or run specific commands -docker compose run pager python3 -c "import pager; help(pager)" +docker compose run pager python -c "import pager; help(pager)" ``` **Docker Examples:** @@ -44,7 +44,7 @@ docker run -v /local/data:/data -v /local/PAGE:/opt/PAGE pager \ # Run Python pager functions docker run -v /local/data:/data pager \ - python3 -c " + python -c " import sys; sys.path.append('/opt/pager') import pager df = pager.read_pvmatrix('/data/pvmatrix.txt') diff --git a/docker_test.sh b/docker_test.sh index 9d8bcc9..af9dc20 100755 --- a/docker_test.sh +++ b/docker_test.sh @@ -8,14 +8,14 @@ echo "" # Test Python import echo "Testing Python environment..." -python3 -c " +python -c " import sys sys.path.append('/opt/pager') import pager import pandas as pd import os -print('✓ Python 3 available') +print('✓ Python available via conda') print('✓ pager module imported successfully') print('✓ pandas available:', pd.__version__) print('✓ Working directory:', os.getcwd()) @@ -45,4 +45,4 @@ echo "=== Docker Container Ready ===" echo "To get started:" echo "1. Mount your data: docker run -v /path/to/data:/data pager" echo "2. Mount iPAGE/TEISER tools for full functionality" -echo "3. Use 'python3 -c \"import pager; help(pager)\"' to explore the module" \ No newline at end of file +echo "3. Use 'python -c \"import pager; help(pager)\"' to explore the module" \ No newline at end of file