Team:Shenzhen BGIC 0101/Tutorial/kgml

From 2013.igem.org

(Difference between revisions)
(Created page with "{{:Team:Shenzhen_BGIC_0101/Templates/Header}} <html> <body> <b><h1>Tutorial</h1></b> <br/> <hr style="color:#7380AE; height:2px;" /> <h1> Presentation from KGML </h1> <p> This m...")
Line 8: Line 8:
<h1> Presentation from KGML </h1>
<h1> Presentation from KGML </h1>
<p> This module will grab genes’ details in different pathways, which from KEGG with KEGG Makeup Language (KGML) file and export genes list and relationship of genes. The goal here is to visualize the pathway and rebuild it in the level of genes.</p>
<p> This module will grab genes’ details in different pathways, which from KEGG with KEGG Makeup Language (KGML) file and export genes list and relationship of genes. The goal here is to visualize the pathway and rebuild it in the level of genes.</p>
-
           <p>Scripts<br/>1. keggid_convert_gene.pl</p>
+
           <h2>Scripts</h2><br/>
-
<p> This utility can convert KEGGID which in KGML file into genes’ name and rewrite KGML file.</p>
+
           <h3>convert.py</h3>
-
          <p>Internal operation</p>
+
-
<p> First, this utility will change the pathway’s name into KEGG database names, and then open the file with the entire list of genes, push them in hash.<br/>
+
-
Second, this utility will read the original pathway’s xml file in and replace KEGGID with gene’s name one by one. Furthermore, it will change type element all into “gene”.<br/>
+
-
Thirdly, it will be the substitution of original pathway’s xml file.</p>
+
-
          <p>Example</p>
+
-
<p> perl keggid_convert_gene.pl ko04010</p>
+
-
          <p>The format of output:</p>
+
-
<p>It will rewrite the original pathway’s xml file, if we have following statement:<br/>
+
-
<entry id="30" name="ko:K08018" type="ortholog"<br/>
+
-
After running this scripts, it will turn into:<br/><entry id="30" name=" RAPGEF2, PDZGEF1" type="gene" </p>
+
-
           <p>convert.py</p>
+
<p> This utility will read in KGML file which have been rewritten before, and grab genes’ information, such as genes’ name, genes’ relationship and then convert these into JSON.</p>
<p> This utility will read in KGML file which have been rewritten before, and grab genes’ information, such as genes’ name, genes’ relationship and then convert these into JSON.</p>
-
           <p>Internal operation</p>
+
           <p><b>Internal operation</b></p>
<p> First, this utility will use the parameter –f to determine the specified file and read it in. The output file will use the file name that put forward.<br/>
<p> First, this utility will use the parameter –f to determine the specified file and read it in. The output file will use the file name that put forward.<br/>
Second, this utility convert KGML file into JSON and grab the information of genes, such as the reactions of genes and the relationship between genes.<br/>
Second, this utility convert KGML file into JSON and grab the information of genes, such as the reactions of genes and the relationship between genes.<br/>
Third, this utility continue to integrate the information above into two files, ‘gene.json’ and ‘relation.json’, which can be use directly in rewrite gene’s pathway.</p>
Third, this utility continue to integrate the information above into two files, ‘gene.json’ and ‘relation.json’, which can be use directly in rewrite gene’s pathway.</p>
-
           <p>Example</p>
+
           <p><b>Example</b></p>
<p> python convert.py –f sce04111</p>
<p> python convert.py –f sce04111</p>
-
           <p>Parameters:</p>
+
           <p><b>Parameters:</b></p>
<table border='1'><tbody>
<table border='1'><tbody>
<tr><th></th><th>default</th></tr>
<tr><th></th><th>default</th></tr>
<tr><th>-f/--file</th><th>read KGML from FILENAME(omit '.xml'), produce two files: gene list and relation</th></tr>
<tr><th>-f/--file</th><th>read KGML from FILENAME(omit '.xml'), produce two files: gene list and relation</th></tr>
</tbody></table>
</tbody></table>
-
           <p>The format of output:</p>
+
           <p><b>The format of output:</b></p>
<p>The output file is stored in the path where you running this program.<br/>
<p>The output file is stored in the path where you running this program.<br/>
1. _gene.json <br/>
1. _gene.json <br/>
Line 75: Line 64:
</tbody></table>
</tbody></table>
</p>
</p>
-
     <br/>    <p>Shortcoming</p>
+
     <br/>    <p><b>Shortcoming</b></p>
<p>We can’t automatic acquisition KGML file in the KEGG API, all the demo we have show need to be downloaded before. You can get the entire list of one database genes through KEGG API, just like http://rest.kegg.jp/list/ko , it shows the entire list of orthology genes. The download method about KGML files shows in “How to finish this plun-in” part.
<p>We can’t automatic acquisition KGML file in the KEGG API, all the demo we have show need to be downloaded before. You can get the entire list of one database genes through KEGG API, just like http://rest.kegg.jp/list/ko , it shows the entire list of orthology genes. The download method about KGML files shows in “How to finish this plun-in” part.
Some genes will relate to another pathway but it doesn’t shows in the pathway so we are failed to grab the relationships between genes and pathways automatically. So we added two gene-pathway relations in ko04010 demo manually, TP53 gene connected with ko04115: P53 signaling pathway and NLK gene connected with ko04310: WNT signaling pathway.
Some genes will relate to another pathway but it doesn’t shows in the pathway so we are failed to grab the relationships between genes and pathways automatically. So we added two gene-pathway relations in ko04010 demo manually, TP53 gene connected with ko04115: P53 signaling pathway and NLK gene connected with ko04310: WNT signaling pathway.
Line 97: Line 86:
<img src="https://static.igem.org/mediawiki/2013/c/c5/T4-4.png" /><br/>
<img src="https://static.igem.org/mediawiki/2013/c/c5/T4-4.png" /><br/>
The entry element can be path/ko/ec/rn/cpd/gl/org/group, enzyme/protein/gene will have relation and gene will also have compound and reactions. We choose one relation to be example:<br/>  
The entry element can be path/ko/ec/rn/cpd/gl/org/group, enzyme/protein/gene will have relation and gene will also have compound and reactions. We choose one relation to be example:<br/>  
-
<img src="https://static.igem.org/mediawiki/2013/2/27/T4-5.png" />
+
<img src="https://static.igem.org/mediawiki/2013/2/27/T4-5.png" /><br/>
It means that gene (YCL061C) have activation effect in gene (YPL153C).By the way, through the graphics elements, we can definitely rewrite the connection between these two genes.<br/>  
It means that gene (YCL061C) have activation effect in gene (YPL153C).By the way, through the graphics elements, we can definitely rewrite the connection between these two genes.<br/>  

Revision as of 05:37, 28 October 2013






Tutorial



Presentation from KGML

This module will grab genes’ details in different pathways, which from KEGG with KEGG Makeup Language (KGML) file and export genes list and relationship of genes. The goal here is to visualize the pathway and rebuild it in the level of genes.

Scripts


convert.py

This utility will read in KGML file which have been rewritten before, and grab genes’ information, such as genes’ name, genes’ relationship and then convert these into JSON.

Internal operation

First, this utility will use the parameter –f to determine the specified file and read it in. The output file will use the file name that put forward.
Second, this utility convert KGML file into JSON and grab the information of genes, such as the reactions of genes and the relationship between genes.
Third, this utility continue to integrate the information above into two files, ‘gene.json’ and ‘relation.json’, which can be use directly in rewrite gene’s pathway.

Example

python convert.py –f sce04111

Parameters:

default
-f/--fileread KGML from FILENAME(omit '.xml'), produce two files: gene list and relation

The format of output:

The output file is stored in the path where you running this program.
1. _gene.json
type:

orthologKO (orthology group)
enzymeEnzyme
reactionReaction
genegene product (mostly a protein)
groupa complex of gene products (mostly a protein complex)
geneID:the unique identification of gene
namethe KEGGID of this gene
typethe type of this gene
reaction:
namethe KEGGID of this reaction
reversibletrue: reversible reaction; false: irreversible reaction
substratesKEGGID of substrate node
productsthe KEGGID of product node
related-reactionsrelate to another pathway or gene
2. _relation.json relations:
typeThe type of this relation[ ECrel, PPrel. GErel, PCrel, maplink]
subtypeInteraction/relation information[activation/inhibition]
entry1The first (from) entry that defines this relation
entry2The second (to) entry that defines this relation
entry1&2:
entry IDThe KEGGID of node which takes part in this relation
typeHave only two options: [gene/group]
nameThe KEGGID of this gene
groupThe node is a complex of gene products (mostly a protein complex)


Shortcoming

We can’t automatic acquisition KGML file in the KEGG API, all the demo we have show need to be downloaded before. You can get the entire list of one database genes through KEGG API, just like http://rest.kegg.jp/list/ko , it shows the entire list of orthology genes. The download method about KGML files shows in “How to finish this plun-in” part. Some genes will relate to another pathway but it doesn’t shows in the pathway so we are failed to grab the relationships between genes and pathways automatically. So we added two gene-pathway relations in ko04010 demo manually, TP53 gene connected with ko04115: P53 signaling pathway and NLK gene connected with ko04310: WNT signaling pathway. We look forward to the improvement of this plun-in through these disadvantages.

How to finish this plun-in?

KEGG is a database resource for understanding high-level functions and utilities of the biological system, and KGML is an XML presentation of the KEGG pathway database, which enables automatic drawing of KEGG pathways and provides facilities for computational analysis and modeling of gene/protein networks and chemical networks. Here is the data structure of KGML.
It’s really complex and it will bother you to understand the KGML file! Do not worry, I will show you how to understand a KGML file and then how to convert it into JSON.
First, how to find or download KGML file?
Method:
Download KGML" link for each pathway map.
If you choose a pathway with prefix “map”, you can’t find the download link in the page, that’s because it can be generating almost ko/rn/ec/org files.
Such as “map04111”, it has no link for download. But if you change the “map” into “sce” in the URL, you can get the file.
KEGG API: Take “sce04111” as an example, you can download the KGML file via the this.
Second, the KGML file is difficult to find out the relationship through the data structure show above.
Here is the simple but straightforward tutorial to teach you how to understand a KGML file.
Take “sce04111.xml” as an example. We can simplify the data structure as:

The entry element can be path/ko/ec/rn/cpd/gl/org/group, enzyme/protein/gene will have relation and gene will also have compound and reactions. We choose one relation to be example:

It means that gene (YCL061C) have activation effect in gene (YPL153C).By the way, through the graphics elements, we can definitely rewrite the connection between these two genes.
Third, thought we know how to get KGML file and can understand it but the crucial problem is, how to grab the information of genes and convert it into JSON.
Here we use Python programming Language, install the library “lxml” for processing XML and HTML, and we import JSON library for convert.
Fourth, you may ask: If there have any other software to do such job, that is read KGML files, convert it and rewrite it?
Of course, and we indeed tried but failed for it’s not open source or the original source is difficult for modification. Actually, if you want to do some visualize pathway job, Cytoscape is a good choice and it also have cytoscape.js for drawing.
Finally, we indeed done plentiful preparatory work, maybe in the end it’s not useful in this software but it can expand our horizons.