Sign inSign up

jysgro/colabfold

By jysgro

Updated almost 2 years ago

Colab version of AlphaFold 2.3.2 within a container image

Image
Data science
2

7.0K

jysgro/colabfold repository overview

Attempt to create a container from instructions at https://github.com/YoshitakaMo/localcolabfold

A container has to be Linux-based. But added some brew commands from the Mac installation.

From experience documented in OLD NOTES below, the image was created once more in a single step.

Run on local computer with: docker run -it --rm jysgro/colabfold:ub22.04_up

Once in the container, get help with: colabfold_batch --help

Submit file

To run on HTCondor at University of Wisconsin–Madison The Center for High Throughput Computing (CHTC.)

universe = Docker
docker_image = jysgro/colabfold:ub22.04_up
executable = colabfold.sh
transfer_input_files=colabfold.sh, test.fa, hemoglobin-colab.fa
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
# CHTC requirements for GPU
requirements = (HasGpulabData == true)
request_GPUs = 1
+WantGPULab = true
request_memory = 96 GB
request_disk = 180 GB
request_cpus = 4

output = colabfold2.out
error = colabfold2.err
log = colabfold2.log

queue

Script file

Minimal script file:

#!/bin/bash
export HOME="/home/linuxbrew"
mkdir output
mkdir cache
export XDG_CACHE_HOME=./cache
export MPLCONFIGDIR=./cache

export PATH=/home/linuxbrew/localcolabfold/conda/bin:$PATH
sh /home/linuxbrew/localcolabfold/conda/bin/conda init
source $HOME/.bashrc
sh /home/linuxbrew/localcolabfold/conda/bin/conda activate /home/linuxbrew/localcolabfold/colabfold-conda

python -m colabfold.download
colabfold_batch --amber --templates --num-recycle 3 --use-gpu-relax  test.fa output
tar cvf output.tar output
gzip output.tar
rm *64
echo DONE
Test sequence

Minimal sequence to test, with Glucagon sequence

>test_peptide 1gcn
HSQGTFTSDYSKYLDSRRAQDFVQWLMNT

NOTE: hemoglobin-colab.fa would be a multimer. In Colab multimer sequences are separated by a COLON (:) with a single > FastA name line.

hemoglobin-colab.fa colab format.

>hemoglobineA+B
MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHGKKVADALTNA
VAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAHLPAEFTPAVHASLDKFLASVSTVLTSK
YR:
MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLG
AFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVAN
ALAHKYH:
MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHGKKVADALTNA
VAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAHLPAEFTPAVHASLDKFLASVSTVLTSK
YR:
MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLG
AFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVAN
ALAHKYH

New Dockerfile combining previous:

FROM --platform=linux/amd64 homebrew/brew:latest
# Currently under OS:
# PRETTY_NAME="Ubuntu 22.04.5 LTS"
# VERSION="22.04.5 LTS (Jammy Jellyfish)"
# VERSION_CODENAME=jammy

# Today date: 2024-10-25

# From Mac instructions:
RUN brew install wget gnu-sed nano
RUN brew install brewsci/bio/hh-suite brewsci/bio/kalign

WORKDIR /home/linuxbrew/
RUN wget https://raw.githubusercontent.com/YoshitakaMo/localcolabfold/main/install_colabbatch_linux.sh && \
    bash install_colabbatch_linux.sh
ENV PATH "/home/linuxbrew/localcolabfold/colabfold-conda/bin:$PATH"

# Fix issues
# drwxr-x--- 1 linuxbrew linuxbrew 4096 Oct 24 21:22 /home/linuxbrew/

RUN chmod a+rx /home/linuxbrew/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/conda/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/conda/bin

RUN /home/linuxbrew/localcolabfold/conda/bin/conda init
RUN sh /home/linuxbrew/.bashrc
# Run update file added within /home/linuxbrew/localcolabfold
RUN cd /home/linuxbrew/localcolabfold && sh update_linux.sh
CMD ["/bin/bash"]

OLD NOTES BELOW

OLD IMAGES HAVE BEEN DELETED TO SAVE SPACE


EARLY NOTES

FOR REFERENCE ONLY - Follow notes above for usage.

Run with: docker run -it --rm jysgro/colabfold:user_amd64

Still need to do this:

export PATH=/home/linuxbrew/localcolabfold/conda/bin:$PATH
conda init
source ~/.bashrc
conda activate /home/linuxbrew/localcolabfold/colabfold-conda

# THEN: 
# colabfold_batch --help
# BUT hangs on Mac.

TO DO: test on Linux cluster with HTCondor

Dockerfiles

The creation of the first version took a long time and had a few permissions problems. Mostly this one: permission for "other" was set as --- and made the directory unreadble in the context of HTCondor which runs the container as an unprivileged user, hence not the linuxbrew user nor the linuxbrew group. I assume these settings were inherited from the FROM image.

drwxr-x--- 1 linuxbrew linuxbrew 4096 Oct 24 21:22 linuxbrew/
drwxr-x--- 1 linuxbrew linuxbrew 4096 Oct 24 21:22 /home/linuxbrew/

THEREFORE SECOND Dockerfile below simply fixes these issues.

Dockerfile 1: install colabfold
FROM --platform=linux/amd64 homebrew/brew:latest
# Today date: 2024-10-23

# From Mac instructions:
RUN brew install wget gnu-sed nano
RUN brew install brewsci/bio/hh-suite brewsci/bio/kalign

WORKDIR /home/linuxbrew/
RUN wget https://raw.githubusercontent.com/YoshitakaMo/localcolabfold/main/install_colabbatch_linux.sh && \
    bash install_colabbatch_linux.sh
ENV PATH "/home/linuxbrew/localcolabfold/colabfold-conda/bin:$PATH"
CMD ["/bin/bash"]
Dockerfile 2: fix the problems in the previous image. Save only this version and cross fingers...

Of note the conda activate cannot be performed while building the container: CondaError: Run 'conda init' before 'conda activate' but modifying to: UN conda init && conda activate /home/linuxbrew/localcolabfold/colabfold-conda Does not fix it.

FROM --platform=linux/amd64 jysgro/colabfold:user_amd64
# Fix issues
# drwxr-x--- 1 linuxbrew linuxbrew 4096 Oct 24 21:22 linuxbrew/
# drwxr-x--- 1 linuxbrew linuxbrew 4096 Oct 24 21:22 /home/linuxbrew/

RUN chmod a+rx /home/linuxbrew/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/conda/ &&\
    chmod a+rx /home/linuxbrew/localcolabfold/conda/bin

ENV PATH "/home/linuxbrew/localcolabfold/conda/bin:$PATH"
RUN /home/linuxbrew/localcolabfold/conda/bin/conda init
RUN sh /home/linuxbrew/.bashrc

Tag summary

Content type

Image

Digest

sha256:f1cd88cd2

Size

16.3 GB

Last updated

almost 2 years ago

docker pull jysgro/colabfold