FROM ubuntu:20.04

LABEL maintainer="Mustafa Tekpinar <tekpinar@buffalo.edu>"
LABEL description="ESGEMME: Evolutionary and Structural Global Epistatic Model for predicting Mutational Effects."

WORKDIR /home/tekpinar/research/lcqb
ENV JET2_PATH=/home/tekpinar/research/lcqb/JET2
ENV ESGEMME_PATH=/home/tekpinar/research/lcqb/ESGEMME
COPY ./JET2/ ./JET2/
COPY ./naccess2.1.1 ./naccess2.1.1
COPY ./ESGEMME/esgemme.py ./ESGEMME/esgemme.py
COPY ./ESGEMME/pred.R ./ESGEMME/pred.R
COPY ./ESGEMME/computePred.R ./ESGEMME/computePred.R
COPY ./ESGEMME/default.conf ./ESGEMME/default.conf
COPY ./ESGEMME/data/ ./ESGEMME/data/
COPY ./ESGEMME/examples/ ./ESGEMME/examples/
COPY ./demust/ ./demust/

###################################################################
RUN apt-get update --fix-missing && \
apt-get install -y --no-install-recommends apt-utils &&\
apt-get install -y software-properties-common && \
apt-get install -y build-essential && \
apt-get install -y python3-dev && \
apt-get install -y python3-pip && \
apt-get install -y r-base r-base-core && \
apt-get install -y muscle && \
apt-get install -y dssp && \
apt-get install -y default-jre && \
apt-get install -y ncbi-blast+ && \
apt-get install -y nano && \
apt-get install -y less && \
apt-get install -y wget && \
apt-get install csh && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
###################################################################
RUN wget https://github.com/soedinglab/hh-suite/releases/download/v3.3.0/hhsuite-3.3.0-AVX2-Linux.tar.gz
RUN mkdir hhsuite
RUN mv hhsuite-3.3.0-AVX2-Linux.tar.gz hhsuite/

WORKDIR /home/tekpinar/research/lcqb/hhsuite
RUN tar xvfz hhsuite-3.3.0-AVX2-Linux.tar.gz
ENV PATH="/home/tekpinar/research/lcqb/hhsuite/bin:/home/tekpinar/research/lcqb/hhsuite/scripts:$PATH"
RUN rm -f hhsuite-3.3.0-AVX2-Linux.tar.gz


RUN ln -s /usr/bin/python3 /usr/bin/python
RUN pip3 install --no-cache-dir prody matplotlib scipy pandas biotite

WORKDIR /home/tekpinar/research/lcqb
RUN pip3 install -e ./demust/
RUN Rscript -e 'install.packages("seqinr", repos="http://cran.us.r-project.org", dependencies=TRUE)'

# Build command
# sudo docker build -t tekpinar/esgemme-docker:v1.3.0 .
# sudo docker login
# sudo docker push tekpinar/esgemme-docker:v1.3.0 

# Pull command on M1 Mac with macOS Monterey
# docker pull tekpinar/esgemme-docker:v1.3.0

# Run command on M1 Mac with macOS Monterey
# docker run -i -t -v $(pwd) --platform linux/amd64 tekpinar/esgemme-docker:v1.3.0 /bin/bash

# Bind your current folder to a particular folder in docker. 
# docker run -ti --rm --mount type=bind,source=$PWD,target=/home/tekpinar/research/myexample tekpinar/esgemme-docker:v1.3.0
