--------------
Migrate 4.2.6
--------------
Released Janaury 2016

Quick installation guide 
------------------------
- Unpack the compressed distribution file
- Macos, Unix binary distributions: move the migrateshell.app to your /Applications folder
- Source files: configure; make
  - if you have openmpi installed: make mpis
  - then move the binary into a directory that is searched by your system  

Content
-------
- Overview
- Analyses summary
- Computer systems
- History of MIGRATE
- Distribution
- Installation
- Documentation
- Example folder
- Troubleshoothing
- Disclaimer


Migrate estimates population parameters, effective population sizes
migration rates and divergence times of n populations, using genetic data.  
It uses a coalescent theory approach taking into account history of 
mutations and uncertainty of the genealogy. 

The estimates of the parameter values are achieved by Bayesian inference (BI).
The output is presented in an TEXT file _and_ in a PDF file. The PDF file
contains all currently main tables, posterior histograms (BI) and 
skylineplots are supported in the PDF.

If you fail to see all plots in the outfile PDF, consider to use a 
non-adobe PDF reader. Recent Adobe Reader fails on some output files 
reporting empty histograms; other PDF-readers such as Preview.app on 
mac or Nitro PDF reader are fine.


 
Currently the following data types are supported:
-DNA sequence data
 - finite sites model: Tamura-Nei and all models that can be 
   expressed as a subset of Tamura-Nei
 - finite sites model + rate variation among sites: TN + Gamma

-SNP data (single nucleotide polymorphism)
 - SNP are derived from sampled sequences and are completely linked
   except that we know that the sites are variable, with resequencing project data
   I suggest NOT to use SNPS but the full sequences, the Bayes factor methods allows
   to break down into independent loci easily. 

-Microsatellite data 
 - Brownian motion model: a continuous approximation to the stepwise mutation model.
 - stepwise mutation model (if you want to finish your work in this century do not use))
 -Electrophoretic marker data (infinite allele model).


Analyses
--------
IMPORTANT: support will cease for approaches with *, approaches with ** are
currently not supported (and often have an alternative)

- Estimation of population sizes and migration rates of a migration matrix
  model, or arbitrarily subsets of a migration matrix model, or an n-island
  model. Allowing for a geographic distance matrix so that effects geographic
  can be removed out of the analysis.
- Marginal likelihood calculation to assist calculation of Bayes Factor (BI)
- Allows a variable mutation rate AMONG loci estimated from the data.
- For sequences: allows a variable substitution rate among sites.
- For microsatellites: allows the definition of repeatnumber and use of fragment length as input
- Facilitates analyses of multimodal search space distributions with heating
  scheme and/or multi-run analyses.
- Histogram of events over time 
- Plot of expected parameters through time (skyline plots) for all parameters. 
- Dated samples
- Relabeling and merging of populations
- Random subset of individuals per population
- Assignment of indiviudals to populations (population number needs to be known)
- Haplotype assignment (for small numbers of different haplotypes) and integration over all
  potential haplotype


Computer systems
----------------
You can fetch Migrate from the website http://popgen.sc.fsu.edu 
as source code or binary executables. Currently I supply binaries for

- Macintosh 
  - Macintosh Intel:    migrate-n
                        migrateshell.app (includes migrate-n and fastmigrate-n)
- Windows: migrate-n.exe 
           migrate-n-mpi.exe 
           (to run migrate-n-mpi.exe you will need to install openmpi [version 1.6])

The source code should compile on all platforms (windows may be tricky)

The file is compressed as tar.gz or as zip file.
 	
The documentation contains information about
how to compile and use a parallelized version of migrate 
so that it can run concurrently on computer clusters
(using MPI [preferrably OpenMPI]).


History about bug fixes and new features
----------------------------------------
read the HISTORY file.

Distribution
------------
Migrate can be fetched from the www-site 
http://popgen.sc.fsu.edu/ 


Installation
------------

(a) Binaries
Unpack the compressed archive, open the directory migrate-4.1.0a
- Mac: in the Finder copy migrateshell.app to the /Applications folder
  (double clicking the migrateshell.app will open a terminal window
  set the internals so that you can run migrate-n and also fastmigrate-n
  [although this may not work on the first try because additional software
  needs to be installed (follow the online instructions). There is also a migrate-n
  binary in the folder that can be used, but it would be best if you place that into
  a location like /usr/local/bin (and then adjust your search path to access it).
- Windows: the preferred way to use migrate-n.exe is through the commandline 
  environment.
- UNIX: I suggest to use the source distribution to make the best use of your system

Download the program and read the documentation and try the program
on a small [!] data set.
 
For UNIX systems
the binary can go to standard directories (e.g. /usr/local/bin),
the rudimentary man page can go to the /usr/local/man/man1.

(b) Source (UNIX and MACs)
1. unpack the distribution file
2. cd migrate-VERSION/src
3. type "./configure"
   This will create the Makefile 
   [./configure --help for more options]
 	
4. type "make" (please report warnings and especially errors).
   If you have a multiprocessor machine (non-Macintosh computer!) you perhaps want to try 
   "make thread" (this allows parallel execution of chains when 
   using the heating scheme). 
   If you compile on a Macintosh with INTEL CPU and MACOS 10.6+ try
   "make mac"

   "make" will produce migrate with PDF support,
   using the heating scheme). On Macs configure will use automatically the built in 
   threading framework (GrandCentral) that will be faster than the standard threading. 
   "make" will produce migrate-n with PDF support,
   this might not work on all machines, if it fails please tell me.

   The result of the compilation should be an executable 
   "migrate-n" in the current directory [it is called "migrate-n" because
   on some computer system there is a system program called "migrate"]

5. make install 
   This will install the programs and man-page into usr/local/bin, 
   /usr/local/man/man1
   [you need to be root or administrator to do this; this step is NOT necessary, 
   to use the program, but it would be convenient for all users
   of your system]
   or 
   move migrate-n to $HOME/bin or some 
   other convenient place.

6. change directory to example
   run "migrate-n parmfile.testbayes", 
   on my 2008 macosx laptop the Bayesian inference run took about 2 minutes.
   If this test fails, please let me know!


Documentation
-------------
You need to download it separately from
http://popgen.sc.fsu.edu/Downloads.html

It is a PDF file and called  migratedoc.pdf.
The pdf file can be viewed and printed using Acrobat 
or any other PDF viewer.


Examples
--------
In the directory "example" you can find some example data sets.
You might wan to try the two parmfiles.testml and parmfile.testbayes
Use the Terminal.app (on macosx), or xterm (Linux), or cmd (Windows),
change directory to the example directory and then execute
for mac and unix: ../migrate-n parmfile.testbayes
for windows: ..\migrate-n parmfile.testbayes
or the ml version.


Fan-mail, complaints, questions and error-reports
-------------------------------------------------
Peter Beerli
beerli@fsu.edu
or
migrate-support@googlegroups.com


Disclaimers
-----------
Copyright 1997-2016 Peter Beerli
 
** MIT OPENSOURCE LICENSE*****************************************************************
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
*  of the Software, and to permit persons to whom the Software is furnished to do
*  so, subject to the following conditions:
* 
*  The above copyright notice and this permission notice shall be included in all copies
*  or substantial portions of the Software.
* 
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
*  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
*  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
*  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
*  CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
*  OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* 

Last update:
January 20 2015









