public Dictionary <string, bool> CheckForHopfBifurcation(string sbmlInput, List <double> values,
                                                                 List <string> pNamesVector)
        {
            var result = new Dictionary <string, bool>();

            rr.loadSBML(sbmlInput);
            pValues = values;

            for (int i = 0; i < pNamesVector.Count; i++)
            {
                bool isHopfBifurcationFlag = checkHopfBifurcation(pValues, pNamesVector, i);
                result[pNamesVector[i]] = isHopfBifurcationFlag;
            }
            return(result);
        }
Esempio n. 2
0
        private void cmdSteadyState_Click(object sender, EventArgs e)
        {
            thread.QueueItem(() =>
            {
                if (m_sSBML != null)
                {
                    if (m_sSBML.Length > 0)
                    {
                        try
                        {
                            if (sim == null)
                            {
                                sim = new RoadRunner();
                            }

                            sim.loadSBML(m_sSBML);
                            sim.simulate();
                            double steadyState = sim.steadyState();
                            if (
                                MessageBox.Show(
                                    "Found steady state with sums of squares: " + steadyState +
                                    ". Do you want to use this state to be used?", "Steady state calculated",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                            {
                                return;
                            }
                            sim.simulate();
                            ArrayList floatingSpeciesNames  = sim.getFloatingSpeciesNames();
                            double[] speciesConcentrations1 = sim.getFloatingSpeciesConcentrations();
                            ArrayList boundarySpeciesNames  = sim.getBoundarySpeciesNames();
                            double[] speciesConcentrations2 = sim.getBoundarySpeciesConcentrations();
                            ArrayList parameterTupleList    = sim.getAllGlobalParameterTupleList();
                            NOM.loadSBML(m_sSBML);
                            for (int index = 0; index < floatingSpeciesNames.Count; ++index)
                            {
                                NOM.setValue((string)floatingSpeciesNames[index], speciesConcentrations1[index]);
                            }
                            for (int index = 0; index < boundarySpeciesNames.Count; ++index)
                            {
                                NOM.setValue((string)boundarySpeciesNames[index], speciesConcentrations2[index]);
                            }
                            foreach (ArrayList arrayList in parameterTupleList)
                            {
                                NOM.setValue((string)arrayList[0], (double)arrayList[1]);
                            }
                            m_sSBML = NOM.getSBML();
                            loadSBML(m_sSBML);
                            return;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Could not compute steady state due to: " + ex.Message,
                                            "Steady state could not be computed ...", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            return;
                        }
                    }
                }
                MessageBox.Show("There is no model to analyze. Load a model first.", "No Model loaded",
                                MessageBoxButtons.OK, MessageBoxIcon.Hand);
            });
        }