Пример #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (combometabolites.Text.Length > 0)
            {
                if (Sbml.There(combometabolites, combometabolites.Text))
                {
                    sbml.AgregaraMetabolitosExternos(combometabolites.Text);
                    if (!Principal.txt)
                    {
                        Read read = new Read();
                        read.ActualizarBoundaryCondition(Principal.doc, combometabolites.Text.ToLower());
                    }
                    // Principal.doc.PreserveWhitespace = true;


                    combometabolites.Items.Remove(combometabolites.Text);
                    Principal.mysbml = sbml;
                    MessageBox.Show("Correctly Converted!!!", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("not exist a metabolite with this name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Select the metabolite to be removed of the internal metabolites", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void sbmlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.openfile.ShowDialog() == DialogResult.OK)
            {
                string aux = openfile.FileName.Split('.')[1];

                if (aux == "xml")
                {
                    fileaddres = openfile.FileName;

                    Read read = new Read();
                    mysbml = read.ReadXml(fileaddres);
                    if (mysbml.ListReaction.Length == 0 || mysbml.ListSpecie.Length == 0)
                    {
                        MessageBox.Show("Unreadable file,\n verify complies with the standard", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        doc.Load(fileaddres);
                        optimize.Enabled           = true;
                        optimizer2.Enabled         = true;
                        toolStripButton2.Enabled   = true;
                        toolStripMenuItem1.Enabled = true;
                        save2toolStrip.Enabled     = true;
                        save1toolStrip.Enabled     = true;
                        txt = false;


                        if (yaabri)
                        {
                            mod.Close();
                            mod           = new Model();
                            mod.MdiParent = this;
                            mod.Show();
                        }
                        else
                        {
                            mod           = new Model();
                            mod.MdiParent = this;
                            mod.Show();
                            yaabri = true;
                        }
                        fba2 = false;
                    }
                    //MessageBox.Show("Successfully Loaded", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Incorrect Extension", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #3
0
        private void Model_Load(object sender, EventArgs e)
        {
            mysbml            = Principal.mysbml;
            Principal.abierto = true;
            foreach (Reaction aux in mysbml.ListReaction)
            {
                string[] row = new string[4] {
                    aux.Name, aux.LowerBound.ToString(), aux.UpperBound.ToString(), aux.IsExchange().ToString()
                };

                ListViewItem list = new ListViewItem(row);

                listView2.Items.Add(list);
            }
        }
Пример #4
0
        private void Setup_Constraints_Load(object sender, EventArgs e)
        {
            valuee   = "";
            objetive = FVA.objetive;

            sbml = Principal.mysbml;

            dataGridView1.Rows.Clear();

            for (int i = 0; i < sbml.ListReaction.Length; i++)
            {
                dataGridView1.Rows.Add();
                dataGridView1.Rows[i].Cells[0].Value = sbml.ListReaction[i].Id;
                dataGridView1.Rows[i].Cells[1].Value = sbml.ListReaction[i].Reversible;
                dataGridView1.Rows[i].Cells[2].Value = sbml.ListReaction[i].LowerBound;
                dataGridView1.Rows[i].Cells[3].Value = sbml.ListReaction[i].UpperBound;
            }
        }
Пример #5
0
        private void Rna_Load(object sender, EventArgs e)
        {
            fileTextBox.Text = Principal.FileAddres;
            reactionObjetiveComboBox.Text = Principal.objetivefuntion;
            readsbml = new Read();
            results  = false;

            sbml = Principal.mysbml;


            foreach (Reaction item in sbml.ListReaction)
            {
                reactionObjetiveComboBox.Items.Add(item.Id);
                comboconstrain.Items.Add(item.Id);
                comboreactionexchange.Items.Add(item.Id);
            }
            foreach (Specie item in sbml.ListSpecie)
            {
                combometabolites.Items.Add(item.Id);
            }
        }
Пример #6
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (reactionObjetiveComboBox.Text.Length == 0)
     {
         MessageBox.Show("Select the function to optimize", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (Sbml.There(reactionObjetiveComboBox, reactionObjetiveComboBox.Text))
         {
             Principal.objetivefuntion  = reactionObjetiveComboBox.Text;
             Principal.yaabriconstraint = true;
             sc           = new Setup_Constraints();
             sc.MdiParent = Principal.ActiveForm;
             objetive     = reactionObjetiveComboBox.Text;
             this.Close();
             sc.Show();
         }
         else
         {
             MessageBox.Show("This reaction not exist in the model", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Пример #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (reactionObjetiveComboBox.Text.Length > 0 && comboreactionexchange.Text.Length > 0)
            {
                if (Sbml.There(reactionObjetiveComboBox, reactionObjetiveComboBox.Text) && Sbml.There(comboreactionexchange, comboreactionexchange.Text))
                {
                    if ((aNumericUpDown.Value != bNumericUpDown.Value) && (aNumericUpDown.Value < bNumericUpDown.Value))
                    {
                        makefba = new MakeFba();

                        int i = 0;

                        bool find = false;

                        foreach (Reaction item in sbml.ListReaction)
                        {
                            if (item.Id == reactionObjetiveComboBox.Text)
                            {
                                reactionoptimize = reactionObjetiveComboBox.Text;

                                find = true;

                                break;
                            }
                            i++;
                        }
                        if (find)
                        {
                            if (radiomax.Checked)
                            {
                                pd = OptimisationDirection.MAXIMISE;
                            }
                            else
                            {
                                pd = OptimisationDirection.MINIMISE;
                            }

                            pointresult = makefba.Rna(sbml, i, pd, (int)aNumericUpDown.Value, (int)bNumericUpDown.Value, comboreactionexchange.Text);



                            resultlist.Items.Clear();

                            string[] str;

                            ListViewItem list;


                            for (int k = 0; k < pointresult.Length; k++)
                            {
                                int kaux = k + 1;
                                str = new string[3] {
                                    kaux.ToString(), pointresult[k].X.ToString(), pointresult[k].Y.ToString()
                                };

                                list = new ListViewItem(str);
                                resultlist.Items.Add(list);
                            }
                            results         = true;
                            button3.Enabled = true;
                        }
                        else
                        {
                            results         = false;
                            button3.Enabled = false;
                            MessageBox.Show("This reaction not exist in the model", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("The values of A and B must be different, and A less than B", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Select the objective functions to optimize and to be varied", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Select the objective functions to optimize and to be varied", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #8
0
 private void updateButton_Click(object sender, EventArgs e)
 {
     if (comboconstrain.Text.Length > 0)
     {
         if (Sbml.There(comboconstrain, comboconstrain.Text))
         {
             if (isReversibleTextBox.Text == "False")
             {
                 if (double.Parse(lowertextBox1.Text, CultureInfo.InvariantCulture.NumberFormat) < 0)
                 {
                     MessageBox.Show("This reaction is irreversible, the Lower Bound must be less than zero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 else
                 {
                     foreach (Reaction item in sbml.ListReaction)
                     {
                         if (item.Id == comboconstrain.Text)
                         {
                             item.LowerBound  = double.Parse(lowertextBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                             item.UpperBound  = double.Parse(uppertextBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
                             Principal.mysbml = sbml;
                             if (!Principal.txt)
                             {
                                 Read red = new Read();
                                 red.ActualizarRestricciones(Principal.doc, comboconstrain.Text.ToLower(), lowertextBox1.Text, uppertextBox2.Text);
                             }
                             MessageBox.Show("Update!!!!!!", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             break;
                         }
                     }
                 }
             }
             else
             {
                 foreach (Reaction item in sbml.ListReaction)
                 {
                     if (item.Id == comboconstrain.Text)
                     {
                         item.LowerBound  = double.Parse(lowertextBox1.Text, CultureInfo.InvariantCulture.NumberFormat);
                         item.UpperBound  = double.Parse(uppertextBox2.Text, CultureInfo.InvariantCulture.NumberFormat);
                         Principal.mysbml = sbml;
                         if (!Principal.txt)
                         {
                             Read red = new Read();
                             red.ActualizarRestricciones(Principal.doc, comboconstrain.Text.ToLower(), lowertextBox1.Text, uppertextBox2.Text);
                         }
                         MessageBox.Show("Update!!!!!!", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         break;
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("Not exist a reaction with this name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Select the reaction to be configured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (reactionObjetiveComboBox.Text.Length > 0 && reactionObjetiveComboBox2.Text.Length > 0)
            {
                if (Sbml.There(reactionObjetiveComboBox, reactionObjetiveComboBox.Text) && Sbml.There(reactionObjetiveComboBox2, reactionObjetiveComboBox2.Text))
                {
                    makefba = new MakeFba();

                    int i = 0;
                    int j = 0;

                    int ii = 0;
                    int jj = 0;

                    int find = 0;

                    foreach (Reaction item in sbml.ListReaction)
                    {
                        if (item.Id == reactionObjetiveComboBox.Text)
                        {
                            reactionoptimize1 = reactionObjetiveComboBox.Text;

                            find++;

                            ii = i;
                        }
                        if (item.Id == reactionObjetiveComboBox2.Text)
                        {
                            reactionoptimize2 = reactionObjetiveComboBox2.Text;

                            find++;

                            jj = j;
                        }
                        if (find == 2)
                        {
                            break;
                        }

                        j++;
                        i++;
                    }
                    if (find == 2)
                    {
                        if (radiomax.Checked)
                        {
                            pd = OptimisationDirection.MAXIMISE;
                        }
                        else
                        {
                            pd = OptimisationDirection.MINIMISE;
                        }

                        fva = makefba.Fva(sbml, ii, jj, pd);

                        double z1 = fva.Lp1.GetObjectiveValue();
                        double z2 = fva.Lp2.GetObjectiveValue();


                        resultlist.Items.Clear();

                        string[] str = new string[3] {
                            "Z1,Z2", "Z1 = " + z1.ToString(), "Z2 = " + z2.ToString()
                        };


                        ListViewItem list = new ListViewItem(str, 0, Color.Black, Color.YellowGreen, new Font("Arial", 12));


                        resultlist.Items.Add(list);


                        for (int k = 0; k < sbml.ListReaction.Length; k++)
                        {
                            str = new string[3] {
                                sbml.ListReaction[k].Id, fva.Lp1.GetColPrimal(k + 1).ToString(), fva.Lp2.GetColPrimal(k + 1).ToString()
                            };

                            if (fva.Lp1.GetColPrimal(k + 1) == fva.Lp2.GetColPrimal(k + 1))
                            {
                                list = new ListViewItem(str);
                                resultlist.Items.Add(list);
                            }
                            else
                            {
                                list = new ListViewItem(str, 0, Color.Black, Color.YellowGreen, new Font("Arial", 12));
                                resultlist.Items.Add(list);
                            }
                        }
                        results         = true;
                        button3.Enabled = true;
                    }
                    else
                    {
                        results         = false;
                        button3.Enabled = false;

                        MessageBox.Show("This reaction not exist in the model", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("One of the functions not exist in the model", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Select the functions to optimize", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }