Run Arlequin on command line

Abandoned runway in the Suwanose volcanic island (2015).

Today we can perform some population genetics analyses using Arlequin with command line. I don't have Windows PC but I was in need to use Arlequin. Thus, I tried to run Arlequin analyses on Terminal. Here is what I did.

1. .Download winarl35.zip (for Windows) from a web site. Arlecore for Mac (arlecore_macosx.zip) did not work in my Mac.

2. Unzip the file.

unzip winarl35.zip

3. Install Wine to execute the Windows application.

brew install --cask --no-quarantine wine-stable

4. Generate .arp file (input file for Arlequin containing sequence/genotype/haplotype/population-assignment etc) from a fasta-formatted file using terminal command line.

fn="something.fas" # define fasta file name


ofn=`echo ${fn} | sed -e 's/.fas/.arp/g'`


samplesize=`grep ">" ../${fn} | grep -v "MN057103\|NC042213\|KJ930190"|wc -l | sed -e 's/ //g'`


echo -e "[Profile]\nTitle=\"data\"\nNBSamples=1\nDataType=DNA\nGenotypicData=0\nLocusSeparator=NONE\nMissingData='?'\n" > $ofn


echo -e "[Data]\n[[Samples]]\nSampleName=\"1\"\nSampleSize=${samplesize}\nSampleData={" >> $ofn


cat ../Fasta-All_fromAlam7.fas | tr "\n" " " | tr ">" "\n" | tail -n+2 | grep -v "MN057103\|NC042213\|KJ930190" | sed -e 's/-/?/g' | awk 'BEGIN{FS=" ";OFS="\t"}{print $1,"1",$2}' >> $ofn


echo -e "}\n\n[[Structure]]\nStructureName=\"Test\"\nNbGroups=1\nGroup={\n\"1\"\n}" >> $ofn

5. Generate .ars file (input file for Arlequin containing setting for analyses). In .arp, you can chose which test(s) to be performed by specifying TaskNumber.

#STANDARD INDICES: +1

#MOLECULAR DIVERSITY: +2

#MISMATCHDISTRIBution: +4

#HAPLOTYPE FREQUENCIES: +8

#TAJIMA'S TEST: +64

#EWENS-WATTERSON'S TEST: +128

#CHAKRABORTY'S TEST: +256

#AMOVA: +512

Each kind of tests has unique number, and specify the number as TaskNumber. For example, to perform AMOVA, specify TaskNumber=512.

If you want to perform multiple tests, use sum of test number as TaskNumber. For example, if you want to perform Tajima's test and AMOVA, use TaskNumber=576 that is 64+512.

In my case, I use an example .ars file with modifying TaskNumber.

cat ..../WinArl35/Example\ files_win/Neut_tst/mtDNAHV1.ars | sed -e 's/TaskNumber=0/TaskNumber=975/g' -e 's/MismatchDemogExp=0/MismatchDemogExp=1/g' -e 's/MismatchSpatialExp=0/MismatchSpatialExp=1/g'> mtDNAHV1_mod.ars

6. Run Arlequin with Wine

wine64 /PATH/TO/arlecore64.exe /PATH/TO/*.ars /PATH/TO/*.arp

Then, some output files will be generated in the current directory.