public static void Main(String[] args)
        {
            if (args.Length < 2 || args.Length > 3)
            {
                Console.WriteLine("Usage: FlattenModel [-p] input-filename output-filename");
                Console.WriteLine(" -p : list unused ports");
                Environment.Exit(2);
            }

            SBMLReader reader = new SBMLReader();
            SBMLWriter writer = new SBMLWriter();
            bool leavePorts = false;

            SBMLDocument doc;
            if (args.Length == 2)
            {
                doc = reader.readSBML(args[0]);
            }
            else
            {
                doc = reader.readSBML(args[1]);
                leavePorts = true;
            }

            if (doc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0)
            {
                doc.printErrors();
            }
            else
            {
                /* create a new conversion properties structure */
                ConversionProperties props = new ConversionProperties();

                /* add an option that we want to flatten */
                props.addOption("flatten comp", true, "flatten comp");

                /* add an option to leave ports if the user has requested this */
                props.addOption("leavePorts", leavePorts, "unused ports should be listed in the flattened model");

                /* perform the conversion */
                int result = doc.convert(props);
                if (result != libsbml.LIBSBML_OPERATION_SUCCESS)
                {
                    Console.WriteLine("conversion failed ... ({0})", result);
                    doc.printErrors();
                    Environment.Exit(3);
                }

                if (args.Length == 2)
                {
                    writer.writeSBML(doc, args[1]);
                }
                else
                {
                    writer.writeSBML(doc, args[2]);
                }
            }
        }
        public static void Main(string[] args)
        {
            if (args.Length != 2)
              {
            string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
            Console.WriteLine("Usage: {0} input-filename output-filename", myname);
            Environment.Exit(1);
              }

              string inputFile      = args[0];
              string outputFile     = args[1];

              if ( ! File.Exists(inputFile) )
              {
            Console.WriteLine("[Error] {0} : No such file.", inputFile);
            Environment.Exit(1);
              }

              var now = DateTime.Now.Ticks;

              SBMLReader   reader  = new SBMLReader();
              SBMLWriter   writer  = new SBMLWriter();
              SBMLDocument sbmlDoc = reader.readSBML(inputFile);

              if ( sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0)
              {
            sbmlDoc.printErrors();
            Console.WriteLine("[Error] Cannot read {0}", inputFile);
            Environment.Exit(1);
              }

              Console.WriteLine("Read {0} in {1}", inputFile, new TimeSpan(DateTime.Now.Ticks - now).TotalMilliseconds);

              /* create a new conversion properties structure */
              ConversionProperties props = new ConversionProperties();

              /* add an option that we want to convert a model  with
             L3 FBC to L2 with COBRA annotation */
              props.addOption("convert fbc to cobra", true, "Convert FBC model to Cobra model");

              now = DateTime.Now.Ticks;

              /* perform the conversion */
              int result = sbmlDoc.convert(props);
              if (result != libsbml.LIBSBML_OPERATION_SUCCESS)
              {
              	Console.WriteLine ("conversion failed ... ");
              	Environment.Exit(3);
              }

              writer.writeSBML(sbmlDoc, outputFile);

              Console.WriteLine("[OK] converted to FBC from {0} and wrote to {1}  (in {2} msec)", inputFile, outputFile, new TimeSpan(DateTime.Now.Ticks - now).TotalMilliseconds);
        }
        public static void Main(string[] args)
        {
            if (args.Length != 3)
              {
            string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
            Console.WriteLine("Usage: {0} input-filename package-to-strip output-filename", myname);
            Environment.Exit(1);
              }

              string inputFile      = args[0];
              string packageToStrip = args[1];
              string outputFile     = args[2];

              if ( ! File.Exists(inputFile) )
              {
            Console.WriteLine("[Error] {0} : No such file.", inputFile);
            Environment.Exit(1);
              }

              SBMLReader   reader  = new SBMLReader();
              SBMLWriter   writer  = new SBMLWriter();
              SBMLDocument sbmlDoc = reader.readSBML(inputFile);

              if ( sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0)
              {
            sbmlDoc.printErrors();
            Console.WriteLine("[Error] Cannot read {0}", inputFile);
            Environment.Exit(1);
              }

              /* create a new conversion properties structure */
              ConversionProperties props = new ConversionProperties();

              /* add an option that we want to strip a given package */
              props.addOption("stripPackage", true, "Strip SBML Level 3 package constructs from the model");

              /* add an option with the package we want to remove */
              props.addOption("package", packageToStrip, "Name of the SBML Level 3 package to be stripped");

              /* perform the conversion */
              if (sbmlDoc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS)
              {
              	Console.WriteLine ("conversion failed ... ");
              	Environment.Exit(3);
              }

              writer.writeSBML(sbmlDoc, outputFile);

              Console.WriteLine("[OK] Stripped package '{0}' from {1} and wrote to {2}", packageToStrip, inputFile, outputFile);
        }
        public static void Main(string[] args)
        {
            if (args.Length != 2)
              {
            string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
            Console.WriteLine("Usage: {0} input-filenameoutput-filename", myname);
            Environment.Exit(1);
              }

              string inputFile      = args[0];
              string outputFile     = args[1];

              if ( ! File.Exists(inputFile) )
              {
            Console.WriteLine("[Error] {0} : No such file.", inputFile);
            Environment.Exit(1);
              }

              SBMLReader   reader  = new SBMLReader();
              SBMLWriter   writer  = new SBMLWriter();
              SBMLDocument sbmlDoc = reader.readSBML(inputFile);

              if ( sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0)
              {
            sbmlDoc.printErrors();
            Console.WriteLine("[Error] Cannot read {0}", inputFile);
            Environment.Exit(1);
              }

              /* create a new conversion properties structure */
              ConversionProperties props = new ConversionProperties();

              /* add an option that we want to promote parameters */
              props.addOption("promoteLocalParameters", true, "Promotes all Local Parameters to Global ones");

              /* perform the conversion */
              if (sbmlDoc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS)
              {
              	Console.WriteLine ("conversion failed ... ");
              	Environment.Exit(3);
              }

              writer.writeSBML(sbmlDoc, outputFile);

              Console.WriteLine("[OK] promoted paramters from {0} and wrote to {1}", inputFile, outputFile);
        }
 /**
    * Returns the default properties of this converter.
    *
    * A given converter exposes one or more properties that can be adjusted
    * in order to influence the behavior of the converter.  This method
    * returns the @em default property settings for this converter.  It is
    * meant to be called in order to discover all the settings for the
    * converter object.
    *
    * @return the ConversionProperties object describing the default properties
    * for this converter.
    */
 public ConversionProperties getDefaultProperties()
 {
     ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLFunctionDefinitionConverter_getDefaultProperties(swigCPtr), true);
     return ret;
 }
Exemple #6
0
        public static string ConvertToL2(string model)
        {
            try
              {

            var doc = libsbml.readSBMLFromString(model);
            if (doc.isPackageEnabled("fbc"))
              doc.enablePackageInternal(doc.getNamespaces().getURI("fbc"), "fbc", false);
            var properties = new ConversionProperties(new SBMLNamespaces(2, 4));
            properties.addOption("strict", false);
            properties.addOption("setLevelAndVersion", true);
            properties.addOption("ignorePackages", true);
            doc.convert(properties);
            return libsbml.writeSBMLToString(doc);
              }
              catch// (Exception)
              {
            return model;
              }
        }
 /**
    * Returns the default properties of this converter.
    *
    * A given converter exposes one or more properties that can be adjusted
    * in order to influence the behavior of the converter.  This method
    * returns the @em default property settings for this converter.  It is
    * meant to be called in order to discover all the settings for the
    * converter object.
    *
    * @return the ConversionProperties object describing the default properties
    * for this converter.
    */
 public new ConversionProperties getDefaultProperties()
 {
     ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLLevelVersionConverter_getDefaultProperties(swigCPtr), true);
     return ret;
 }
Exemple #8
0
        private string WriteUsingFBC(int version = 1)
        {
            var doc = libsbml.readSBMLFromString(SBML);
              var model = doc.getModel();
              if (doc.getLevel() < 3)
              {
            var properties = new ConversionProperties(new SBMLNamespaces(3, 1));
            properties.addOption("strict", false);
            properties.addOption("setLevelAndVersion", true);
            properties.addOption("ignorePackages", true);
            doc.convert(properties);
              }

              if (version == 1)
              {
            doc.enablePackage(FbcExtension.getXmlnsL3V1V2(), "fbc", false);
            doc.enablePackage(FbcExtension.getXmlnsL3V1V1(), "fbc", true);
              }
              else if (version == 2)
              {
            doc.enablePackage(FbcExtension.getXmlnsL3V1V1(), "fbc", false);
            doc.enablePackage(FbcExtension.getXmlnsL3V1V2(), "fbc", true);
              }

              doc.setPackageRequired("fbc", false);

              var plugin = (FbcModelPlugin)model.getPlugin("fbc");
              if (plugin == null)
              {

            throw new Exception("Could not save using Fbc. Please check that your model contains no errors!");
              }
              plugin.getListOfFluxBounds().clear();
              plugin.getListOfGeneAssociations().clear();
              plugin.getListOfObjectives().clear();
              plugin.getListOfGeneProducts().clear();

              if (version == 1)
              {
            plugin.unsetStrict();
            foreach (var constraint in Constraints)
            {
              var bound = plugin.createFluxBound();
              bound.setReaction(constraint.Id);
              bound.setOperation(ToFbcString(constraint.Operator));
              bound.setValue(constraint.Value);
            }
              }
              else
              {

            plugin.setStrict(false);

            foreach (var constraint in Constraints)
            {
              var reaction = model.getReaction(constraint.Id);
              if (reaction == null) continue;
              var rplug = (FbcReactionPlugin)reaction.getPlugin("fbc");
              if (rplug == null) continue;

              switch (constraint.Operator)
              {
            case lpsolve_constr_types.LE:
              {
                var param = model.createParameter();
                param.setId(string.Format("fb_{0}_ub", reaction.getId()));
                param.setConstant(true);
                param.setValue(constraint.Value);
                rplug.setUpperFluxBound(param.getId());
              }
              break;
            case lpsolve_constr_types.EQ:
              {
                var param = model.createParameter();
                param.setId(string.Format("fb_{0}_ub", reaction.getId()));
                param.setConstant(true);
                param.setValue(constraint.Value);
                rplug.setUpperFluxBound(param.getId());

                param = model.createParameter();
                param.setId(string.Format("fb_{0}_lb", reaction.getId()));
                param.setConstant(true);
                param.setValue(constraint.Value);
                rplug.setLowerFluxBound(param.getId());
              }
              break;
            case lpsolve_constr_types.GE:
              {
                var param = model.createParameter();
                param.setId(string.Format("fb_{0}_lb", reaction.getId()));
                param.setConstant(true);
                param.setValue(constraint.Value);
                rplug.setLowerFluxBound(param.getId());
              }
              break;
            default:
              break;
              }

            }
              }

              var active = plugin.createObjective();
              active.setId("objective1");
              active.setType(Mode == FBA_Mode.maximize ? "maximize" : "minimize");

              foreach (var objective in Objectives)
              {
            var current = active.createFluxObjective();
            current.setReaction(objective.Id);
            current.setCoefficient(objective.Value);
              }

              plugin.setActiveObjectiveId("objective1");

              return libsbml.writeSBMLToString(doc);
        }
 /**
    * Returns the default properties of this converter.
    *
    * A given converter exposes one or more properties that can be adjusted
    * in order to influence the behavior of the converter.  This method
    * returns the @em default property settings for this converter.  It is
    * meant to be called in order to discover all the settings for the
    * converter object.  The run-time properties of the converter object can
    * be adjusted by using the method
    * SBMLConverter::setProperties(ConversionProperties props).
    *
    * @return the default properties for the converter.
    *
    * @see setProperties(@if java ConversionProperties@endif)
    * @see matchesProperties(@if java ConversionProperties@endif)
    */
 public virtual ConversionProperties getDefaultProperties()
 {
     ConversionProperties ret = new ConversionProperties((SwigDerivedClassHasMethod("getDefaultProperties", swigMethodTypes3) ? libsbmlPINVOKE.SBMLConverter_getDefaultPropertiesSwigExplicitSBMLConverter(swigCPtr) : libsbmlPINVOKE.SBMLConverter_getDefaultProperties(swigCPtr)), true);
     return ret;
 }
 /**
    * Returns the converter that best matches the given configuration
    * properties.
    *
    * Many converters provide the ability to configure their behavior.  This
    * is realized through the use of @em properties that offer different @em
    * options.  The present method allows callers to search for converters
    * that have specific property values.  Callers can do this by creating a
    * ConversionProperties object, adding the desired option(s) to the
    * object, then passing the object to this method.
    *
    * @param props a ConversionProperties object defining the properties
    * to match against.
    *
    * @return the converter matching the properties, or @c null if no
    * suitable converter is found.
    *
    * @see getConverterByIndex(@if java int@endif)
    */
 public SBMLConverter getConverterFor(ConversionProperties props)
 {
     SBMLConverter ret
     = (SBMLConverter) libsbml.DowncastSBMLConverter(libsbmlPINVOKE.SBMLConverterRegistry_getConverterFor(swigCPtr, ConversionProperties.getCPtr(props)), false);
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #11
0
        public string WriteAsCobraAnnotation()
        {
            var doc = libsbml.readSBMLFromString(SBML);
              var model = doc.getModel();
              if (doc.getLevel() < 3)
              {
            var properties = new ConversionProperties(new SBMLNamespaces(3, 1));
            properties.addOption("strict", false);
            properties.addOption("setLevelAndVersion", true);
            properties.addOption("ignorePackages", true);
            doc.convert(properties);
              }
              doc.enablePackage(FbcExtension.getXmlnsL3V1V1(), "fbc", true);
              var plugin = (FbcModelPlugin)model.getPlugin("fbc");
              if (plugin == null)
              {

            throw new Exception("Could not save using Fbc. Please check that your model contains no errors!");
              }
              plugin.getListOfFluxBounds().clear();
              plugin.getListOfGeneAssociations().clear();
              plugin.getListOfObjectives().clear();

              foreach (var constraint in Constraints)
              {
            var bound = plugin.createFluxBound();
            bound.setReaction(constraint.Id);
            bound.setOperation(ToFbcString(constraint.Operator));
            bound.setValue(constraint.Value);
              }

              var active = plugin.createObjective();
              active.setId("objective1");
              active.setType(Mode == FBA_Mode.maximize ? "maximize" : "minimize");

              foreach (var objective in Objectives)
              {
            var current = active.createFluxObjective();
            current.setReaction(objective.Id);
            current.setCoefficient(objective.Value);
              }

              plugin.setActiveObjectiveId("objective1");

              // convert to COBRA
              var props = new ConversionProperties();
              props.addOption("convert fbc to cobra", true, "Convert FBC model to Cobra model");
              if (doc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS)
              {
            throw new Exception(doc.getErrorLog().toString());
              }

              model = doc.getModel();
              plugin = (FbcModelPlugin)model.getPlugin("fbc");
              if (plugin != null)
              {
            plugin.getListOfGeneProducts().clear();
            plugin.getListOfGeneAssociations().clear();
            plugin.getListOfFluxBounds().clear();
            plugin.getListOfObjectives().clear();
              }
              return libsbml.writeSBMLToString(doc);
        }
 ConversionProperties(ConversionProperties orig) : this(libsbmlPINVOKE.new_ConversionProperties__SWIG_2(ConversionProperties.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 private IntPtr SwigDirectorgetProperties()
 {
     return(ConversionProperties.getCPtr(getProperties()).Handle);
 }
        int setProperties(ConversionProperties props)
        {
            int ret = (SwigDerivedClassHasMethod("setProperties", swigMethodTypes7) ? libsbmlPINVOKE.SBMLConverter_setPropertiesSwigExplicitSBMLConverter(swigCPtr, ConversionProperties.getCPtr(props)) : libsbmlPINVOKE.SBMLConverter_setProperties(swigCPtr, ConversionProperties.getCPtr(props)));

            return(ret);
        }
        bool matchesProperties(ConversionProperties props)
        {
            bool ret = (SwigDerivedClassHasMethod("matchesProperties", swigMethodTypes5) ? libsbmlPINVOKE.SBMLConverter_matchesPropertiesSwigExplicitSBMLConverter(swigCPtr, ConversionProperties.getCPtr(props)) : libsbmlPINVOKE.SBMLConverter_matchesProperties(swigCPtr, ConversionProperties.getCPtr(props)));

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        ConversionProperties getDefaultProperties()
        {
            ConversionProperties ret = new ConversionProperties((SwigDerivedClassHasMethod("getDefaultProperties", swigMethodTypes3) ? libsbmlPINVOKE.SBMLConverter_getDefaultPropertiesSwigExplicitSBMLConverter(swigCPtr) : libsbmlPINVOKE.SBMLConverter_getDefaultProperties(swigCPtr)), true);

            return(ret);
        }
Exemple #17
0
        SBMLConverter getConverterFor(ConversionProperties props)
        {
            IntPtr        cPtr = libsbmlPINVOKE.SBMLConverterRegistry_getConverterFor(swigCPtr, ConversionProperties.getCPtr(props));
            SBMLConverter ret  = (cPtr == IntPtr.Zero) ? null : new SBMLConverter(cPtr, false);

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        ConversionProperties getDefaultProperties()
        {
            ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLInitialAssignmentConverter_getDefaultProperties(swigCPtr), true);

            return(ret);
        }
 /**
    * Returns the converter that best matches the given configuration
    * properties.
    *
    * Many converters provide the ability to configure their behavior.  This
    * is realized through the use of @em properties that offer different @em
    * options.  The present method allows callers to search for converters
    * that have specific property values.  Callers can do this by creating a
    * ConversionProperties object, adding the desired option(s) to the
    * object, then passing the object to this method.
    *
    * @param props a ConversionProperties object defining the properties
    * to match against.
    *
    * @return the converter matching the properties, or @c null if no
    * suitable converter is found.
    *
    * @see getConverterByIndex(@if java int index@endif)
    */
 public SBMLConverter getConverterFor(ConversionProperties props)
 {
     IntPtr cPtr = libsbmlPINVOKE.SBMLConverterRegistry_getConverterFor(swigCPtr, ConversionProperties.getCPtr(props));
     SBMLConverter ret = (cPtr == IntPtr.Zero) ? null : new SBMLConverter(cPtr, false);
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 internal static HandleRef getCPtr(ConversionProperties obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 /**
    * Sets the configuration properties to be used by this converter.
    *
    * @param props the ConversionProperties object defining the properties
    * to set.
    *
    * @return integer value indicating the success/failure of the operation.
    * @if clike The value is drawn from the enumeration
    * #OperationReturnValues_t. @endif The set of possible values that may
    * be returned ultimately depends on the specific subclass of
    * SBMLConverter being used, but the default method can return the
    * following values:
    * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
    *
    * @see getProperties()
    * @see matchesProperties(@if java ConversionProperties@endif)
    */
 public virtual int setProperties(ConversionProperties props)
 {
     int ret = (SwigDerivedClassHasMethod("setProperties", swigMethodTypes7) ? libsbmlPINVOKE.SBMLConverter_setPropertiesSwigExplicitSBMLConverter(swigCPtr, ConversionProperties.getCPtr(props)) : libsbmlPINVOKE.SBMLConverter_setProperties(swigCPtr, ConversionProperties.getCPtr(props)));
     return ret;
 }
 /**
    * Returns the default properties of this converter.
    *
    * A given converter exposes one or more properties that can be adjusted
    * in order to influence the behavior of the converter.  This method
    * returns the @em default property settings for this converter.  It is
    * meant to be called in order to discover all the settings for the
    * converter object.
    *
    * @return the ConversionProperties object describing the default properties
    * for this converter.
    */
 public ConversionProperties getDefaultProperties()
 {
     ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLStripPackageConverter_getDefaultProperties(swigCPtr), true);
     return ret;
 }
 /**
    * Copy constructor.
    *
    * @param orig the object to copy.
    */
 public ConversionProperties(ConversionProperties orig)
     : this(libsbmlPINVOKE.new_ConversionProperties__SWIG_2(ConversionProperties.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 /**
    * Converts this document using the converter that best matches
    * the given conversion properties.
    *
    * @param props the conversion properties to use
    *
    *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
    * @li @link libsbml#LIBSBML_CONV_CONVERSION_NOT_AVAILABLE LIBSBML_CONV_CONVERSION_NOT_AVAILABLE@endlink
    */
 public new int convert(ConversionProperties props)
 {
     int ret = libsbmlPINVOKE.SBMLDocument_convert(swigCPtr, ConversionProperties.getCPtr(props));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
        internal static HandleRef getCPtrAndDisown(ConversionProperties obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
 /**
    * Returns @c true if this converter matches the given properties.
    *
    * Given a ConversionProperties object @p props, this method checks that @p
    * props possesses an option value to enable this converter.  If it does,
    * this method returns @c true.
    *
    * @param props the properties to match.
    *
    * @return @c true if the properties @p props would match the necessary
    * properties for this type of converter, @c false otherwise.
    */
 public virtual bool matchesProperties(ConversionProperties props)
 {
     bool ret = (SwigDerivedClassHasMethod("matchesProperties", swigMethodTypes5) ? libsbmlPINVOKE.SBMLConverter_matchesPropertiesSwigExplicitSBMLConverter(swigCPtr, ConversionProperties.getCPtr(props)) : libsbmlPINVOKE.SBMLConverter_matchesProperties(swigCPtr, ConversionProperties.getCPtr(props)));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #27
0
        private void InitializeFromCobraAnnotation(string sbmlContent)
        {
            try
              {
            var doc = libsbml.readSBMLFromString(sbmlContent);
            var props = new ConversionProperties();
            props.addOption("convert cobra", true, "");
            if (doc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS)
              return;
            InitializeFromSBMLDocument(doc);
              }
              catch
              {

              }
        }
 /**
    * Returns the default properties of this converter.
    *
    * A given converter exposes one or more properties that can be adjusted
    * in order to influence the behavior of the converter.  This method
    * returns the @em default property settings for this converter.  It is
    * meant to be called in order to discover all the settings for the
    * converter object.
    *
    * @return the ConversionProperties object describing the default properties
    * for this converter.
    */
 public new ConversionProperties getDefaultProperties()
 {
     ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLInitialAssignmentConverter_getDefaultProperties(swigCPtr), true);
     return ret;
 }
Exemple #29
0
        ConversionProperties getDefaultProperties()
        {
            ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLFunctionDefinitionConverter_getDefaultProperties(swigCPtr), true);

            return(ret);
        }
 internal static HandleRef getCPtr(ConversionProperties obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Exemple #31
0
        SBMLConverter getConverterFor(ConversionProperties props)
        {
            SBMLConverter ret
                = (SBMLConverter)libsbml.DowncastSBMLConverter(libsbmlPINVOKE.SBMLConverterRegistry_getConverterFor(swigCPtr, ConversionProperties.getCPtr(props)), false);

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #32
0
        bool matchesProperties(ConversionProperties props)
        {
            bool ret = libsbmlPINVOKE.SBMLStripPackageConverter_matchesProperties(swigCPtr, ConversionProperties.getCPtr(props));

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemple #33
0
        ConversionProperties getDefaultProperties()
        {
            ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLStripPackageConverter_getDefaultProperties(swigCPtr), true);

            return(ret);
        }
 /**
    * Returns @c true if this converter object's properties match the given
    * properties.
    *
    * A typical use of this method involves creating a ConversionProperties
    * object, setting the options desired, and then calling this method on
    * an SBMLLevelVersionConverter object to find out if the object's
    * property values match the given ones.  This method is also used by
    * SBMLConverterRegistry::getConverterFor(@if java ConversionProperties@endif)
    * to search across all registered converters for one matching particular
    * properties.
    *
    * @param props the properties to match.
    *
    * @return @c true if this converter's properties match, @c false
    * otherwise.
    */
 public new bool matchesProperties(ConversionProperties props)
 {
     bool ret = libsbmlPINVOKE.SBMLLevelVersionConverter_matchesProperties(swigCPtr, ConversionProperties.getCPtr(props));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemple #35
0
        ConversionProperties getDefaultProperties()
        {
            ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLLocalParameterConverter_getDefaultProperties(swigCPtr), true);

            return(ret);
        }