File: removeRenderInformation.py

package info (click to toggle)
libsbml 5.19.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 157,308 kB
  • sloc: cpp: 972,686; xml: 332,385; python: 128,188; cs: 57,289; ansic: 54,332; java: 27,244; makefile: 9,740; perl: 9,114; sh: 8,777; ruby: 4,760; javascript: 1,605; php: 202; csh: 3
file content (50 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 
# @file    removeRenderInformation.py
# @brief   removes render information from the given SBML file
# @author  Frank Bergmann
# 
# This file is part of libSBML.  Please visit http:#sbml.org for more
# information about SBML, and the latest version of libSBML.
# 
import sys
import os.path
from libsbml import *



def main (args):
  """
    Usage:  removeRenderInformation <input file> <output file>
            removes the render information object from the input file.
  """
  
  if (len(args) != 3):
        print(main.__doc__)
        return 1

  inputFile = args[1];
  outputFile = args[2];

  doc = readSBMLFromFile(inputFile)
  numErrors = doc.getNumErrors()

  if (numErrors > 0):
      print( "Encountered errors while reading the file. " );
      print( "Please correct the following errors and try again." );
      doc.printErrors();
      return 2;

  plugin = doc.getPlugin("render");
  if (plugin == None):
      print( "Warning: the document did not use the render information in the first place. " );
  else:
      # simply disable the package, this will cause it to no longer being written out
      doc.disablePackage(plugin.getURI(), plugin.getPrefix());

  writeSBMLToFile(doc, outputFile);

  return 0;


if __name__ == '__main__':
  main(sys.argv)