# Installation

TRiCoLOR is written in python 3 with supporting C++ scripts. It requires a working python 3 environment with gcc 4.8+ and cmake 3.2+ on a unix machine in order to be installed from source and run properly.

	 ______ ______  __  ______  ______  __      ______  ______    
	/\__  _/\  == \/\ \/\  ___\/\  __ \/\ \    /\  __ \/\  == \   
	\/_/\ \\ \  __<\ \ \ \ \___\ \ \/\ \ \ \___\ \ \/\ \ \  __<   
	   \ \_\\ \_\ \_\ \_\ \_____\ \_____\ \_____\ \_____\ \_\ \_\ 
	    \/_/ \/_/ /_/\/_/\/_____/\/_____/\/_____/\/_____/\/_/ /_/ v1.1

# Installation from source

A python 3 environment can be created using Anaconda and its minimal installer Miniconda. For the Ubuntu distro, for instance:

apt-get update && apt-get install -y curl git build-essential g++ cmake libz-dev libcurl4-openssl-dev libssl-dev libbz2-dev  liblzma-dev libncurses5-dev
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
cd ~ && source .bashrc
conda update -y conda
conda create -y -n tricolorenv python=3.8

Once the python 3 environment has been created, conda can be used to install the required dependencies. As from v1.1, TRiCoLOR only requires bedtools in PATH (as this is required by pybedtools). However, tools like samtools and bcftools are useful to browse TRiCoLOR's output files.

conda install -y -n tricolorenv -c bioconda bedtools
#get htslib (optional)
curl -LO https://github.com/samtools/htslib/releases/download/1.11/htslib-1.11.tar.bz2 && tar -vxjf htslib-1.11.tar.bz2 && cd htslib-1.11 && make && make install
#get samtools (optional)
curl -LO https://github.com/samtools/samtools/releases/download/1.11/samtools-1.11.tar.bz2 && tar -vxjf samtools-1.11.tar.bz2 && cd samtools-1.11 && make && make install
#get bcftools (optional)
curl -LO https://github.com/samtools/bcftools/releases/download/1.11/bcftools-1.11.tar.bz2 && tar -vxjf bcftools-1.11.tar.bz2 && cd bcftools-1.11 && make && make install

TRiCoLOR can then be cloned and installed.

conda activate tricolorenv
git clone --recursive https://github.com/davidebolo1993/TRiCoLOR
cd TRiCoLOR
./configure
python setup.py install
TRiCoLOR --help

# Docker container

For Docker users, TRiCoLOR is also available as a Docker container. One can pull the image and run this as below.

#will require sudo privileges, probably
docker pull davidebolo1993/tricolor
docker run davidebolo1993/tricolor TRiCoLOR --help
#or using an interactive tty to the docker container
docker run -ti davidebolo1993/tricolor 
#$(tricolorenv) TRiCoLOR --help