Installation
------------

ESGEMME is implemented in Python 3 and R. It has been tested only on
Linux. Since ESGEMME has many dependencies, we recommend using our web
site or our docker image. If you are a determined user, here comes the
steps required to install it from the source.

Installing the dependencies:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ESGEMME has the following external dependencies:

* Joint Evolutionary Trees: http://www.lcqb.upmc.fr/JET2/ and its dependencies:

  * java
  * naccess: http://www.bioinf.manchester.ac.uk/naccess/
  * muscle: https://www.drive5.com/muscle/

* seqinr R package: https://cran.r-project.org/web/packages/seqinr/index.html
* dssp for secondary structure prediction.

These tools should be installed to be able to use ESGEMME.

Preparation of the environment and installation of ESGEMME
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Step by step installation on Ubuntu 22.04

Prepare your environment and install the required packages:

.. code:: bash

   sudo apt-get update --fix-missing && \
   sudo apt-get install -y --no-install-recommends apt-utils && \
   sudo apt-get install -y software-properties-common && \
   sudo apt-get install -y autotools-dev && \
   sudo apt-get install -y automake && \
   sudo apt-get install -y build-essential && \
   sudo apt-get install -y python3-dev && \
   sudo apt-get install -y python3-pip && \
   sudo apt-get install -y r-base r-base-core && \
   sudo apt-get install -y muscle && \
   sudo apt-get install -y default-jre && \
   sudo apt-get install -y ncbi-blast+ && \
   sudo apt-get install -y nano && \
   sudo apt-get install -y less && \
   sudo apt-get install -y wget && \
   sudo apt-get install csh && \
   sudo apt-get install -y hmmer && \
   sudo apt-get install -y libboost-all-dev && \
   sudo apt-get clean && \
   sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


#Dssp installation
If you are using Ubuntu 20.04, you can install dssp by the following command
.. code:: bash

   sudo apt-get install dssp

Otherwise, you can install it from the source by the following commands. 
Please note that default dssp in Ubuntu 22.04 is not working properly.
.. code:: bash

   wget https://github.com/cmbi/dssp/archive/refs/heads/master.zip   && \
   unzip -o master.zip && cd dssp-master/  && \
   ./autogen.sh && \
   ./configure && \
   make && \
   sudo make install && \
   sudo ln -s /usr/local/bin/mkdssp /usr/local/bin/dssp && \
   cd ../ && \
   sudo rm -rf dssp-master/ && \
   sudo rm -f master.zip

#HHSUITE installation
.. code:: bash

   wget https://github.com/soedinglab/hh-suite/releases/download/v3.3.0/hhsuite-3.3.0-AVX2-Linux.tar.gz && \
   mkdir hhsuite && \
   mv hhsuite-3.3.0-AVX2-Linux.tar.gz hhsuite/ && \
   cd hhsuite && \
   tar xvfz hhsuite-3.3.0-AVX2-Linux.tar.gz && \
   rm -f hhsuite-3.3.0-AVX2-Linux.tar.gz

#Add it to your path permanently inside .bashrc or .profile or .bash_profile
Check the location of hhsuite folder and add it to your path
In my case it was in /home/tekpinar/research/lcqb folder. Therefore, I added the following line
to my .profile file. 
PATH="/home/tekpinar/research/lcqb/hhsuite/bin:/home/tekpinar/research/lcqb/hhsuite/scripts:$PATH"

Then
source ~/.profile

#

   cd ESGEMME

#Download ESGEMME from http://gitlab.lcqb.upmc.fr/tekpinar/ESGEMME repository and go inside the ESGEMME folder.!
.. code:: bash

   cd ESGEMME

Configuring default.conf file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Inside ESGEMME/esgemme folder, there is an important file called default.conf. 
This file contains essential parameters of ESGEMME, such as paths of
external parts, default internal parameters. etc. You have to correct the Software section of this
file according to your system.

.. code:: bash

   pip3 install -e . &&\
   cd ../

#Installing the required R packages
.. code:: bash

   sudo Rscript -e 'install.packages("seqinr", repos="http://cran.us.r-project.org", dependencies=TRUE)'

#Installing secondary programs such as ev_couplings to obtain MSA files.

.. code:: bash
   
   wget https://github.com/debbiemarkslab/plmc/archive/refs/heads/master.zip && \
   unzip -o master.zip && \
   cd plmc-master && \
   make all-openmp32 && \
   sudo cp bin/plmc /usr/local/bin/ && \
   cd ../ && \
   rm -rf master.zip plmc-master




