1 //////////////////////////////////////////////////////////////////////
\r
3 //////////////////////////////////////////////////////////////////////////////
\r
4 // COPYRIGHT NOTICE FOR GENOME CODE
\r
6 // Copyright (C) 2006 - 2009, Liming Liang and Goncalo Abecasis,
\r
7 // All rights reserved.
\r
9 // Redistribution and use in source and binary forms, with or without
\r
10 // modification, are permitted provided that the following conditions
\r
13 // 1. Redistributions of source code must retain the above copyright
\r
14 // notice, this list of conditions and the following disclaimer.
\r
16 // 2. Redistributions in binary form must reproduce the above copyright
\r
17 // notice, this list of conditions and the following disclaimer in the
\r
18 // documentation and/or other materials provided with the distribution.
\r
20 // 3. The names of its contributors may not be used to endorse or promote
\r
21 // products derived from this software without specific prior written
\r
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\r
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
\r
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
\r
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
\r
28 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
29 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
\r
30 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
\r
31 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
32 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
33 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
34 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
36 ///////////////////////////////////////////////////////////////////////////////
\r
42 using namespace std;
\r
44 void genome(string popSize, // effective population size of each population
\r
45 int nSubPOP, // number of populations
\r
46 vector<int> & nSubSample, // number of samples (haplotypes) draw from each populations
\r
47 int numPieces, // number of fragments for each sample (chromosome)
\r
48 int pieceLen, // length in base pair of each fragment
\r
49 int numIndepRegion, // number of independent regions (independent chromosome)
\r
50 int s, // fixed number of SNPs want to simulate, randomly place s SNPs on the genealogy
\r
51 string rec, // recombination rate between consecutive fragments per generation
\r
52 double mut, // mutation rate per generation per base pair
\r
53 double mig, // migration rate per generation
\r
54 vector< vector<bool> > &return_chromosome, // the return chromosome by connecting all independent chromosome into one long chromosome
\r
55 long t, // random seed
\r
56 int drawtree, // drawtree=1 output the genealogy trees for each fragment and chromosome; drawtree=0 do not output the trees
\r
57 bool printparameters =false // =1 print out all input parameters, =0 do not print input parameters
\r