Skip to content
xyang619 edited this page Nov 30, 2014 · 15 revisions

###Model Description

  1. Basic population model assumptions

    The population in each generation evolve following standard Wright Fisher model without mutation and selection. That is, randomly sample two haplotypes from the population haplotype pool, pair them and recombine to form a new chromosome pair for next generation. Repeat this process until sampled N chromosome pair. Here N denote population size in specific generation.

    Recombination is model as a Poisson Process with rate 1.

  2. What the admixture model simulator can do.

    Here implemented a very flexible admixture model, in which:

    1). Can take arbitrary number of ancestral populations;

    2). Can take arbitrary wave of population admixture;

    3). Population size can be changed generation by generation;

    4). And admixture proportions can also be changed generation by generation.

###Get started

  1. Requirements

    To run the simulator require java 1.6 or upper.

    Download URL: https://github.com/xyang619/AdmSimulator/releases

  2. Get command line help

     java -jar AdmSimulator.jar -h  or java -jar AdmSimulator.jar --help
    
  3. Run with toy data

     java -jar AdmSimulator.jar --gen 10 --nanc 2 10 10 --len 1.0 --file toy.par --samp 20 --prefix test --output test
    

###Input and output

  1. Input files

    1). model description file

    firstly, in model description file, set up initial number of haplotypes to be sampled for ancestral populations

    secondly, set up the population size and ancestral proportions for each generation in one line

    Note: anything follow "#" was treated as comments

    Here is a complete example:

     #set up number of haplotypes in each ancestral population to be sampled from
     10	10
     // #indicate start of population size and ancestral proportions for each generation
     100	0.5	0.5 #init population, two ancestral population, each contribute 50%
     100	0	0
     100	0.1	0 #second wave admixture, with 10% gene flow from ancestral population 1
     100	0	0
     100	0	0
     100	0	0.2 #third wave admixture, with 20% gene flow from ancestral population 2
     100	0	0
     150	0	0 #population increase to 150
     100	0	0 #population size decrease to 100
     100	0	0
    

    It's simple to implemented HI, GA or CGFR or CGFD model as described in Jin Wenfei et al.

    HI model:

     10 10
     //
     100	0.7	0.3 #init population, two ancestral population, contribute 70% and 30%
     100	0	0
     ......
     100	0	0
    

    GA model:

     10 10
     //
     100	0.7	0.3 #init population, two ancestral population, contribute 70% and 30%
     100	0.1	0.1
     ......
     100	0.1	0.1
    

    CGFD model:

     10 10
     //
     100	0.7	0.3 #init population, two ancestral population, contribute 70% and 30%
     100	0.1	0
     ......
     100	0.1	0
    

    CGFR model:

     10 10
     //
     100	0.7	0.3 #init population, two ancestral population, contribute 70% and 30%
     100	0	0.1
     ......
     100	0	0.1
    

    2). Map file

    The genetic positions for each marker are given in Morgan, one line per marker.

    Here is an example:

     0.00097100
     0.00238066
     0.00367538
     ......
    

    3). Haplotype file

    The haplotypes of ancestral populations to be sampled from are combined in one file, one haplotype per line. And the first n1 lines corresponding to first ancestral population, second n2 lines corresponding to second ancestral population and so on. In which the number of ancestral populations and number of haplotype for each ancestral population are given in model description file.

    Here is an example:

     1011000000100100001000000010110100010101000011010111000000000010000000011101100000000101000010010010
     0010000010000100001000000010110101010011000001011111001000000010000000011001100000010101000010110010
     0010000010000100001000000010110101010001010001010111000000100011000000011001110010000101000010010010
     0010000010000100001010000010110101010001000001010111000000100010000000011001110010000101000010010010
     ......
     0100000000000110100000010000000100010000001000000001010001000010000101001011000100001100000111000100
    
  2. Output file

    1). Mixed haplotypes

    Same as input haplotype file

    2). Segment file

    In which record the start, end and which ancestral that segment comes from. one segment per line.

    Here is an example:

      0.00000000      0.07785695      2
      0.07785695      0.30178126      1
      ......
      0.30178126      0.41594482      2
    

###Complete arguments list

-h/--help	print help message
-g/--gen	generation since admixture
-k/--nanc	number of ancestral populations
-l/--len	length of chromosome to be simulated
-f/--file	model description parameter file
-n/--samp	number of individuals sampled
-p/--prefix	prefix of input file
-o/--output	prefix of output file
-s/--seed	seed of random generator

###Couple with MS It's very easy to couple with a coalescent simulator MS. For example, use MS to simulate two ancestral populations, whose Ne remains constant, i.e. Ne=5000, split 4000 generations ago, command as below:

    ms 200 1 -t 2000 -r 2000 10000000 -I 2 100 100 -ej 0.2 2 1 -p 8 > simAnc.txt

Then just simply convert into the files needed in the admixture model simulator:

    python convert.py simAnc.txt simAnc 200

It will produce the map file and the ancestral haplotype file:

    simAnc.map simAnc.hap

Afterwards, the simulated ancestral haplotypes could be used in the admixture model simulator, for example:

    java -Xmx2g -jar AdmSimulator.jar -g 20 -k 2 -l 2 -f sim1.par -n 100 -p simAnc -o sim1
Clone this wiki locally