001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * <span class="pkg-marker pkg-color-fbc"><a href="group__fbc.html">fbc</a></span> 013 SBML Level 3 'fbc' to COBRA converter. 014 <p> 015 * <p style='color: #777; font-style: italic'> 016This class of objects is defined by libSBML only and has no direct 017equivalent in terms of SBML components. It is a class used in 018the implementation of extra functionality provided by libSBML. 019</p> 020 021 <p> 022 * This converter takes a model in “fbc” Version 2 format 023 * and converts it to COBRA format. 024 <p> 025 * {@link FbcToCobraConverter} is enabled by creating a {@link ConversionProperties} object 026 * with the option <code>'convert fbc to cobra'</code> (literally that 027 * full string, including the spaces), and passing this properties object to 028 * {@link SBMLDocument#convert(ConversionProperties)}. The converter 029 * offers one option: 030 <p> 031 * <ul> 032 * <li> <code>'overwriteReactionNotes':</code> should gene associations be written into 033 * the 'notes' subelement attached to {@link Reaction} objects, even if a {@link Reaction} 034 * already has 'notes' content? 035 * 036 * </ul> <p> 037 * <p> 038 * <h2>General information about the use of SBML converters</h2> 039 <p> 040 * The use of all the converters follows a similar approach. First, one 041 * creates a {@link ConversionProperties} object and calls 042 * {@link ConversionProperties#addOption(ConversionOption)} 043 * on this object with one arguments: a text string that identifies the desired 044 * converter. (The text string is specific to each converter; consult the 045 * documentation for a given converter to find out how it should be enabled.) 046 <p> 047 * Next, for some converters, the caller can optionally set some 048 * converter-specific properties using additional calls to 049 * {@link ConversionProperties#addOption(ConversionOption)}. 050 * Many converters provide the ability to 051 * configure their behavior to some extent; this is realized through the use 052 * of properties that offer different options. The default property values 053 * for each converter can be interrogated using the method 054 * {@link SBMLConverter#getDefaultProperties()} on the converter class in question . 055 <p> 056 * Finally, the caller should invoke the method 057 * {@link SBMLDocument#convert(ConversionProperties)} 058 * with the {@link ConversionProperties} object as an argument. 059 <p> 060 * <h3>Example of invoking an SBML converter</h3> 061 <p> 062 * The following code fragment illustrates an example using 063 * {@link SBMLReactionConverter}, which is invoked using the option string 064 * <code>'replaceReactions':</code> 065 <p> 066<pre class='fragment'> 067{@link ConversionProperties} props = new {@link ConversionProperties}(); 068if (props != null) { 069 props.addOption('replaceReactions'); 070} else { 071 // Deal with error. 072} 073</pre> 074<p> 075 * In the case of {@link SBMLReactionConverter}, there are no options to affect 076 * its behavior, so the next step is simply to invoke the converter on 077 * an {@link SBMLDocument} object. Continuing the example code: 078 <p> 079<pre class='fragment'> 080 // Assume that the variable 'document' has been set to an {@link SBMLDocument} object. 081 status = document.convert(config); 082 if (status != libsbml.LIBSBML_OPERATION_SUCCESS) 083 { 084 // Handle error somehow. 085 System.out.println('Error: conversion failed due to the following:'); 086 document.printErrors(); 087 } 088</pre> 089<p> 090 * Here is an example of using a converter that offers an option. The 091 * following code invokes {@link SBMLStripPackageConverter} to remove the 092 * SBML Level 3 <em>Layout</em> package from a model. It sets the name 093 * of the package to be removed by adding a value for the option named 094 * <code>'package'</code> defined by that converter: 095 <p> 096<pre class='fragment'> 097{@link ConversionProperties} config = new {@link ConversionProperties}(); 098if (config != None) { 099 config.addOption('stripPackage'); 100 config.addOption('package', 'layout'); 101 status = document.convert(config); 102 if (status != LIBSBML_OPERATION_SUCCESS) { 103 // Handle error somehow. 104 System.out.println('Error: unable to strip the {@link Layout} package'); 105 document.printErrors(); 106 } 107} else { 108 // Handle error somehow. 109 System.out.println('Error: unable to create {@link ConversionProperties} object'); 110} 111</pre> 112<p> 113 * <h3>Available SBML converters in libSBML</h3> 114 <p> 115 * LibSBML provides a number of built-in converters; by convention, their 116 * names end in <em>Converter</em>. The following are the built-in converters 117 * provided by libSBML 5.12.0 118: 119 <p> 120 * <p> 121 * <ul> 122 * <li> {@link CobraToFbcConverter} 123 * <li> {@link CompFlatteningConverter} 124 * <li> {@link FbcToCobraConverter} 125 * <li> {@link FbcV1ToV2Converter} 126 * <li> {@link FbcV2ToV1Converter} 127 * <li> {@link SBMLFunctionDefinitionConverter} 128 * <li> {@link SBMLIdConverter} 129 * <li> {@link SBMLInferUnitsConverter} 130 * <li> {@link SBMLInitialAssignmentConverter} 131 * <li> {@link SBMLLevel1Version1Converter} 132 * <li> {@link SBMLLevelVersionConverter} 133 * <li> {@link SBMLLocalParameterConverter} 134 * <li> {@link SBMLReactionConverter} 135 * <li> {@link SBMLRuleConverter} 136 * <li> {@link SBMLStripPackageConverter} 137 * <li> {@link SBMLUnitsConverter} 138 * 139 * </ul> 140 */ 141 142public class FbcToCobraConverter extends SBMLConverter { 143 private long swigCPtr; 144 145 protected FbcToCobraConverter(long cPtr, boolean cMemoryOwn) 146 { 147 super(libsbmlJNI.FbcToCobraConverter_SWIGUpcast(cPtr), cMemoryOwn); 148 swigCPtr = cPtr; 149 } 150 151 protected static long getCPtr(FbcToCobraConverter obj) 152 { 153 return (obj == null) ? 0 : obj.swigCPtr; 154 } 155 156 protected static long getCPtrAndDisown (FbcToCobraConverter obj) 157 { 158 long ptr = 0; 159 160 if (obj != null) 161 { 162 ptr = obj.swigCPtr; 163 obj.swigCMemOwn = false; 164 } 165 166 return ptr; 167 } 168 169 protected void finalize() { 170 delete(); 171 } 172 173 public synchronized void delete() { 174 if (swigCPtr != 0) { 175 if (swigCMemOwn) { 176 swigCMemOwn = false; 177 libsbmlJNI.delete_FbcToCobraConverter(swigCPtr); 178 } 179 swigCPtr = 0; 180 } 181 super.delete(); 182 } 183 184 185/** * @internal */ public 186 static void init() { 187 libsbmlJNI.FbcToCobraConverter_init(); 188 } 189 190 191/** 192 * Creates a new {@link FbcToCobraConverter} object. 193 */ public 194 FbcToCobraConverter() { 195 this(libsbmlJNI.new_FbcToCobraConverter__SWIG_0(), true); 196 } 197 198 199/** 200 * Copy constructor; creates a copy of an {@link FbcToCobraConverter} 201 * object. 202 <p> 203 * @param orig the {@link FbcToCobraConverter} object to copy. 204 */ public 205 FbcToCobraConverter(FbcToCobraConverter orig) { 206 this(libsbmlJNI.new_FbcToCobraConverter__SWIG_1(FbcToCobraConverter.getCPtr(orig), orig), true); 207 } 208 209 210/** 211 * Creates and returns a deep copy of this {@link FbcToCobraConverter} object. 212 <p> 213 * @return a (deep) copy of this {@link FbcToCobraConverter}. 214 */ public 215 SBMLConverter cloneObject() { 216 long cPtr = libsbmlJNI.FbcToCobraConverter_cloneObject(swigCPtr, this); 217 return (cPtr == 0) ? null : new FbcToCobraConverter(cPtr, true); 218 } 219 220 221/** 222 * Returns <code>true</code> if this converter object's properties match the given 223 * properties. 224 <p> 225 * A typical use of this method involves creating a {@link ConversionProperties} 226 * object, setting the options desired, and then calling this method on 227 * an {@link FbcToCobraConverter} object to find out if the object's 228 * property values match the given ones. This method is also used by 229 * {@link SBMLConverterRegistry#getConverterFor(ConversionProperties)} 230 * to search across all registered converters for one matching particular 231 * properties. 232 <p> 233 * @param props the properties to match. 234 <p> 235 * @return <code>true</code> if this converter's properties match, <code>false</code> 236 * otherwise. 237 */ public 238 boolean matchesProperties(ConversionProperties props) { 239 return libsbmlJNI.FbcToCobraConverter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props); 240 } 241 242 243/** 244 * Perform the conversion. 245 <p> 246 * This method causes the converter to do the actual conversion work, 247 * that is, to convert the {@link SBMLDocument} object set by 248 * {@link SBMLConverter#setDocument(SBMLDocument)} and 249 * with the configuration options set by 250 * {@link SBMLConverter#setProperties(ConversionProperties)}. 251 <p> 252 * <p> 253 * @return integer value indicating success/failure of the 254 * function. The possible values 255 * returned by this function are: 256 * <ul> 257 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 258 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 259 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 260 * </ul> 261 */ public 262 int convert() { 263 return libsbmlJNI.FbcToCobraConverter_convert(swigCPtr, this); 264 } 265 266 267/** 268 * Returns the default properties of this converter. 269 <p> 270 * A given converter exposes one or more properties that can be adjusted 271 * in order to influence the behavior of the converter. This method 272 * returns the <em>default</em> property settings for this converter. It is 273 * meant to be called in order to discover all the settings for the 274 * converter object. 275 <p> 276 * @return the {@link ConversionProperties} object describing the default properties 277 * for this converter. 278 */ public 279 ConversionProperties getDefaultProperties() { 280 return new ConversionProperties(libsbmlJNI.FbcToCobraConverter_getDefaultProperties(swigCPtr, this), true); 281 } 282 283}