diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 2d90cb65..af777408 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -1,9 +1,13 @@ -name: AlphaPulldown-github-CI +name: AlphaPulldown-CI-CD -on: [pull_request, push] +on: + pull_request: + push: + release: + types: [published] jobs: - build: + build-and-test: runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -14,32 +18,24 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: recursive - - name: Debug List Directory - run: ls -la -R - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + submodules: recursive + - run: ls -la -R + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: "pip" - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Add Conda to System Path - run: | - pwd + - run: python -c "import sys; print(sys.version)" + - run: | echo $CONDA/bin >> $GITHUB_PATH echo "$GITHUB_WORKSPACE/alphapulldown" >> $GITHUB_PATH - - name: Install AlphaPulldown for user - if: matrix.install-type == 'user' + - if: matrix.install-type == 'user' run: | conda create -n AlphaPulldown -c omnia -c bioconda -c conda-forge python==${{ matrix.python-version }} openmm==8.0 pdbfixer==1.9 kalign2 cctbx-base pytest importlib_metadata eval "$(conda shell.bash hook)" conda activate AlphaPulldown conda install -c bioconda hmmer hhsuite pip install alphapulldown - - - name: Install AlphaPulldown for developer - if: matrix.install-type == 'developer' + - if: matrix.install-type == 'developer' run: | conda create -n AlphaPulldown -c omnia -c bioconda -c conda-forge python==${{ matrix.python-version }} openmm==8.0 pdbfixer==1.9 kalign2 cctbx-base pytest importlib_metadata eval "$(conda shell.bash hook)" @@ -49,43 +45,51 @@ jobs: pip install -e ColabFold --no-deps pip install -e alphafold --no-deps python test/test_python_imports.py - - - name: Install dependencies in AlphaLink2 setup.py - run: | - eval "$(conda shell.bash hook)" - export WORKDIRPATH=$PWD - conda activate AlphaPulldown - cd $WORKDIRPATH/AlphaLink2 && python3 setup.py install - - - name: Install dependencies in AlphaFold setup.py - run: | - eval "$(conda shell.bash hook)" - export WORKDIRPATH=$PWD - conda activate AlphaPulldown - pip install protobuf==4.23.0 ml-dtypes==0.2.0 - pip install jax==0.4.23 jaxlib==0.4.23+cuda11.cudnn86 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html - - - name: Install Pytorch Dependencies - run: | - eval "$(conda shell.bash hook)" - conda activate AlphaPulldown - #pip install torch --pre -f https://download.pytorch.org/whl/nightly/cu121/torch_nightly.html - - - name: Check imports of submodules - run : | - eval "$(conda shell.bash hook)" - conda activate AlphaPulldown - #pip install torch --pre -f https://download.pytorch.org/whl/nightly/cu121/torch_nightly.html - #git clone https://github.com/dptech-corp/Uni-Core.git - #cd Uni-Core - #python3 setup.py install --disable-cuda-ext - python -c "from colabfold.batch import get_queries, unserialize_msa, get_msa_and_templates, msa_to_str, build_monomer_feature, parse_fasta" - - - name: Run Tests - if: matrix.install-type == 'developer' + - if: matrix.install-type == 'developer' run: | eval "$(conda shell.bash hook)" conda activate AlphaPulldown pytest -s test/test_custom_db.py - # pytest -s test/test_features_with_templates.py pytest -s test/test_remove_clashes_low_plddt.py + + build-fold-container: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push fold container + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/pulldown.dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/fold:${{ github.event.release.tag_name }} + + build-analysis-container: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push analysis container + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/analysis.dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/fold_analysis:${{ github.event.release.tag_name }} diff --git a/docker/analysis.dockerfile b/docker/analysis.dockerfile new file mode 100644 index 00000000..50327049 --- /dev/null +++ b/docker/analysis.dockerfile @@ -0,0 +1,15 @@ +FROM geoffreyyu/alpha_analysis_basis_jax0.4:latest + +RUN mkdir -p /app/alpha-analysis/ +COPY alphapulldown/analysis_pipeline/*sh /app +COPY alphapulldown/analysis_pipeline/*py /app/alpha-analysis/ + +RUN chmod +x /app/run_get_good_pae.sh \ + && chmod +x /app/run_execute_notebook.sh \ + && chmod +x /app/run_pi_score.sh \ + && chmod +x /app/alpha-analysis/get_good_inter_pae.py + +ENV PATH="/app/alpha-analysis:$PATH" \ + PYTHONPATH="/app:$PYTHONPATH" + +ENTRYPOINT [ "bash" ] \ No newline at end of file diff --git a/docker/pulldown.dockerfile b/docker/pulldown.dockerfile new file mode 100644 index 00000000..ea568d5a --- /dev/null +++ b/docker/pulldown.dockerfile @@ -0,0 +1,82 @@ +# Copyright 2021 DeepMind Technologies Limited +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Extended by Valentin Maurer + +ARG CUDA=11.8.0 +FROM nvidia/cuda:${CUDA}-cudnn8-runtime-ubuntu20.04 +ARG CUDA + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + build-essential \ + cmake \ + cuda-command-line-tools-$(cut -f1,2 -d- <<< ${CUDA//./-}) \ + git \ + hmmer \ + kalign \ + tzdata \ + wget \ + bc \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get autoremove -y \ + && apt-get clean + +RUN git clone --branch v3.3.0 https://github.com/soedinglab/hh-suite.git /tmp/hh-suite \ + && mkdir /tmp/hh-suite/build \ + && pushd /tmp/hh-suite/build \ + && cmake -DCMAKE_INSTALL_PREFIX=/opt/hhsuite .. \ + && make -j 4 && make install \ + && ln -s /opt/hhsuite/bin/* /usr/bin \ + && popd \ + && rm -rf /tmp/hh-suite + +RUN wget -q -P /tmp \ + https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ + && bash /tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \ + && rm /tmp/Miniconda3-latest-Linux-x86_64.sh + +ENV PATH="/opt/conda/bin:$PATH" +ENV LD_LIBRARY_PATH="/opt/conda/lib:$LD_LIBRARY_PATH" +RUN conda install -y -c conda-forge -c bioconda \ + openmm==8.0 \ + cudatoolkit==${CUDA_VERSION} \ + pdbfixer==1.9 \ + cctbx-base \ + kalign2 \ + importlib_metadata \ + pip \ + python=3.10 \ + && conda clean --all --force-pkgs-dirs --yes + +RUN conda install -y -c nvidia cuda-nvcc + +COPY . /app/alphafold +RUN wget -q -P /app/alphafold/alphafold/common/ \ + https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt + +RUN pip3 install --upgrade pip --no-cache-dir \ + && pip3 install --upgrade --no-cache-dir \ + -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple \ + alphapulldown==2.0.0b2 \ + pytest \ + jax==0.4.23 \ + jaxlib==0.4.23+cuda11.cudnn86 \ + -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html + +RUN chmod u+s /sbin/ldconfig.real + +ENTRYPOINT ["bash"] \ No newline at end of file