Esempio n. 1
0
 public Locus(string name, IAlleleManager alleleManager)
 {
     _locusId = Guid.NewGuid();
     _locusName = name;
     _alleleManager = alleleManager;
     isVisibleLocus = false;
 }
 public IAllele RetrieveAllele(IAlleleManager manager)
 {
     var num = _random.DoubleGenerator(1000);
     double current = 0;
     foreach (var allele in manager.Alleles)
     {
         var allFreq = allele.DefaultFrequency * 1000;
         var max = allFreq + current;
         if (num <= max)
             return allele;
         current += allFreq;
     }
     return manager.Alleles[0];
 }