-----------------
Master Script to perform haplotyping and imputation analysis
-----------------
Original Author: Thiago Peixoto Leal
Description: This Masterscript peform haplotyping and imputation analysis (including creating and merging panels).
Dependencies:
				Perl interpreter
Parameters:
	-input: File with data description
	-output: Folder where results will be saved 
	-path: File with programs path
	-start: First chromossome of interval
	-end: Last chromossome of interval
	-seed: Seed of shapeit (optional)
	-states: States of shapeit (optional)
	-bed: This option tells the algorithm that the data is in the bed/bim/fam format (ped/map is the default)


This script use 2 files formated by the user:
	Command file (-input flag)
	Path file (-path flag)

=====================================================================================================================================================

Command File:

All files with a chromosome number can change the number by *

The comand file has this parameters:
	#Database: This parameter tells you which name you want to use and where the files are present
	
#Database
%DatabaseToCreatePanel	/home/user/MyDataToCreatePanel_chr*
%DatabaseToImpute	/home/user/MyDataToImpute_chr*

	#GeneticMap: This parameter indicates the location of the genetic map

#GeneticMap
%GeneticMap	/home/user/geneticMap/myGeneticMap*PhaseX

	#Legend: This parameter indicates the location of legend file

#Legend
%Panel1	/home/user/panel1/panel1*.legend
%Panel2	/home/user/panel2/panel2*.legend

	#Sample: This parameter indicates the location of sample file

#Sample
%Panel1	/home/user/panel1/panel1*.sample
%Panel2	/home/user/panel2/panel2*.sample

	#Haplotypes: This parameter indicates the location of .hap file
	
#Haplotypes
%Panel1	/home/user/panel1/panel1*.hap
%Panel2	/home/user/panel2/panel2*.hap

	#Create: This parameter tells the algorithm which panels it should create. If you want two
		 panels you should put the name of two panels with a + between them. Our Script merge
		 two panels at a time

#Create
%DatabaseToCreatePanel
%DatabaseToCreatePanel+Panel1
%DatabaseToCreatePanel+Panel1+Panel2

	#Panels: This parameter tells the algorithm which panels it should use for imputation

#Panels
%DatabaseToCreatePanel+Panel1

	#PrePhased: This parameter tells the algorithm that the base is already phased. This parameter can not be setted with #Phase

	#Phase: This parameter tells the algorithm which panel should be used to phase the target. This parameter can not be setted with #PrePhase

#Phase
%DatabaseToCreatePanel

	#OnlyPhase: This parameter tells the algorithm that it must execute the algorithm until the step of phasing data. This parameter can not be setted with #Impute

	#Impute: This parameter tells the algorithm which database it should impute. This parameter can not be setted with #OnlyPhase

#Impute
%DatabaseToImpute

	#Chunk: This parameter tells the algorithm the size of the chunk to be used

#Chunk
7000000

	#Interval: This parameter tells the algorithm which interval is to be imputed

#Interval
12 8099632




Obs: 
The parameter PrePhased and Phase can not be setted together.
The parameter OnlyPhase and Impute can not be setted together.
If Chunk parameter is empty, the algorithm will impute the whole chromossome (or the whole interval, if specified) in one run. 
if imputing large chromosomes, it is recommended to use chunk. See IMPUTE2 documentation (https://mathgen.stats.ox.ac.uk/impute/impute_v2.html#whole_chroms).
If Interval parameter is empty, the algorithm will impute the whole chromossome.


=====================================================================================================================================================

Path File:

This file describes where is the programs. Example:

#Shapeit
/home/user/programs/shapeit

#Plink
/home/user/programs/plink

#Impute2
/home/user/programs/impute2



