Wednesday, October 29, 2008

KEGG API or Pathway.xsd?

The first step of my work is to reconstruct the metabolic network.

Previously, we use Perl to extract the enzyme information from the LIGAND database of KEGG as well as the excel sheets of the Ma and Zeng database. (The latter is also based on KEGG, which should be noticed.)

Now I plan to build the whole project on the basis of Java. The first step is using the KEGG API to help reconstruct the organism-specific metabolic networks(graphs).

I can either try to use KEGG API to reconstruct the network or use the pathway.xsd which Samuel did for me before. Which one should I use?

(Sometimes I regretted a little that I gave up Perl and turned to Java. The latter is really a challenge for me, because the history that I was fear of the object-oriented programming can be tracked back to nearly 10 years ago. Anyway, I have started with it. Then don't think too much and do not always worry about the graduation. Learn it step by step, and I must be a good programmer soon.)

1. KEGG API:
Here is the description on the KEGG Java Page.


Here is the steps to get KEGG-API ready.
  1. Download the axis package(Now the latest version is axis-1.4-final).
  2. Download the axisfix.pl to generate the classes for KEGGAPI. This perl file is to fix the KEGGBindingStuf.java generated by axis. Here is the code, very simple. Delete all the text "org.apache.axis.uitls;" and "org.apache.axis.soap;" and if the there is a line who starts with 'package' then add the sentences "import org.apache.axis.utils.*;(enter)" and "import org.apache.axis.soap.*;(enter)" in the file.


  3. #!/usr/bin/perl -i
    # script to fix KEGGBindingStub.java generated by axis-1_2alpha
    while (<>) {
    s/org\.apache\.axis\.utils\.//;
    s/org\.apache\.axis\.soap\.//;
    print;
    if (/^package/) {
    print "import org.apache.axis.utils.*;\n";
    print "import org.apache.axis.soap.*;\n";
    }
    }


  4. Now the api is ready for use.




However, do remember that KEGG API just provides a web service. If you have no available internet connection, you cannot run your project maybe. Okay, let's see another way, which is to use jaxb and *.xsd to parse the pathway xml files provided by KEGG.


Thank Samuel help me to write pathway.xsd for me. This file is right to parse the KEGG xml files. Follow the steps to make it ready for your project:

1. Download and include the jaxb into the user library
2. Go to jaxb\bin and put pathway.xsd into this folder
3. Under the cmd command line, run xjc pathway.xsd
4. Done.

Yes, the answer is pathway.xsd.

No comments: