#Contemporary Migration analysis

#!/bin/bash

#We create a structure format file (.str) from the vcf in PGDSpider2.jar and then convert the .str to immanc file format 
#PGDSpider2 requires Java 8. If Java 8 is not your default version specifies which version of java you want to use

sudo update-alternatives --config java 
cd Documents/software/PGDSpider_2.1.1.3
java -Xmx1024m -Xms512m -jar PGDSpider2.jar


#Move to the BayesAss3-SNPs-master directory 
BA3-SNPS -h

#Run BayesAss3-SNPs-master. We specify here the parameters used for each regional and global scales 

BA3-SNPS -v -t -u -g -i10000000 -b1000000 -s1000 -a1 -f0.5 -m0.6 -F ./Path/Migration_PNLM.inp --loci 3711 -o ./Path/Out_PNLM.txt
BA3-SNPS -v -t -u -g -i10000000 -b1000000 -a0.7 -f0.5 -m0.5 -F ./Migration_ECLM.inp --loci 3500 -o ./Path/Out_ECLM.txt 
BA3-SNPS -v -t -u -g -i10000000 -b1000000 -a1 -f0.6 -m1 -F ./Path/Migration_CVM.inp --loci 2705 -o ./Path/Out_CVM.txt

