コード例 #1
0
 public RenameEntityCommand(SBase entity, String oldID, String newID, Model.SBML.Model model)
 {
     this.entity = entity;
     this.oldID = oldID;
     this.newID = newID;
     this.model = model;
 }
コード例 #2
0
ファイル: ReferenceLeafNode.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Add data to the ReferenceLeafNode
 /// </summary>
 /// <param name="text">
 /// A <see cref="System.String"/>
 /// </param>
 /// <param name="model">
 /// A <see cref="Model"/>
 /// </param>
 public void AddData(string text, Model model)
 {
     // Retrieve the object from the model
     SBase reference = (SBase)model.findObject(text);
     if (reference != null)
     {
         this.idReference = text;
         this.data = reference;
     }
 }
コード例 #3
0
ファイル: KineticLaw.cs プロジェクト: dorchard/mucell
 public KineticLaw(Model model, Hashtable attrs)
 {
     this.model = model;
     this.listOfParameters = new List<Parameter>();
     this.setId(attrs);
     if (attrs.Contains("formula"))
     {
         this.formula = (String)attrs["formula"];
     }
 }
コード例 #4
0
ファイル: FormulaParser.cs プロジェクト: dorchard/mucell
        public FormulaParser(Reader.SBMLReader reader, String formula, Model model)
        {
            this.formula = formula;
            this.reader = reader;
            this.model = model;

            model.InterrogateModelForMissingIDs();

            // Init the collection list
            this.formulaSpecies = new List<Species>();
            this.formulaParameters = new List<Parameter>();
            this.formulaUnknownEntities = new List<UnknownEntity>();

            // Init the operators
            this.init();
            this.formulaTree = this.makeFormulaTree(formula, false);
        }
コード例 #5
0
ファイル: KineticLaw.cs プロジェクト: dorchard/mucell
 public KineticLaw(Model model)
 {
     this.model = model;
     this.listOfParameters = new List<Parameter>();
     formula = "";
 }
コード例 #6
0
ファイル: ParameterCommand.cs プロジェクト: dorchard/mucell
 public ParameterCommand(Parameter parameter, Reaction parentReaction, Model.SBML.Model model)
 {
     this.parameter = parameter;
     this.parentReaction = parentReaction;
     this.model = model;
 }
コード例 #7
0
ファイル: SpeciesCommand.cs プロジェクト: dorchard/mucell
 public SpeciesCommand(Species species, bool adding, Model.SBML.Model model)
 {
     this.species = species;
     this.adding = adding;
     this.model = model;
 }
コード例 #8
0
ファイル: MathTree.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Checks all ReferenceLeafNodes so that they point to their SBase object.
 /// Used to complete a MathTree generated from MathML after it has been parsed and
 /// more about the model is known (such as paramters).
 /// </summary>
 /// <param name="model">
 /// A <see cref="Model"/>
 /// </param>
 public void SetSBaseReferences(Model model)
 {
     root.SetSBaseReferences(model);
 }
コード例 #9
0
ファイル: TestFormulas.cs プロジェクト: dorchard/mucell
        public void testWithVariables()
        {
            // create a formula
            MuCell.Model.SBML.Reader.SBMLReader reader = new MuCell.Model.SBML.Reader.SBMLReader();
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            Species s = new Species("X");
            s.BoundaryCondition = false;
            model.AddId(s.ID, s); // else FormulaParser can't find what X is
            reader.model = model;

            FormulaParser fp = new FormulaParser(reader, "10+sin(X)", model);
            MathTree formulaTree = fp.getFormulaTree();

            // fold the function
            CellEvaluationFunction fun = formulaTree.ToCellEvaluationFunction();

            // create a new CellInstance with a variable X
            CellInstance cell = new CellInstance(new CellDefinition());
            cell.setSpeciesAmount("X", 2.3d);

            // evaluate and test that this gets the right result
            Assert.AreEqual(10+Math.Sin(2.3), fun(new StateSnapshot(), cell));
        }
コード例 #10
0
ファイル: TestFormulas.cs プロジェクト: dorchard/mucell
        public void testWithGroup()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.Experiment experiment = new MuCell.Model.Experiment("experimen1");
            MuCell.Model.Simulation simulation = new MuCell.Model.Simulation("simulation1");
            setupExperiment(model, experiment, simulation);

            // Test parsing cell def references, group references etc.
            MuCell.Model.SBML.Reader.SBMLReader reader = new MuCell.Model.SBML.Reader.SBMLReader();
            FormulaParser fp = new FormulaParser(reader, "group1", model, experiment, simulation);
            MathTree formulaTree = fp.getFormulaTree();

            MuCell.Model.SBML.AggregateReferenceNode root = (MuCell.Model.SBML.AggregateReferenceNode)formulaTree.root;

            Assert.AreEqual("group1", root.ToString());

            Assert.AreEqual(null, root.CellDefinition);
            Assert.AreEqual("1", root.Group.ID);
            Assert.AreEqual(null, root.Species);
        }
コード例 #11
0
        public void Setup(Experiment experiment, Simulation simulation, string speciesName)
        {
            // ********* INITIAL SETUP

            // Hopf model
            MuCell.Model.SBML.Reader.SBMLReader s = new MuCell.Model.SBML.Reader.SBMLReader("../../UnitTests/smallest.Hopf.xml");

            // Cell definition 1
            MuCell.Model.CellDefinition celldef1 = new MuCell.Model.CellDefinition("celldef1");
            celldef1.addSBMLModel(s.model);

            // Create a NEW model
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.SBML.Species species1 = new MuCell.Model.SBML.Species();
            MuCell.Model.SBML.Species species2 = new MuCell.Model.SBML.Species();

            model.listOfSpecies = new List<MuCell.Model.SBML.Species>();
            model.listOfSpecies.Add(species1);
            model.listOfSpecies.Add(species2);

            // Set some values for species1
            species1.ID = speciesName;
            species1.InitialAmount = 4.0d;

            // Set some values for species2
            species2.ID = "Y";
            species2.InitialAmount = 0.1d;

            model.AddId(speciesName, species1);
            model.AddId("Y", species2);

            // Set up the reaction
            MuCell.Model.SBML.Reaction reaction1 = new MuCell.Model.SBML.Reaction("reaction1");

            model.listOfReactions = new List<MuCell.Model.SBML.Reaction>();
            model.listOfReactions.Add(reaction1);

            // Set up the kinetic law
            reaction1.KineticLaw = new MuCell.Model.SBML.KineticLaw(model);
            reaction1.KineticLaw.Formula = speciesName.Replace(' ', '_')+"*2";

            // set up the species reference for the reactants
            MuCell.Model.SBML.SpeciesReference ref1 = new MuCell.Model.SBML.SpeciesReference(species1, 1);
            // set up the species references for the products
            MuCell.Model.SBML.SpeciesReference ref2 = new MuCell.Model.SBML.SpeciesReference(species1, 0.75);
            MuCell.Model.SBML.SpeciesReference ref3 = new MuCell.Model.SBML.SpeciesReference(species2, 2);

            // Add the references
            reaction1.Reactants.Add(ref1);
            reaction1.Products.Add(ref2);
            reaction1.Products.Add(ref3);

            // set up the cell definition
            MuCell.Model.CellDefinition celldef2 = new MuCell.Model.CellDefinition("celldef2");
            celldef2.addSBMLModel(model);

            // instantiat the environment
            MuCell.Model.Vector3 size = new MuCell.Model.Vector3(1, 1, 1);
            MuCell.Model.Environment environment = new MuCell.Model.Environment(size);

            // Cells
            List<MuCell.Model.CellInstance> cells = new List<MuCell.Model.CellInstance>();

            // Create 10 cells of celldef1 and 20 cells of celldef2
            for(int i=0;i<10;i++){
                int a = ((i+2)%3)+1;
                int b = (i%3)+1;
                int c = ((i+1)%3)+1;
                CellInstance cell11 = celldef1.createCell();
                cells.Add(cell11);
                environment.AddCellToGroup(a, cell11);

                CellInstance cell21 = celldef2.createCell();
                CellInstance cell22 = celldef2.createCell();
                cells.Add(cell21);
                cells.Add(cell22);
                environment.AddCellToGroup(b, cell21);
                environment.AddCellToGroup(c, cell22);
            }

            // StateSnapshot for intial state
            MuCell.Model.StateSnapshot initialState = new MuCell.Model.StateSnapshot(cells);
            initialState.SimulationEnvironment = environment;

            // Parameters
            MuCell.Model.SimulationParameters parameters = new MuCell.Model.SimulationParameters();
            parameters.InitialState = initialState;
            parameters.SimulationLength = 0.01001d;
            parameters.SnapshotInterval = 1;
            parameters.StepTime = 0.01001d;

            parameters.SolverMethod = MuCell.Model.Solver.SolverMethods.RungeKutta;

            // Simulation
            simulation.Parameters = parameters;

            // Experiment
            experiment.addCellDefinition(celldef1);
            experiment.addCellDefinition(celldef2);
            experiment.addSimulation(simulation);

            // Start simulation
            simulation.StartSimulation();

            this.models = new List<MuCell.Model.SBML.Model>();
            this.models.Add(s.model);
            this.models.Add(model);
        }
コード例 #12
0
ファイル: GraphLayoutManager.cs プロジェクト: dorchard/mucell
        public MacroCommand rearrangeGraphFromModel(Model.SBML.Model model, IDrawingInterface drawable)
        {
            int modelDegree = model.listOfSpecies.Count;

            //convert the model to nodes and links

            List<GraphNode> nodes = new List<GraphNode>();
            List<GraphLink> links = new List<GraphLink>();

            foreach (Species n in model.listOfSpecies)
            {
                nodes.Add(new GraphNode(n, n.getPosition()));
            }
            foreach (Reaction n in model.listOfReactions)
            {
                nodes.Add(new GraphNode(n, n.getPosition()));
            }
            foreach (ComponentBase n in model.listOfComponents)
            {
                nodes.Add(new GraphNode(n, n.getPosition()));
            }

            foreach (Reaction r in model.listOfReactions)
            {
                GraphNode hubNode=findNode(r,nodes);
                if (hubNode != null)
                {
                    foreach (SimpleSpeciesReference s in r.Reactants)
                    {
                        GraphNode sNode = findNode(s.species, nodes);
                        if (sNode != null)
                        {
                            links.Add(new GraphLink(sNode, hubNode, modelDegree));
                        }
                    }
                    foreach (SimpleSpeciesReference s in r.Products)
                    {
                        GraphNode sNode = findNode(s.species, nodes);
                        if (sNode != null)
                        {
                            links.Add(new GraphLink(sNode, hubNode, modelDegree));
                        }
                    }
                    foreach (SimpleSpeciesReference s in r.Modifiers)
                    {
                        GraphNode sNode = findNode(s.species, nodes);
                        if (sNode != null)
                        {
                            links.Add(new GraphLink(sNode, hubNode, modelDegree));
                        }
                    }
                }
            }
            foreach (ComponentBase c in model.listOfComponents)
            {
                GraphNode hubNode = findNode(c, nodes);

                if (hubNode != null)
                {
                    foreach (SimpleSpeciesReference s in c.Reactants)
                    {
                        if (s != null)
                        {
                            GraphNode sNode = findNode(s.species, nodes);
                            if (sNode != null)
                            {
                                links.Add(new GraphLink(sNode, hubNode, modelDegree));
                            }
                        }
                    }
                    foreach (SimpleSpeciesReference s in c.Products)
                    {
                        if (s != null)
                        {
                            GraphNode sNode = findNode(s.species, nodes);
                            if (sNode != null)
                            {
                                links.Add(new GraphLink(sNode, hubNode, modelDegree));
                            }
                        }
                    }
                }
            }

            GraphNode[] graphNodes = nodes.ToArray();
            GraphLink[] graphLinks = links.ToArray();

            return resolveGraph(graphNodes, graphLinks, drawable);
        }
コード例 #13
0
ファイル: FormulaParser.cs プロジェクト: dorchard/mucell
		/// <summary>
		/// Constructor that includes an experiment and simulation reference which is used for formulas with aggregate functions
		/// that use references to cell definitions, groups and species
		/// </summary>
		/// <param name="reader">
		/// A <see cref="Reader.SBMLReader"/>
		/// </param>
		/// <param name="formula">
		/// A <see cref="String"/>
		/// </param>
		/// <param name="model">
		/// A <see cref="Model"/>
		/// </param>
		/// <param name="experiment">
		/// A <see cref="Experiment"/>
		/// </param>
		/// <param name="simulation">
		/// A <see cref="Simulation"/>
		/// </param>
		public FormulaParser(Reader.SBMLReader reader, String formula, Model model, Experiment experiment, Simulation simulation)
        {
            this.formula = formula;
            this.reader = reader;

            model.InterrogateModelForMissingIDs();

            //create model list
            this.models = new List<Model>();
            models.Add(model);

            // Init the collection list
            this.formulaSpecies = new List<Species>();
            this.formulaParameters = new List<Parameter>();
            this.formulaUnknownEntities = new List<UnknownEntity>();

            // Init the operators
            this.init();
            this.experiment = experiment;
            this.simulation = simulation;
            this.formulaTree = this.makeFormulaTree(formula, true);
        }
コード例 #14
0
ファイル: SBMLroot.cs プロジェクト: dorchard/mucell
 public SBMLroot(Model model)
 {
     this.model = model;
     this.level = model.level;
     this.version = model.version;
 }
コード例 #15
0
ファイル: NumberLeafNode.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Checks all ReferenceLeafNodes so that they point to their SBase object.
 /// Used to complete a MathTree generated from MathML after it has been parsed and
 /// more about the model is known (such as paramters).
 /// </summary>
 /// <param name="model">
 /// A <see cref="Model"/>
 /// </param>
 public override void SetSBaseReferences(Model model)
 {
     // Do nothing
 }
コード例 #16
0
ファイル: TestFormulas.cs プロジェクト: dorchard/mucell
        public void testApproximateUnits()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.Experiment experiment = new MuCell.Model.Experiment("experimen1");
            MuCell.Model.Simulation simulation = new MuCell.Model.Simulation("simulation1");
            setupExperiment(model, experiment, simulation);

            // Test parsing cell def references, group references etc.
            MuCell.Model.SBML.Reader.SBMLReader reader = new MuCell.Model.SBML.Reader.SBMLReader();
            FormulaParser fp = new FormulaParser(reader, "5.2", model, experiment, simulation);
            MathTree formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "5.2+10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "5.2-10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "5.2*10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "5.2/10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1+celldef2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1-celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1*celldef2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells*Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1/celldef2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1*celldef2*celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells*Cells*Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1+10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1*10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1 / 34.2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "4/celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("1/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "24/(celldef1*celldef1)", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("1/Cells*Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1.group1/(celldef1*celldef1)", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells/Cells*Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1/celldef1+10", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1.group1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1.group2 + celldef1.group1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1.group1/celldef1.group2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "143/celldef1.group1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("1/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1*4", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1*s2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration*Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1*s2*celldef1.s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration*Concentration*Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1*celldef1.group1.s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration*Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "group2.s2*celldef1.group1.s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration*Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1/s2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration/Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "4.345/s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("1/Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s1+celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "4.345/s1+celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1*celldef1.group1.s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells*Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s2/celldef1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration/Cells", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s2/celldef1+s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "s2/celldef1+celldef2", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("No units", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "celldef1/celldef1.group1.s1", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Cells/Concentration", formulaTree.ApproximateUnits());

            fp = new FormulaParser(reader, "Abs(s1)", model, experiment, simulation);
            formulaTree = fp.getFormulaTree();
            Assert.AreEqual("Concentration", formulaTree.ApproximateUnits());
        }
コード例 #17
0
ファイル: ReferenceLeafNode.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Checks all ReferenceLeafNodes so that they point to their SBase object.
 /// Used to complete a MathTree generated from MathML after it has been parsed and
 /// more about the model is known (such as paramters).
 /// </summary>
 /// <param name="model">
 /// A <see cref="Model"/>
 /// </param>
 public override void SetSBaseReferences(Model model)
 {
     if (this.idReference != null)
     {
         SBase reference = (SBase)model.findObject(this.idReference);
             if (reference != null)
             {
                 this.data = reference;
             }
     }
 }
コード例 #18
0
ファイル: TestFormulas.cs プロジェクト: dorchard/mucell
        public void testWithCellDefWithSpaces()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.Experiment experiment = new MuCell.Model.Experiment("experimen1");
            MuCell.Model.Simulation simulation = new MuCell.Model.Simulation("simulation1");
            setupExperiment(model, experiment, simulation);
            experiment.GetCellDefinition("celldef1").Name = "cell def1";

            Assert.That(experiment.ContainsCellDefinition("cell_def1"));

            // Test parsing cell def references, group references etc.
            MuCell.Model.SBML.Reader.SBMLReader reader = new MuCell.Model.SBML.Reader.SBMLReader();
            FormulaParser fp = new FormulaParser(reader, "cell_def1", model, experiment, simulation);
            MathTree formulaTree = fp.getFormulaTree();

            MuCell.Model.SBML.AggregateReferenceNode root = (MuCell.Model.SBML.AggregateReferenceNode)formulaTree.root;

            Assert.AreEqual("cell def1", root.ToString());

            Assert.AreEqual(experiment.getCellDefinitions()[0], root.CellDefinition);
            Assert.AreEqual(null, root.Group);
            Assert.AreEqual(null, root.Species);
        }
コード例 #19
0
ファイル: CellDefinition.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Base constructor
 /// </summary>
 public CellDefinition()
 {
     sbmlModel = new MuCell.Model.SBML.Model();
 }
コード例 #20
0
ファイル: TestFormulas.cs プロジェクト: dorchard/mucell
        public void testWithSpecies()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.Experiment experiment = new MuCell.Model.Experiment("experimen1");
            MuCell.Model.Simulation simulation = new MuCell.Model.Simulation("simulation1");
            setupExperiment(model, experiment, simulation);

            // Test parsing cell def references, group references etc.
            MuCell.Model.SBML.Reader.SBMLReader reader = new MuCell.Model.SBML.Reader.SBMLReader();
            FormulaParser fp = new FormulaParser(reader, "5.2+s2", model, experiment, simulation);
            MathTree formulaTree = fp.getFormulaTree();

            MuCell.Model.SBML.InnerNode root = (InnerNode)formulaTree.root;
            Assert.AreEqual(BinaryMathOperators.Plus, root.data);

            Assert.AreEqual(5.2, ((MuCell.Model.SBML.NumberLeafNode)(root.subtree.ToArray()[0])).data);

            Assert.AreEqual("5.2+s2", root.ToString());

            MuCell.Model.SBML.AggregateReferenceNode right = (MuCell.Model.SBML.AggregateReferenceNode)(root.subtree.ToArray()[1]);

            Assert.AreEqual("s2", right.ToString());

            Assert.AreEqual(null, right.CellDefinition);
            Assert.AreEqual(null, right.Group);
            Assert.AreEqual("s2", right.Species.ID);
        }
コード例 #21
0
ファイル: ReactionCommand.cs プロジェクト: dorchard/mucell
 public ReactionCommand(Reaction reaction, bool adding, Model.SBML.Model model)
 {
     this.reaction = reaction;
     this.adding = adding;
     this.model = model;
 }
コード例 #22
0
ファイル: CellDefinition.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Adds an SBML model from a file
 /// </summary>
 /// <param name="filePath">
 /// A <see cref="System.String"/>
 /// </param>
 /// <returns>
 /// A <see cref="System.Boolean"/>
 /// </returns>
 public bool addSBMLModel(string filePath)
 {
     SBML.Reader.SBMLReader reader = new SBML.Reader.SBMLReader();
     if (reader.Parse(filePath))
     {
         // Add the model
         // sbmlModels.Add(read.model);
         this.sbmlModel = reader.model;
         return true;
     }
     else
     {
         // Else fail
         return false;
     }
 }
コード例 #23
0
ファイル: Reader.cs プロジェクト: dorchard/mucell
 public void ModelElement(Hashtable attrs)
 {
     if (attrs.ContainsKey("name"))
     {
         this.model = new Model((String)attrs["name"]);
     }
     else if (attrs.ContainsKey("id"))
     {
         this.model = new Model((string)attrs["id"]);
     }
     else
         this.model = new Model();
 }
コード例 #24
0
ファイル: CellDefinition.cs プロジェクト: dorchard/mucell
 /// <summary>
 ///  	Given a filePath parse and add the SBML model defined
 ///	by the file at the filepath and  sets the SBML model
 /// </summary>
 /// <param name="filePath">
 /// A <see cref="System.String"/>
 /// </param>
 /// <returns>
 /// A <see cref="bool"/> denoting success of failure as a boolean
 /// </returns>
 /// <summary>
 /// Adds an SBML model from the object
 /// </summary>
 /// <param name="model">
 /// A <see cref="Model.SBML.Model"/>
 /// </param>
 /// <returns>
 /// A <see cref="System.Boolean"/>
 /// </returns>
 public bool addSBMLModel(Model.SBML.Model model)
 {
     this.sbmlModel = model;
     return true;
 }
コード例 #25
0
ファイル: MathNode.cs プロジェクト: dorchard/mucell
 /// <summary>
 /// Checks all ReferenceLeafNodes so that they point to their SBase object.
 /// Used to complete a MathTree generated from MathML after it has been parsed and
 /// more about the model is known (such as paramters).
 /// </summary>
 /// <param name="model">
 /// A <see cref="Model"/>
 /// </param>
 public virtual void SetSBaseReferences(Model model)
 {
 }