Exemplo n.º 1
0
        public Genotype CombineGenotypes(Genotype other, GenotypeRepository genotypeRepository, IRandomNumberGenerator RNG) //########FIX THIS#########
        {
            var choice = RNG.Next(0, 4);
            var g      = new Genotype();

            g.AlleleName = AlleleName;

            if (choice == 0)
            {
                g.Allele1 = this.Allele1;
                g.Allele2 = other.Allele1;
            }
            if (choice == 1)
            {
                g.Allele1 = this.Allele2;
                g.Allele2 = other.Allele1;
            }
            if (choice == 2)
            {
                g.Allele1 = this.Allele1;
                g.Allele2 = other.Allele2;
            }
            if (choice == 3)
            {
                g.Allele1 = this.Allele2;
                g.Allele2 = other.Allele2;
            }

            return(g);
        }
Exemplo n.º 2
0
        public Genotype MostLikelyGenotype(Genotype other, GenotypeRepository genotypeRepository, IRandomNumberGenerator RNG)
        {
            string          letter           = AlleleName;
            List <Genotype> GenericGenotypes = CreateGenericGenotypes();
            Genotype        hetG             = GenericGenotypes[0];
            Genotype        domG             = GenericGenotypes[1];
            Genotype        recG             = GenericGenotypes[2];
            Genotype        hetG2            = GenericGenotypes[3];

            int hetGTally  = 0;
            int domGTally  = 0;
            int recGTally  = 0;
            int hetG2Tally = 0;


            for (int i = 0; i < 100; i++)
            {
                Genotype g = CombineGenotypes(other, genotypeRepository, RNG);
                if (g.ToString() == hetG.ToString())
                {
                    hetGTally++;
                }
                if (g.ToString() == domG.ToString())
                {
                    domGTally++;
                }
                if (g.ToString() == recG.ToString())
                {
                    recGTally++;
                }
                if (g.ToString() == hetG2.ToString())
                {
                    hetG2Tally++;
                }
            }
            if (domGTally > recGTally || domGTally > hetGTally || hetGTally > hetG2Tally)
            {
                return(domG);
            }
            if (recGTally > domGTally || recGTally > domGTally || hetGTally > hetG2Tally)
            {
                return(recG);
            }
            if (hetGTally > domGTally || hetGTally > recGTally || hetGTally > hetG2Tally)
            {
                return(hetG);
            }
            if (hetG2Tally > domGTally || hetG2Tally > recGTally || hetG2Tally > hetGTally)
            {
                return(hetG);// aA is not correct biological term= is always dominant followed by reccessive so returns hetG or Aa
            }
            {
                return(other);
            }
        }
Exemplo n.º 3
0
 public void GenerateGenotypesForATrait(GenotypeRepository genotypeRepository)
 {
     genotypeRepository.AddGenotype(AlleleName, Dominance.Dominant, Dominance.Recessive);
     genotypeRepository.AddGenotype(AlleleName, Dominance.Recessive, Dominance.Recessive);
     genotypeRepository.AddGenotype(AlleleName, Dominance.Dominant, Dominance.Dominant);
 }
Exemplo n.º 4
0
        public List <Genotype> CalculateParentalGenotypes(GenotypeRepository genotypeRepository, IRandomNumberGenerator RNG)
        {
            List <Genotype> PossibleParentalGenotypes = new List <Genotype>();
            string          letter           = AlleleName;
            List <Genotype> GenericGenotypes = CreateGenericGenotypes();
            Genotype        hetG             = GenericGenotypes[0];
            Genotype        domG             = GenericGenotypes[1];
            Genotype        recG             = GenericGenotypes[2];
            Genotype        hetG2            = GenericGenotypes[3];

            Genotype resultOfHetGAndDomG = hetG.CombineGenotypes(domG, genotypeRepository, RNG);
            Genotype resultOfHetGAndRecG = hetG.CombineGenotypes(recG, genotypeRepository, RNG);
            Genotype resultOfHetGAndHetG = hetG.CombineGenotypes(hetG, genotypeRepository, RNG);

            Genotype resultOfDomGAndDomG = domG.CombineGenotypes(domG, genotypeRepository, RNG);
            Genotype resultOfDomGAndRecG = domG.CombineGenotypes(recG, genotypeRepository, RNG);

            Genotype resultOfRecGAndRecG = recG.CombineGenotypes(recG, genotypeRepository, RNG);

            Genotype resultOfhetG2AndRecG  = hetG2.CombineGenotypes(recG, genotypeRepository, RNG);
            Genotype resultOfhetG2AndDomG  = hetG2.CombineGenotypes(domG, genotypeRepository, RNG);
            Genotype resultOfhetG2AndHetG  = hetG2.CombineGenotypes(hetG, genotypeRepository, RNG);
            Genotype resultOfhetG2AndhetG2 = hetG2.CombineGenotypes(hetG2, genotypeRepository, RNG);



            if (ToString() == resultOfDomGAndDomG.ToString())             //AA X AA
            {
                PossibleParentalGenotypes.Add(domG);
                PossibleParentalGenotypes.Add(domG);
            }
            if (ToString() == resultOfDomGAndRecG.ToString())             // AA X aa
            {
                PossibleParentalGenotypes.Add(domG);
                PossibleParentalGenotypes.Add(recG);
            }
            if (ToString() == resultOfHetGAndDomG.ToString())             // Aa X AA
            {
                PossibleParentalGenotypes.Add(domG);
                PossibleParentalGenotypes.Add(hetG);
            }
            if (ToString() == resultOfHetGAndHetG.ToString())             // Aa X Aa
            {
                PossibleParentalGenotypes.Add(hetG);
                PossibleParentalGenotypes.Add(hetG);
            }
            if (ToString() == resultOfHetGAndRecG.ToString())            //Aa X aa
            {
                PossibleParentalGenotypes.Add(recG);
                PossibleParentalGenotypes.Add(hetG);
            }
            if (ToString() == resultOfRecGAndRecG.ToString())            // aa X aa
            {
                PossibleParentalGenotypes.Add(recG);
                PossibleParentalGenotypes.Add(recG);
            }
            if (ToString() == resultOfhetG2AndRecG.ToString())   // aA X aa
            {
                PossibleParentalGenotypes.Add(hetG);             //not HG2 as HG2 is actually the same as hetG as aA = Aa
                PossibleParentalGenotypes.Add(recG);
            }
            if (ToString() == resultOfhetG2AndDomG.ToString())             //aA X AA
            {
                PossibleParentalGenotypes.Add(hetG);
                PossibleParentalGenotypes.Add(domG);
            }
            if (ToString() == resultOfhetG2AndHetG.ToString())             //aA X Aa
            {
                PossibleParentalGenotypes.Add(hetG);
                PossibleParentalGenotypes.Add(hetG);
            }
            if (ToString() == resultOfhetG2AndhetG2.ToString())             //aA X aA
            {
                PossibleParentalGenotypes.Add(hetG);
                PossibleParentalGenotypes.Add(hetG);
            }


            return(PossibleParentalGenotypes);
        }