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

PRESCOTT is implemented in Python 3 and R. It has been tested only on
Linux. Since PRESCOTT 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:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

PRESCOTT 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/

    
After you installed JET2 define a parameter called JET2_PATH inside your .profile file.
You can open .profile as follows:

.. code:: bash

	  gedit ~/.profile

You should add a command like below to the end of that file, save and exit.

.. code:: bash
	  
	  export JET2_PATH=/home/tekpinar/JET2/

Please, do not forget to replace /home/tekpinar/JET2 with your own file path.

Then, source the saved .profile so that the environment variable will be taken into account:

.. code:: bash

	  source ~/.profile

JET2 is essential and it should be installed to be able to use PRESCOTT.

Preparation of the environment and installation of PRESCOTT
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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. 
Open .profile file with gedit:

.. code:: bash

	  gedit ~/.profile

Now, add the following line to the end of the file.

.. code:: bash
	  
	  PATH="/home/tekpinar/research/lcqb/hhsuite/bin:/home/tekpinar/research/lcqb/hhsuite/scripts:$PATH"

Of course, your path will not be /home/tekpinar/research/lcqb/ and you have to modify the path according to
your system. Save the file and exit. Then, 

.. code:: bash
	  
	  source ~/.profile

#

   cd PRESCOTT

#Download PRESCOTT from http://gitlab.lcqb.upmc.fr/tekpinar/PRESCOTT repository and go inside the PRESCOTT folder.!
You can download the master version using command line as follows:

.. code:: bash

	  git clone http://gitlab.lcqb.upmc.fr/tekpinar/PRESCOTT.git

If you would like the development version:

.. code:: bash
	  
	  git clone -b development http://gitlab.lcqb.upmc.fr/tekpinar/PRESCOTT.git
	  

.. code:: bash

   cd PRESCOTT

Configuring default.conf file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Inside PRESCOTT/esgemme folder, there is an important file called default.conf. 
This file contains essential parameters of PRESCOTT, 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




