Exemple #1
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);
            }
        }
Exemple #2
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);
        }