/////////////////////////////////////////////////////////////////////////////////////
//                                                                                 //
//  INDELible V1.03 control file - CODONsites.txt                                  //
//                                                                                 //
//      An introduction to different codon site models.                            //
//                                                                                 //
/////////////////////////////////////////////////////////////////////////////////////

  /* Again - the control file must begin with the [TYPE] statement */

[TYPE] CODON 1	//  codon simulation using algorithm from method 1

[SETTINGS]
  [randomseed] 1568746 // seed for random generator so outputs can be checked

  /* Many different models can be defined in a single control file */

[MODEL] M0example  
    [submodel]  2.5  0.5                     //  kappa=2.5, w=0.5
 									
[MODEL] M1example    
    [submodel]  2.5                          //  kappa=2.5
                0.2                          //  p0=0.2, p1=0.8
                0.5  1                       //  w0=0.5, w1=1
  
[MODEL] m1example    
    [submodel]  2.5  0.2  0.5  1             //  same as above, but can be on one line

[MODEL] M2example    
    [submodel]  2.0                          //  kappa=2
                0.2  0.3                     //  p0=0.2, p1=0.3, p2=0.5
                0.5  1.0  2.0                //  w0=0.5, w1=1, w2=2
  
[MODEL] M3example   
    [submodel]  2.5                                   //  kappa=2.5
                0.05  0.10  0.20  0.30  0.25          //  p0, p1, p2, p3, p4, p5=0.1 
                0.13  0.72  1.38  2.74  5.42  10.23   //  w0, w1, w2, w3, w4, w5
  
[MODEL] M4example   
    [submodel]  2.5                                   //  kappa=2.5
                0.05  0.1        0.2        0.3       //  p0, p1, p2, p3, p4=0.35 
                0     0.333333   0.666666   1    3    //  w0, w1, w2, w3, w4


[TREE] t1  (A:0.1,B:0.1); 


  /* Many different partition groupings can be defined in a single control file */

[PARTITIONS] pM0   [t1 M0example 20]  // tree t1, model M0example, root length 20
[PARTITIONS] pM1   [t1 M1example 20]  // tree t1, model M1example, root length 20
[PARTITIONS] pM2   [t1 M2example 20]  // tree t1, model M2example, root length 20
[PARTITIONS] pM3   [t1 M3example 20]  // tree t1, model M3example, root length 20
[PARTITIONS] pM4   [t1 M4example 20]  // tree t1, model M4example, root length 20


  /* The [EVOLVE] statement is then used to list all the simulations you want to do */

[EVOLVE] 
  pM0  5 out1  // 5 replicates generated from partition pM0 in file out1.fas etc
  pM1  5 out2  // 5 replicates generated from partition pM1 in file out2.fas etc
  pM2  5 out3  // 5 replicates generated from partition pM2 in file out3.fas etc
  pM3  5 out4  // 5 replicates generated from partition pM3 in file out4.fas etc
  pM4  5 out5  // 5 replicates generated from partition pM4 in file out5.fas etc


///////////////////////////////////////////////////////////////////////////////////

/*
    The command is  [submodel] ECMunrest for the empirical unrestricted model.
    The command is  [submodel] ECMrest for the empirical restricted model.

    The non-empirical codon substitution models are all special cases of M3.
    They are specified using the following format for a model with K categories:

    M3 (discrete)                       // p(K-1)=1-p(K-2)-...-p1-p0
    [submodel]  kappa
                p0  p1  ...  p(K-2)          // proportions
                ω0  ω1  ...  ω(K-2)  ω(K-1)  // omegas

    All models M0-M13 can be represented in this M3 format, e.g.

    M0 (one-ratio) 
    [submodel]  kappa  &omega0                   //  p0=1
 
    M1 (neutral)   
    [submodel]  kappa  p0  ω0  1            //  ω1=1;  p1=1-p0

    M2 (selection)  
    [submodel]  kappa  p0  p1  ω0  1   ω2   //  ω1=1;  p2=1-p1-p0
   
    M4 (freqs) with K=5  
    [submodel]  kappa  
                p0  p1         p2         p3      //  p4=1-p3-p2-p1-p0
                0   0.333333   0.666666   1   3   //  ω0,  ω1,  ω2,  ω3,  ω4 

    A script (named "M5-13") is provided with INDELible to calculate the discrete 
    values for this command from the parameters used in models M5-M13.

    Codon frequencies are changed from being equal by listing 64 numbers 
    (separated by white space) after the command [statefreq].
*/