sgssimul.f95 was written in order to perform simulations of the evolution of spatial genetic struture under some assumptions regarding demography, dispersal, sexual system and transmission of plant genomes. It was used to study the relationship between dispersal of seeds and pollen and sex ratios for biparentally and paternally inherited genomes under dioecy. For details of simulation assumptions see Chybicki et al. Relative strength of fine-scale spatial genetic structure in paternally vs. biparentally inherited DNA in a dioecious plant depends on both sex proportions and pollen-to-seed dispersal ratio. Heredity, in press.

In order to run simulations, the info file has to be generated in the directory of the compiled sgssimul.

The structure of the info file (input file):
nrep                 !number of replicates (integer)
ng                   !number of generations (integer)
ni                   !number of individuals (integer)
popdens              !population density (real; number of individuals per hectare)
femaleness           !proportion of females (real)
dioecy               !dioecy vs. monoecy indicator (binary 0/1)
self_incomp          !self-infcomp. indicator (binary 0/1; works only for dioecy=0)
a_s,b_s              !seed dispersal kernel (real,real; parameters of an exponential-power dispersal kernel for seeds; see Austerlitz et al. 2004)
a_p,b_p              !pollen dispersal kernel (real,real; parameters of an exponential-power dispersal kernel for pollen; see Austerlitz et al. 2004)
maternal_mt          !probability of maternal transmission of mtDNA (real)
maternal_cp          !probability of maternal transmission of cpDNA (real)
nl                   !number of nuclear loci (integer)
na                   !number of alleles at nuclear loci (integer)
nmt                  !number of mt haplotypes (integer)
ncp                  !number of cp haplotypes (integer)
nsl                  !number of s-locus alleles (integer)
munu,mumt,mucp       !mutation rates (real,real,real)
ncint                !number of distance intervals to compute correlogram (integer)
seed                 !seed to initialize random number generator (integer)
fs                   !output file name (max=99 characters!)
fc                   !output file name (max=99 characters!)
usernth              !number of threads (integer)

The following example assumes that there are 100 simulations, 100 generations each, 500 individuals within a dioecious population of density 20/ha, with 70% females. The assumed seed and pollen dispersal kernel parameters are (a=50,b=1) and (a=25,b=1) for seeds and pollen, respectively. mtDNA is assumed to be exclusively paternally transsmitted, while cpDNA - exclusively maternally transmitted. A single nuclear locus is assumed with 10 equally frequent alleles. Also, 10 alleles are assumed for mtDNA, cpDNA and self-incompatibility locus (a simple gametophytic system, i.e. pollen gamete has to be different from any of the two alleles in a receipent genotype). Mutation rates are set to zero in nuDNA, mtDNA and cpDNA. Correlograms are generated based on 25 distance intervals with equal number of pairs. Pseudo-Random Number Generator is initiated with 17336 (used different values for separate simulation runs). 4 threads are assumed (if a number of cores/threads available in a system is lower than 4 then the number will be automatically reduced to the maximum possible). Results will be written to flat text files named "slopes.txt" and "correlograms.txt". The former contains estimated slopes for regression lines for the four marker/gene types (nuDNA, mtDNA, cpDNA and self-incompatibility gene).

The example:
         100
         100
         500
   20.000000000000000     
  0.700000000000000     
           1
           0
   50.000000000000000        1.0000000000000000     
   25.000000000000000        1.0000000000000000     
   0.0000000000000000     
   1.0000000000000000     
           1
          10
          10
          10
          10
	0.00,0.00,0.00
          25
          17336
 slopes.txt                                                                                         
 correlograms.txt                                                                                   
           4

The structure of output files:
------------------------------
"slopes.txt" file (see the example above) contains the results of simulation. Each line contains results for a single replicate, i.e.
r,sl_nu,sl_mt,sl_cp,sl_sl,dlt_mo,dlt_fo,dlt_mf,sig_mo,sig_fo,sig_mf

r - number of replicate
sl_nu - slope for nuDNA
sl_mt - slope for mtDNA
sl_cp - slope for cpDNA
sl_sl - slope for self-incompatibility locus
dlt_mo - average distance between mother and offspring
dlt_fo - average distance between father and offspring
dlt_mf - average distance between mother and father
sig_mo - average axial distance between mother and offspring (the sigma of Crawfort 1984)
sig_fo - average axial distance between father and offspring (the sigma of Crawfort 1984)
sig_mf - average axial distance between mother and father (the sigma of Crawfort 1984)

"correlograms.txt" file (see the example above) contains the resulting correlograms. Each line contains results for a single replicate, i.e.
r,g,uplim(g),cd(g),crnu(g),crmt(g),crcp(g),crsl(g)

r - number of replicate
g - distance class
uplim(g) - upper limit of the g-th distance class
cd(g) - average distance within the g-th distance class
crnu(g) - average relatedness within the g-th class for nuDNA
crmt(g) - average relatedness within the g-th class for mtDNA
crcp(g) - average relatedness within the g-th class for cpDNA
crsl(g) - average relatedness within the g-th class for self-incompatibility locus