Legofit
infers population history from nucleotide site patterns.
simreader

Interface to output files produced by ms2sim and msprime.

There are two versions of the input format. In version 1, the top of the input looked like this:

npops = 4
pop sampsize
x 1
y 1
n 1
d 1
0 0 0 1 1 
0 0 0 1 0

In version 2, it looks like this:

nchromosomes = 10
chrlen = 2000000
npops = 5
pop sampsize
x 1
y 1
n 1
d 1
s 1
0 345.7722022796852 0 0 0 1 0 
0 377.99065190067955 1 0 0 0 0 
0 407.9258238758751 0 0 0 0 1 

Version 2 has 2 lines at the top, giving the number of chromosomes and the length in basepairs of each chromosome. In the lines of data that follow the header, the 2nd field has the nucleotide position of the current site.

The SimReader_new function distinguishes between these formats by examining the first character string in the file. If that string is "npops", we are reading format 1. If it's "nchromosomes", we're in format 2.

If the input data are in format 2, the function SimReader_pos returns the position of the current site. If the input is format 1, this function returns -1.