예제 #1
0
        public void TestCombineGenotypes()
        {
            var f = new GenoTypeTestFixture();

            f.SetUp();
            var a        = new Genotype("A", Dominance.Dominant, Dominance.Recessive);
            var a2       = new Genotype("A", Dominance.Dominant, Dominance.Dominant);
            var expected = new Genotype("A", Dominance.Dominant, Dominance.Dominant);

            var result = a.MostLikelyGenotype(a2, f.genotypeRepository, f.rng);

            Assert.AreEqual(expected.ToString(), result.ToString());
        }
예제 #2
0
        private static void CombineGenotypesScreen(Person selectedPerson, PersonRepository personRepository, GenotypeRepository genotypeRepository, RealRandomNumberGenerator rng, TraitRepository traitRepository, GeneticCounsellorDbContext context)//TO DO: Change Seed Data to be compatible with added Genotypes
        {
            Console.Clear();
            Genotype firstSelectedPerson = GetSelectedPersonsGenotype(selectedPerson, traitRepository, personRepository, genotypeRepository, rng, context); //Selected Genotypes
            //Ensure only males and females are compatible
            StringBuilder sb = new StringBuilder();

            ListAllPersonsScreen(sb, personRepository, genotypeRepository);
            string s = sb.ToString();

            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++");
            Console.WriteLine("Please select a person to combine genotypes with:");
            Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++");
            Console.Write(s);
            Person   otherPerson         = FindPersonByIndex(personRepository);
            Genotype otherSelectedPerson = GetSelectedPersonsGenotype(otherPerson, traitRepository, personRepository, genotypeRepository, rng, context);
            Genotype resultingGenotype   = firstSelectedPerson.MostLikelyGenotype(otherSelectedPerson, genotypeRepository, rng);

            Console.WriteLine("______________________________________________________________________________________________________________");
            Console.WriteLine(resultingGenotype.ToString() + " is the most likely genotype combination in offspring between these two persons");
            Console.WriteLine("______________________________________________________________________________________________________________");
        }