public void Adenine_Reaction()
        {
            var adenine = new Adenine();
            var substract = new MutatedAdenine1();
            var reagent = GetReagent();
            
            var result = _replacementReactionService.React(reagent, substract);
            Assert.AreNotEqual(substract.Links, result.Links);

        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            GetServices();
            Molecule substract;
            Molecule reagent;
            Molecule target;
            Molecule result;
            string   targetId;
            int      initAtomsCount;
            bool     found;

            while (true)
            {
                Console.Clear();
                substract      = null;
                reagent        = null;
                target         = null;
                result         = null;
                targetId       = string.Empty;
                initAtomsCount = 2;
                found          = false;

                Console.WriteLine("Escolha qual molécula danificada do DNA deseja restaurar:");
                Console.WriteLine("1 - Mutação na Adenina");
                Console.WriteLine("2 - Mutação na Citosina");
                Console.WriteLine("3 - Mutação na Guanina");
                Console.WriteLine("4 - Mutação na Timina");
                Console.Write("Opção: ");
                var input = Console.ReadKey();
                Console.WriteLine("\n");

                if (input.KeyChar == '1')
                {
                    target    = new Adenine();
                    targetId  = _linksService.GetIdStructure(target.Links);
                    substract = new MutatedAdenine1();
                }
                else if (input.KeyChar == '2')
                {
                    target    = new Cytosine();
                    targetId  = _linksService.GetIdStructure(target.Links);
                    substract = new MutatedCytosine1();
                }
                else if (input.KeyChar == '3')
                {
                    target    = new Guanine();
                    targetId  = _linksService.GetIdStructure(target.Links);
                    substract = new MutatedGuanine1();
                }
                else if (input.KeyChar == '4')
                {
                    target    = new Thymine();
                    targetId  = _linksService.GetIdStructure(target.Links);
                    substract = new MutatedThymine1();
                }

                if (target != null)
                {
                    while (initAtomsCount <= 20 && !found)
                    {
                        Console.WriteLine("Separando moléculas para teste de reagente...");
                        var testMolecules = _moleculeService.GetMoleculesByRange(initAtomsCount, initAtomsCount + 2);
                        foreach (var molecule in testMolecules)
                        {
                            reagent = molecule;
                            Console.Write(string.Format("Teste com reagente {0}", reagent.Nomenclature));
                            result = _replacementReactionService.React(reagent, substract);
                            if (result != null)
                            {
                                var resultId = _linksService.GetIdStructure(result.Links);
                                if (resultId.Equals(targetId))
                                {
                                    FoundResult(substract, reagent, result);
                                    found = true;
                                    break;
                                }
                            }
                            Console.Write(" - Falha\n");
                        }
                        initAtomsCount += 2;
                    }
                    if (!found)
                    {
                        Console.WriteLine("\nNão foi possível restaurar a molécula danificada.");
                    }
                    Console.ReadKey();
                }
            }
        }