示例#1
0
        /// <summary>
        /// [ RuleStruct ]
        /// [[ RuleType, Formula, Variable ]]
        /// </summary>
        /// <param name="aSBMLmodel"></param>
        /// <returns></returns>
        public static List<RuleStruct> getRule(Model aSBMLmodel)
        {
            List<RuleStruct> list = new List<RuleStruct>();

            ListOfRules rules = aSBMLmodel.getListOfRules();
            for (int i = 0; i < rules.size(); i++ )
            {
                Rule aRule = aSBMLmodel.getRule(i);

                int aRuleType = aRule.getTypeCode();
                string aFormula = aRule.getFormula();
                string aVariable = null;

                if ( aRuleType == libsbml.libsbml.SBML_ALGEBRAIC_RULE )
                    aVariable = "";
                else if (aRuleType == libsbml.libsbml.SBML_ASSIGNMENT_RULE ||
                       aRuleType == libsbml.libsbml.SBML_RATE_RULE)
                    aVariable = aRule.getVariable();
                //else if (aRuleType == libsbml.libsbml.SBML_SPECIES_CONCENTRATION_RULE)
                //    aVariable = aRule.getSpecies();
                //else if (aRuleType == libsbml.libsbml.SBML_COMPARTMENT_VOLUME_RULE)
                //    aVariable = aRule.getCompartment();
                // ToDo: LibSBML3.2C#で呼び出せない。どうするか検討する。
                else if (aRuleType == libsbml.libsbml.SBML_PARAMETER_RULE)
                    aVariable = aRule.getName();
                else
                    throw new EcellException(" The type of Rule must be Algebraic, Assignment or Rate Rule");

                RuleStruct rule = new RuleStruct(
                    aRuleType,
                    aFormula,
                    aVariable );

                list.Add(rule);
            }

            return list;
        }
示例#2
0
 public void TestConstructorOfStructs()
 {
     //
     CompartmentStruct c = new CompartmentStruct(
         "ID",
         "Name",
         0,
         0.0,
         0.0,
         "Unit",
         "Parent",
         false);
     //
     EventStruct e = new EventStruct(
         "ID",
         "Name",
         "Trigger",
         "delay",
         "TimeUnit",
         new List<EventAssignmentStruct>());
     //
     EventAssignmentStruct ea = new EventAssignmentStruct(
         "Variable",
         "Formula");
     //
     FunctionDefinitionStruct fd = new FunctionDefinitionStruct(
         "ID",
         "Name",
         "Formula");
     //
     ParameterStruct p = new ParameterStruct(
         "ID",
         "Name",
         0.0,
         "Unit",
         false);
     //
     ReactionStruct r = new ReactionStruct(
         "ID",
         "Name",
         new List<KineticLawStruct>(),
         false,
         false,
         new List<ReactantStruct>(),
         new List<ProductStruct>(),
         new List<string>());
     //
     KineticLawStruct k = new KineticLawStruct(
         "Formula",
         new List<string>(),
         "TimeUnit",
         "Substance",
         new List<ParameterStruct>(),
         null);
     //
     ReactantStruct rs = new ReactantStruct(
         "Species",
         0,
         "Formula",
         0);
     //
     ProductStruct ps = new ProductStruct(
         "Species",
         0.0,
         "Formula",
         0);
     //
     RuleStruct rule = new RuleStruct(
         0,
         "Formula",
         "Variable");
     //
     SpeciesStruct s = new SpeciesStruct(
         "ID",
         "Name",
         "Parent",
         0.0,
         0.0,
         "Substance",
         "Spatial",
         "Unit",
         false,
         false,
         0,
         false);
     //
     UnitDefinitionStruct ud = new UnitDefinitionStruct(
         "ID",
         "Name",
         new List<UnitStruct>());
     //
     UnitStruct u = new UnitStruct(
         "Kind",
         0,
         0,
         0.0,
         0.0);
     //
     VariableReferenceStruct v = new VariableReferenceStruct(
         "Name",
         "Variable",
         0);
     //
     InitialAssignmentStruct i = new InitialAssignmentStruct(
         "Name",
         0.0);
 }