Tutorial Customize Export

is a widely applied standard format for metabolic pathways. Metannogen can export the network as SBML. For many cases this file format will be sufficient.

However, depending on the project, there may be project specific requirements for the export file. This is particularly the case for formats other than SBML such as CSV.

This tutorial explains, how the export formats of Metannogen are customized. If you just want other non-standard XML attributes added to the <reaction...>-tag you do not need this tutorial. Just use the command line option -attributes. Complex XML structure after the closing reaction tag may also be inserted. Simply mark the text in the multiline text area of the dataset with XML_BEGIN and XML_END. This creates an attribute with name "XML". The Text is directly inserted after the reaction definition

As a test case we assume that the biochemical reactions should be stored in a . For this purpose Metannogen would need to export a file with syntax.

This tutorial explains, how the export scripts of Metannogen are modified by the user.

Starting Metannogen

Before working up this tutorial, you should be familiar with the program. Please start Metannogen. Load a small dataset file or or create a few datasets.

Export

Figure: Screen-shot of the export dialog. Each individual export format (SBML, Text, SQL) has its own tab in the export dialog. Each tab has 7 panels such that the user could have up to seven different versions of the export script. The data in the datasets are exported to the respective format on pressing one of the "Export"-button. With the "Change"-button, the source code can be modified.
screenshot
  1. Open the export dialog "Menu-bar>File>Export>Export to SQL" (See figure)
  2. Select the "Export SQL"-Tab.
  3. Press the "Export SQL" button in panel 1. A text pane with the exported data appears. This SQL-format is incomplete and we need to modify it.
  4. Expand the "+ Modify java source" toggle in the bottom of the dialog. There are 7 panels because you could modify and use 7 distinct versions. Regard the panel 1.
  5. Press the "Change" button to open the source code. Metannogen will choose a text editor with syntax highlighting from the text editors installed on your computer. If you prefer a different editor then press the "Settings" button.
  6. Find the line
    sb=new StringBuffer(100*1000); 
  7. A StringBuffer is a mutable sequence of characters. Text can be appended with the append method. Please insert the following line after the StringBuffer-declaration:
    sb.append("Hello World\n"); 
    Then save the modified text. The Backslash-n is interpreted as a character.
  8. Press the "Export SQL" button again. The "Compiler messages" window will pop up. If the compiler reports syntax errors, these need to be corrected correct. Deliberately create a syntax error, for example forget the trailing semicolon. Then save the file, press "Export SQL" again and watch the error report.
  9. In case of successful compilation a is generated. The toString()-method of this class is called by Metannogen to obtain the text for the output file. Please find the "Hello world" string in the exported text.

More complicated changes

As you are familiar with the modify-save-compile-run cycle you are ready for more complicated changes. Only four classes are needed. Study the class descriptions for the following four classes:

Usage from the command line

The modified export script can also be used from the command line without GUI. This allows usage of Metannogen in automated scripts. The dataset source needs to be specified with the -datasets option. The file name needs to be given after the -toSQL1 option. If the source code in panel 2 was modified then the option -toSQL2 would be required.