This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Convert Kegg Kgml To Graph

Hello,

I ran Kegg/Kaas module and the pathways in xml format through KGML. is there a tool out there which can convert this to a graph?

I tried Visant but it always gives me some errors.

Thank you

kegg xml graph

3 answers

have a look at the bioconductor package KEGGgraph. In a recent How To Get The Topology Of A Kegg Pathway? I listed some of the KEGGgraph functions relevant to get a graph from KGML.

I'm not an expert of KGML . I only played with http://code.google.com/p/kgmlreader/source/browse/trunk/KGMLReader/testData/kgml/non-metabolic/organisms/hsa/hsa04060.xml and I created a XSLT stylesheet ( https://github.com/lindenb/xslt-sandbox/blob/master/stylesheets/bio/kgml/kgml2gexf.xsl ) to convert this kgml to gexf (you can open it with http://www.gephi.org ).

$ xsltproc --novalid kgml2gexf.xsl \
  "http://kgmlreader.googlecode.com/svn/trunk/KGMLReader/testData/kgml/non-metabolic/organisms/hsa/hsa04060.xml" > result.gexf


<gexf xmlns="&lt;a href=" http:="" www.gexf.net="" 1.2draft"="" rel="nofollow">http://www.gexf.net/1.2draft" xmlns:g="http://www.gexf.net/1.2draft" xmlns:viz="http://www.
gexf.net/1.1draft/viz" version="1.2">
  <meta>
    <creator>Pierre Lindenbaum</creator>
    <description>KGML</description>
  </meta>
  <attributes class="node">
    <attribute id="0" title="gene" type="string"/>
    <attribute id="1" title="url" type="string"/>
  </attributes>
  <attributes class="edge">
    <attribute id="10" title="type" type="string"/>
  </attributes>
  <graph mode="static" defaultedgetype="directed">
    <nodes>
      <node id="1" label="hsa:53833">
        <attvalues>
          <attvalue for="0" value="gene"/>
          <attvalue for="1" value="&lt;a href=" http:="" www.kegg.jp="" dbget-bin="" www_bget?hsa:53833"="" rel="nofollow">http://www.kegg.jp/dbget-bin/www_bget?hsa:53833"/>
        </attvalues>
      </node>
      <node id="2" label="hsa:53833">
        <attvalues>
          <attvalue for="0" value="gene"/>
          <attvalue for="1" value="&lt;a href=" http:="" www.kegg.jp="" dbget-bin="" www_bget?hsa:53833"="" rel="nofollow">http://www.kegg.jp/dbget-bin/www_bget?hsa:53833"/>
        </attvalues>
      </node>
      <node id="3" label="hsa:3565">
        <attvalues>
          <attvalue for="0" value="gene"/>
          <attvalue for="1" value="&lt;a href=" http:="" www.kegg.jp="" dbget-bin="" www_bget?hsa:3565"="" rel="nofollow">http://www.kegg.jp/dbget-bin/www_bget?hsa:3565"/>
        </attvalues>
      </node>
     (...)

I wrote a python script to convert KGML to directed graphs. Also, it converts them to DAGs. If you don't need it, you may customize the kegg.py file. Nodes represent genes, and if there is a relation between gene A to gene B, I insert an edge from A to B.

https://github.com/haluk/kegg.git

Log in to answer this question.