# The name of the download file may change due to version updates, etc. Please change as appropriate.

#####install phylip#####
$ wget https://phylipweb.github.io/phylip/download/phylip-3.697.tar.gz
$ tar xf phylip-3.697.tar.gz
$ cd phylip-3.697
$ cd src/
$ cp Makefile.unx Makefile
$ make install
# If you receive a "multiple definition of ~" error, please modify the Makefile as follows.
CFLAGS = -z muldefs

#####install primer3#####
$ wget https://downloads.sourceforge.net/project/primer3/primer3/2.3.7/primer3-2.3.7.tar.gz
$ tar xf primer3-2.3.7.tar.gz
$ cd primer3-2.3.7
$ cd src/
$ make
# If you receive a "ISO C++ forbids comparison between pointer and integer" error, please modify the Makefile as follows.
CC_OPTS    = -g -Wall -D__USE_FIXED_PROTOTYPES__ -fpermissive

#####install MFEprimer3#####
$ wget https://github.com/quwubin/MFEprimer-3.0/releases/download/v3.2.7/mfeprimer-3.2.7-linux-amd64.gz
$ gzip -d mfeprimer-3.2.7-linux-amd64.gz
$ chmod +x mfeprimer-3.2.7-linux-amd64
$ cp ~/tasuke_sample_data/reference.fasta(the path of your reference genome) ./
$ ./mfeprimer-3.2.7-linux-amd64 index -i reference.fasta

###install complete if these files is created as below,
###(your reference genone name).fai
###(your reference genone name).json
###(your reference genone name).log
###(your reference genone name).primerqc
###(your reference genone name).primerqc.fai

#####[Old version] install MFEprimer2#####
# [Note] Both MFEprimer2 and MFEprimer3 can be used, but we recommend using MFEprimer3 above.
$ curl -kL https://bootstrap.pypa.io/get-pip.py  | python
$ sudo yum install python-devel unzip
$ sudo pip install psutil
$ wget https://github.com/quwubin/MFEprimer-2.0/zipball/master
$ unzip master
$ mv quwubin-MFEprimer-2.0-bf1a801 MFEprimer
$ cd MFEprimer/
$ cp ~/tasuke_sample_data/reference.fasta(the path of your reference genome) ./
$ sh IndexDb.sh reference.fasta(your reference genome)

###install complete if these files is created as below,
###(your reference genone name).2bit
###(your reference genone name).sqlite3.db
###(your reference genone name).uni

#####install blast+#####
$ wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.15.0/ncbi-blast-2.15.0+-x64-linux.tar.gz
$ tar zxf ncbi-blast-2.15.0+-x64-linux.tar.gz
$ cd ncbi-blast-2.15.0+
$ mkdir reference
$ cd reference/
$ cp ~/tasuke_sample_data/reference.fasta(or the path of your reference genome) ./
$ ../bin/makeblastdb -in reference.fasta(or your reference genome name) -dbtype nucl -hash_index

install complete if these files is created as below,
(your reference genome name).nhd
(your reference genome name).nhi
(your reference genome name).nhr
(your reference genome name).nin
(your reference genome name).nog
(your reference genome name).nsd
(your reference genome name).nsi
(your reference genome name).nsq


#####install phenotype data in your tasuke#####
$ tar xf tasuke-plus.tar
##install your data according to http://tasuke.dna.affrc.go.jp/installation.html
$ perl ~/tasuke-plus/tasuke_bin/tasuke_phenotype.pl -u root -db tasuke_gwas -t /var/www/html/tasuke_www/
Enter db password:
> Where is phenotype data csv file?
(File format: Breed Name,Phenotype,[1|0])
# phenodata.csv
> Use qqman output file? [y/N] ### When you have qqman output file,you can use.
#
(just a moment)
> Import papers data? [y/N] # 
# 
Done.

#####create distance matrix for System phylogenetic tree#####
##Before doing the following, install your genome/variant/depth data according to http://tasuke.dna.affrc.go.jp/installation.html
$ perl ~/tasuke-plus/tasuke_bin/tasuke_tree_dmatrix.pl -db <database name> -u <user> -p <password> -a -o <outfile>
(Depending on scale of the dataset, it may take tens of minutes to hours.)

#####create newick for System phylogenetic tree#####
##This procedure requires a "TASUKE environment in which the distance matrix is set and is operating normally".
$ cd <taske_www dir>/bin
$ php getNewick.php -d > <outfile>
(Depending on scale of the dataset, it may take several minutes to several tens of minutes.)

#####edit tasuke config#####
$ sudo cp -r tasuke_www/ /var/www/html/
$ cd /var/www/html/tasuke_www/conf
$ sudo vi config.php
###Primer3　PATH###
$primer3Path="/PATH/src/primer3_core"; ###enter the absolute path of your installing primer3 in 'PATH'
$primer3ThermPath="/PATH/src/primer3_config/"; ###enter the absolute path of your installing primer3 in 'PATH'

###MFEprimer PATH###
$MFEpath="/PATH/MFEprimer.py"; ###enter the absolute path of your installing MFEprimer in 'PATH'

###MFEprimer ReferenceDB PATH###
$MFEDBpath="/PATH/reference.fasta"; ###enter the absolute path of your installing MFEprimer in 'PATH'

###PHYLIP directory###
$phylipDir="/PATH/"; ###enter the absolute path of your installing phylip in 'PATH' (Does not include the "exe" subdirectory)

###BLAST PATH###
$blastPath="/PATH/bin/blastn"; ###enter the absolute path of your installing blast+ in 'PATH'

###BLASTDB PATH###
$blastDBPath="/PATH/reference.fasta"; ###enter the absolute path of your installing blast+ in 'PATH'

###Distance matrix file PATH for System phylogenetic tree###
$distanceMatrixPath = "PATH";	###enter the absolute 'PATH' of your Distance matrix file

###Newick file PATH for System phylogenetic tree###
$newickPath = "PATH";	###enter the absolute 'PATH' of your Newick file

