Class Deme

java.lang.Object
  extended byDeme

public class Deme
extends java.lang.Object

A place with potentially interbreeding, constant population. Currently there is no dispersal, and fitness() is determined entirely by number of deleterious alleles, i.e. there is no requirement to match any particular local environmental conditions.

Usage:

created and called from class Loci

Output:

generation LD correlAB avgRec avgFit corr qav totmut totben totrec maxDel myLD numSelf
generation
completed bouts of viability selection, (assortative)mating, recombination, forward and backward mutation
LD
linkage disequilibrium between first and second fitness loci
correlAB
correlation between alleles at first and second fitness loci
avgRec
the average frequency of the recombination modifier
avgFit
the average fitness of all k individuals in the local population
corr
the realized correlation in fitness between all mums and dads
qav
the average frequency of deleterious alleles across all fitness loci
totmut
total number of forward mutation events this generation
totben
total number of* backward mutation events this generation
totrec
total number of recombination events this generation
maxDel
the maximum number of deleterious alleles found in any individual this generation. Of interest with respect to epistasis in the fitness function.
myLD
of all of the left/right chromosome pairings that matter with respect to recombination between the first and second fitness loci, this is the proportion that is repulsion pairings (Ab/aB). This is calculated from just the parents, and makes better sense to me than an LD at the haploid/chromosomal level.
numSelf
individuals are not allowed to mate with themselves. This is the number of selfings that were avoided.

Sample Run:

The command-line arguments are described in class Loci.

java -jar Loci.jar 5 10000 64 .001 0 .01 0 .01 0 0 .5
1 -0.00188 -0.00753 0.50275 0.53361 0.01567 0.49972 1226 0 12695 84 0.52683 0
2 0.00032 0.00128 0.50030 0.53492 -0.00827 0.49780 1290 0 12544 83 0.50059 1
3 -0.00219 -0.00876 0.50090 0.53583 -0.00322 0.49645 1213 0 12581 84 0.49866 0
4 -0.00066 -0.00263 0.50610 0.53752 -0.00799 0.49393 1257 0 12667 81 0.49858 0
5 -0.00395 -0.01582 0.50800 0.53887 0.00304 0.49193 1276 0 12561 81 0.51757 1


Field Summary
 double assort
          the correlation in fitness between parents
private  double avgFit
           
private  double avgRec
           
 double benMutRate
          per locus back mutation rate
 Bion bion
           
(package private)  double correlAB
           
private  int coupling
           
 double[][] cumDist
           
private  double[] cumFit
           
private  Bion dad
           
private  Bion[] dads
           
 double delMutRate
          per locus mutation rate
 int demeGen
           
private  int drop
           
 double epistasis
           
 double initq
          initial average frequency of deleterious alleles across fitness loci
 boolean[] isHit
           
private  double[] juvCumFit
           
private  Bion[] juveniles
          pre-reproductives
private  double juvSumFit
           
private  int k
          the constant population size
private  Bion[] locals
          les habitants
private  double localSumFit
           
private  int maxDel
           
 double minRecRate
          per meiosis probability of recombination between any two adjacent loci, without modifiers
 double modRecRate
          the increment in rec rate for homozygote for modifier
private  Bion mum
           
private  Bion[] mums
           
 int nAttribs
          the number of loci in play, including recombination modifier
 double[] np
          pre-computed binomial means
private  int numDel
           
private  int numJuveniles
           
private  int numLocals
           
private  int numRec
           
private  int numSelf
           
(package private)  double pA
           
(package private)  double pAB
           
(package private)  double pB
           
 double[] prob
           
 MersenneTwisterFast rand
           
private  double recRate
           
private  int repulsion
           
 double selRate
          selection coefficient, exact meaning depends on function used in fitness()
 double[] sqrnpq
          pre-computed binomial std dev
(package private)  int tab
           
(package private)  int taB
           
(package private)  int tAb
           
(package private)  int tAB
           
(package private)  int totben
           
static int[] totm
           
(package private)  int totmut
           
static int[] totr
           
(package private)  int totrec
           
 
Constructor Summary
Deme(MersenneTwisterFast rand, int k, int nAttribs, double delMutRate, double benMutRate, double minRecRate, double modRecRate, double selRate, double epistasis, double assort, double initq)
           
 
Method Summary
 void fitness(Bion bion)
          Whatever fitness function is desired is plugged in here.
 void flip()
          juveniles become potentially-reproducing adults
private  void heapsort(Bion[] ra, int n)
          Heapsort kludged from Numerical Recipes in C.
Used to sort mums and dads by fitness to generate assortativeness.
 void init()
          Generate pre-computed values, and populate deme with Bions.
 void nextGeneration()
          does viability selection, mating, and stats printout
private  Bion pickParent()
          The fitter are more likely to be chosen as parents.
 int searchCDF(double[] cumArray, int topIndex, double target)
          Binary search to find Cumulative Density Function array element >= target
used for picking parents according to fitness, and
for exact evaluation of the Binomial distribution
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nAttribs

public final int nAttribs
the number of loci in play, including recombination modifier


k

private final int k
the constant population size


selRate

public final double selRate
selection coefficient, exact meaning depends on function used in fitness()


epistasis

public final double epistasis

assort

public final double assort
the correlation in fitness between parents


initq

public final double initq
initial average frequency of deleterious alleles across fitness loci


delMutRate

public final double delMutRate
per locus mutation rate


benMutRate

public final double benMutRate
per locus back mutation rate


minRecRate

public final double minRecRate
per meiosis probability of recombination between any two adjacent loci, without modifiers


modRecRate

public final double modRecRate
the increment in rec rate for homozygote for modifier


sqrnpq

public final double[] sqrnpq
pre-computed binomial std dev


np

public final double[] np
pre-computed binomial means


cumDist

public final double[][] cumDist

prob

public final double[] prob

demeGen

public int demeGen

numDel

private int numDel

maxDel

private int maxDel

bion

public Bion bion

numLocals

private int numLocals

numJuveniles

private int numJuveniles

numRec

private int numRec

locals

private Bion[] locals
les habitants


juveniles

private Bion[] juveniles
pre-reproductives


mums

private Bion[] mums

dads

private Bion[] dads

mum

private Bion mum

dad

private Bion dad

drop

private int drop

cumFit

private double[] cumFit

juvCumFit

private double[] juvCumFit

localSumFit

private double localSumFit

juvSumFit

private double juvSumFit

avgFit

private double avgFit

avgRec

private double avgRec

rand

public MersenneTwisterFast rand

totr

public static int[] totr

totm

public static int[] totm

tAB

int tAB

tAb

int tAb

taB

int taB

tab

int tab

totmut

int totmut

totben

int totben

totrec

int totrec

correlAB

double correlAB

pAB

double pAB

pA

double pA

pB

double pB

recRate

private double recRate

coupling

private int coupling

repulsion

private int repulsion

numSelf

private int numSelf

isHit

public boolean[] isHit
Constructor Detail

Deme

public Deme(MersenneTwisterFast rand,
            int k,
            int nAttribs,
            double delMutRate,
            double benMutRate,
            double minRecRate,
            double modRecRate,
            double selRate,
            double epistasis,
            double assort,
            double initq)
Method Detail

init

public void init()
Generate pre-computed values, and populate deme with Bions.


fitness

public void fitness(Bion bion)
Whatever fitness function is desired is plugged in here.


searchCDF

public int searchCDF(double[] cumArray,
                     int topIndex,
                     double target)
Binary search to find Cumulative Density Function array element >= target
used for picking parents according to fitness, and
for exact evaluation of the Binomial distribution


pickParent

private Bion pickParent()
The fitter are more likely to be chosen as parents.


heapsort

private void heapsort(Bion[] ra,
                      int n)
Heapsort kludged from Numerical Recipes in C.
Used to sort mums and dads by fitness to generate assortativeness.


nextGeneration

public void nextGeneration()
does viability selection, mating, and stats printout


flip

public void flip()
juveniles become potentially-reproducing adults