Function Repository Resource:

KEGGPathway

Source Notebook

Get the graph and additional information of a KEGG pathway

Contributed by: Lina Marcela Ruiz Galvis and Keiko Hirayama

ResourceFunction["KEGGPathway"][organism,pathcode,property]

get some property of the KEGG pathway associated to organism and pathcode.

ResourceFunction["KEGGPathway"][organism,pathcode,property,component]

get some component of a property of the KEGG pathway associated to organism and pathcode.

Details and Options

KEGG (Kyoto Encyclopedia of Genes and Genomes) pathways are a collection of maps representing molecular interaction, reaction and relation networks for metabolism, genetic information processing an so on.
Organisms can be specified by the KEGG organism code as either a String or "TaxonomicSpecies" Entity:
KEGGPathway["Organisms"]gets the list of organisms codes and names
The pathcodes are specified either by the KEGG digit code as a String or the KEGG pathway long name (title) as a String:
KEGGPathway["Pathways"]to get the list of pathways
KEGGPathway[organism,"Pathways"]to get the list of pathways for an specific organism
Properties supported are:
"Information"information of the KEGG pathway associated to an organism and pathcode
"Entries"dataset of the entries in the KEGG pathway associated to an organism and pathcode
"Relations"dataset of the relations between entries in the KEGG pathway associated to an organism and pathcode
"Reactions"dataset of the reactions between entries in the KEGG pathway associated to an organism and pathcode
"Graph"graph for any KEGG pathway associated to an organism and pathcode
"GraphRelation"graph for a KEGG pathway associated to an organism and pathcode which only has relations between entries
"GraphReaction"graph for a KEGG pathway associated to an organism and pathcode which only has reactions between entries
"GraphReactionAndRelation"graph for a KEGG pathway associated to an organism and pathcode which has both reactions and relations
The properties "Entries", "Relations" and "Reactions" support:
"EntryGraphName"information for just the KEGG entry (gene,compound, reaction) named in EntryGraphName property of the "Entries" dataset
"Relation"information for the relation
"Reaction"information for the reaction
KEGGPathway accepts all the options of Graph and additionally the following:
"Distance"0.017distance between the vertex and edge
"ArrowheadSize"0.013arrowhead size
For the property value "GraphRelation" the value of "ArrowheadSize" is ignored, while for "Graph" the value of "Distance" is ignored.

Examples

Basic Examples (11) 

Get each organism name and its associated code:

In[1]:=
ResourceFunction["KEGGPathway"]["Organisms"]
Out[1]=

Get the long name of each pathway and its associated code:

In[2]:=
ResourceFunction["KEGGPathway"]["Pathways"]
Out[2]=

Get the pathways for a human:

In[3]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "HomoSapiens::4pydj"], "Pathways"]
Out[3]=

Get information about the pathway "00020" of the "hsa":

In[4]:=
ResourceFunction["KEGGPathway"]["hsa", "00020", "Information"]
Out[4]=

This is the alternate way to get same information as above:

In[5]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "HomoSapiens::4pydj"], "citrate cycle (TCA cycle)", "Information"]
Out[5]=

Get the entries of the citrate cycle (TCA cycle) of a human:

In[6]:=
ResourceFunction["KEGGPathway"]["hsa", "00020", "Entries"]
Out[14]=

Get the relation entries of the citrate cycle (TCA cycle) of a human:

In[15]:=
ResourceFunction["KEGGPathway"]["hsa", "00020", "Relations"]
Out[15]=

Get the reactions of the citrate cycle (TCA cycle) of a human:

In[16]:=
ResourceFunction["KEGGPathway"]["hsa", "00020", "Reactions"]
Out[16]=

Get the Graph of the citrate cycle (TCA cycle) of a human. Get the complete names of the path components hovering over them. Click the vertex name and green boxes to get more information:

In[17]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "HomoSapiens::4pydj"], "citrate cycle (TCA cycle)", "Graph", VertexSize -> Medium]
Out[17]=

Get the Graph of the p53 signaling pathway of a macaque. Get the complete names of the path components hovering over them. Click the vertex name to get more information:

In[18]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.015, .008}, VertexStyle -> Hue[0.31, 0.35, 1], VertexLabelStyle -> Directive[FontFamily -> "Arial", 8]]
Out[18]=

Get the Graph of the carbon metabolism of a human. Get the complete names of the graph components hovering over them. Click the vertex name and edges to get more information:

In[19]:=
ResourceFunction["KEGGPathway"]["hsa", "01200", "Graph", VertexSize -> Medium]
Out[19]=

Scope (5) 

Get information of BID in pathway "04115" of "mcf":

In[20]:=
ResourceFunction["KEGGPathway"]["mcf", "04115", "Entries", "BID"]
Out[20]=

Get information of all the relations in which CASP9 made part of in pathway "04115" of "mcf":

In[21]:=
ResourceFunction["KEGGPathway"]["mcf", "04115", "Relations", "CASP9"]

Get information of the relation CASP9 -> CASP3 in pathway "04115" of "mcf":

In[22]:=
ResourceFunction["KEGGPathway"]["mcf", "04115", "Relations", "CASP9" -> "CASP3"]
Out[22]=

Get information of all reactions in which C00631 is a part of the pathway "01200" of "hsa":

In[23]:=
ResourceFunction["KEGGPathway"]["hsa", "01200", "Reactions", "C00631"]

Get information of the reaction CASP9 -> CASP3 in pathway "04115" of "mcf":

In[24]:=
ResourceFunction["KEGGPathway"]["hsa", "01200", "Reactions", "C00631" -> "C00074"]
Out[24]=

Options (5) 

You may change VertexSize, but it will affect the view of the edges:

In[25]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.02, .008}, VertexStyle -> Hue[0.31, 0.35, 1], VertexLabelStyle -> Directive[FontFamily -> "Arial", 8]]
Out[25]=

Make adjustments to better display the graph:

In[26]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.02, .008}, VertexStyle -> Hue[0.31, 0.35, 1], VertexLabelStyle -> Directive[FontFamily -> "Arial", 8], "Distance" -> 0.025]
Out[26]=

Highlight vertices base on their EntryID or any EntryGraphName in the graph of a KEGG pathway:

In[27]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.015, .008}, VertexStyle -> Hue[0.31, 0.35, 1], VertexLabelStyle -> Directive[FontFamily -> "Arial", 8], GraphHighlight -> {"CCND3", 10}]
Out[27]=

Highlight some edges and vertices in the graph of a KEGG pathway:

In[28]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.015, .008}, VertexStyle -> Hue[0.31, 0.35, 1], VertexLabelStyle -> Directive[FontFamily -> "Arial", 8], GraphHighlight -> {10 \[DirectedEdge] 9, 10, 9, "CASP8" \[DirectedEdge] "CASP3"}]
Out[28]=

Change the style to highlight edges and vertices in the graph of a KEGG pathway:

In[29]:=
ResourceFunction["KEGGPathway"][
 Entity["TaxonomicSpecies", "MacacaFascicularis::3cnwm"], "p53 signaling pathway", "Graph", VertexSize -> {0.015, .008}, VertexLabelStyle -> Directive[FontFamily -> "Arial", 8], VertexStyle -> {"CASP8" -> Yellow, "CASP3" -> Yellow, Hue[0.31, 0.35, 1]}, EdgeStyle -> {"CASP8" \[DirectedEdge] "CASP3" -> Gray}]
Out[29]=

Properties and Relations (12) 

Get the vertex list of "mcf" / "04115" entries:

In[30]:=
vNames = Normal[ResourceFunction["KEGGPathway"]["mcf", "04115", "Entries"][
    All, #EntryID -> #EntryGraphName &]];
graph = ResourceFunction["KEGGPathway"]["mcf", "04115", "Graph"];
In[31]:=
VertexList[graph] /. vNames
Out[31]=

Get the edge list:

In[32]:=
EdgeList[graph] /. vNames
Out[32]=

Get the number of vertices:

In[33]:=
VertexCount[graph]
Out[33]=

Get the number of edges:

In[34]:=
EdgeCount[graph]
Out[34]=

Get the vertex degrees:

In[35]:=
Thread[(VertexList[graph] /. vNames) -> VertexDegree[graph]] // SortBy[#, Last] & // Reverse
Out[35]=

Make a histogram:

In[36]:=
Histogram[%[[All, 2]]]
Out[36]=

Get the vertex out-degree list:

In[37]:=
Thread[(VertexList[graph] /. vNames) -> VertexOutDegree[graph]] // SortBy[#, Last] & // Reverse
Out[37]=

Make a histogram:

In[38]:=
Histogram[%[[All, 2]]]
Out[38]=

Get the vertex in-degree list:

In[39]:=
Thread[VertexList[graph] -> VertexInDegree[graph]] // SortBy[#, Last] & // Reverse
Out[39]=

Make a histogram:

In[40]:=
Histogram[%[[All, 2]]]
Out[40]=

Get the BetweennessCentrality:

In[41]:=
SortBy[Thread[VertexList[graph] -> BetweennessCentrality[graph]], Last] // Reverse
Out[41]=

Make a histogram:

In[42]:=
Histogram[%[[All, 2]]]
Out[42]=

Possible Issues (2) 

KEGGPathway fails if given the wrong organism name or path code:

In[43]:=
ResourceFunction["KEGGPathway"]["hsa", "00020b", "Information"]
Out[43]=

KEGGPathway fails if given an Entity that does not match a organism name:

In[44]:=
ResourceFunction["KEGGPathway"][
 Entity["Country", "Colombia"], "00020b", "Information"]
Out[44]=

Neat Examples (2) 

Get a cluster analysis of the graphs based on some network properties:

In[45]:=
org = "hsa";
pathCode = {"03440", "03460", "04010", "04012", "04929", "04912", "04917"};
titles = ResourceFunction["KEGGPathway"][org, #, "Information"][[;; 2]] & /@ pathCode;
gs = ResourceFunction["KEGGPathway"][org, #, "GraphRelation"] & /@ pathCode;
gs2 = MapThread[
   Tooltip[Graph[EdgeList[#] 1, ImageSize -> Tiny, Frame -> True], #2] &, {gs, titles}];
c = {AcyclicGraphQ[#], BipartiteGraphQ[#], PlanarGraphQ[#], VertexCount[#], EdgeCount[#], GraphDensity[#], GlobalClusteringCoefficient[#], GraphAssortativity[#]} & /@ gs;

See a dendrogram of the resulting graphs:

In[46]:=
Dendrogram[AssociationThread[gs2 -> c]]
Out[47]=

Publisher

Lina Marcela

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 26 June 2024

Related Resources

License Information