Function Repository Resource:

WikiPathways

Source Notebook

Get pathways and additional information from the WikiPathways database

Contributed by: Lina Marcela Ruiz Galvis and Keiko Hirayama

ResourceFunction["WikiPathways"]["All"]

gives the dataset with basic information for all the WikiPathways.

ResourceFunction["WikiPathways"][pathcode,prop]

gives a property prop for a specific pathcode in WikiPathways.

Details and Options

ResourceFunction["WikiPathways"] is based on the WikiPathways website.
pathcode supported are the WikiPathways IDs as String.
prop supports the following values:
"Information"general information of the WikiPathway
"Interaction"information related to interactions or lines connecting elements
"DataNode"information related to nodes
"Shape"information related to shapes in the graphics
"GraphicalLine"information related to lines in the graphics
"Label"information related to labels in the graphics
"Graph"get the Graph of the WikiPathway
"Graphics"get the Graphics of the WikiPathway
WikiPathways[pathcode,"Graphics"] accepts all the options of Graphics and also the following options:
"ArrowHeadSize"0.009set the arrowhead size
"LabelSize"Automaticset the size of the labels outside of polygons
"NodeHeight"Automaticset the height of the polygons that represent biochemicals
"NodeWidth"Automaticset the width of the polygons that represent biochemicals
WikiPathways[pathcode,"Graph"] accepts all the options of Graph and also the following options:
"ArrowHeadSize"0.009set the arrowhead size
"Distance"0.005set the distance between the vertex and edge
"DeleteAnchors"Falsedelete anchors
"DataNodeType"Automaticselect a DataNode Type
"InteractionType"Automaticselect a Interaction Type according to GraphicsArrowheadType property

Examples

Basic Examples (4) 

Get basic information for all the WikiPathways including their revision number:

In[1]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["All"]
Out[1]=

Get information for a specific WikiPathway:

In[2]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Information"]
Out[2]=

Get all the information related to nodes:

In[3]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "DataNode"]
Out[3]=

Get all the information related to interactions or lines connecting elements of the graphics with a biological meaning:

In[4]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Interaction"]
Out[4]=

Scope (4) 

Get the Graphics of "TCA cycle" for African malaria mosquito. Get the complete names of elements and additional information of edges hovering over them. Click the polygons to get a popup window with links to more information:

In[5]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graphics"]
Out[5]=

Get the Graph version of the Graphics of "TCA cycle" for African malaria mosquito. Get the complete names of elements and additional information of edges hovering over them. Click the polygons to get a popup window with links to more information:

In[6]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graph"]
Out[6]=

Get all the GraphicsPointArrowHead types in "Selenium micronutrient network":

In[7]:=
arrowheads = DeleteDuplicates[
  Normal[ResourceFunction[
     "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP3257", "Interaction"][
    All, #GraphicsPointArrowHead &]]]
Out[7]=

Select the "mim-inhibition" type of GraphicsPointArrowHead from "Selenium micronutrient network" Graph:

In[8]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP3257", "Graph", "InteractionType" -> {"mim-inhibition"}, PlotLabel -> Style["Selenium micronutrient network", Black, Large]]
Out[8]=

Get all the Types of nodes in "Selenium micronutrient network":

In[9]:=
nodesType = DeleteDuplicates[
  Normal[ResourceFunction[
     "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP3257", "DataNode"][All, #Type &]]]
Out[9]=

Select the "Metabolite" Type of node from "Selenium micronutrient network" Graph:

In[10]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP3257", "Graph", "DataNodeType" -> {"Metabolite"}, PlotLabel -> Style["Selenium micronutrient network", Black, Large]]
Out[10]=

Options (4) 

Customize the visualization of "TCA cycle" Graph for African malaria mosquito:

In[11]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graph", "ArrowHeadSize" -> 0.03, "Distance" -> 0.03, "DeleteAnchors" -> True, VertexSize -> 1, PlotLabel -> Style["TCA cycle", Black, Large]]
Out[11]=

Customize the visualization of "TCA cycle" Graphics for African malaria mosquito:

In[12]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graphics", "ArrowHeadSize" -> 0.006, "LabelSize" -> 6, "NodeHeight" -> 16, "NodeWidth" -> 80, PlotLabel -> Style["TCA cycle", Black, Large]]
Out[12]=

Highlight nodes of the "TCA cycle" Graph for African malaria mosquito:

In[13]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graph", "ArrowHeadSize" -> 0.03, "Distance" -> 0.03, "DeleteAnchors" -> True, VertexSize -> 1, PlotLabel -> Style["TCA cycle", Black, Large], VertexStyle -> {"Citrate" -> Yellow}]
Out[13]=

Highlight edges of the "TCA cycle" Graph for African malaria mosquito:

In[14]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graph", "ArrowHeadSize" -> 0.03, "Distance" -> 0.03, "DeleteAnchors" -> True, VertexSize -> 1, PlotLabel -> Style["TCA cycle", Black, Large], VertexStyle -> {"Pyruvate" -> Yellow}, EdgeStyle -> {"Pyruvate" -> "Acetyl-CoA" -> Yellow}]
Out[14]=

Properties and Relations (8) 

Get the vertex list:

In[15]:=
vNames = Normal[ResourceFunction[
     "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "DataNode"][
    All, #"GraphId" -> #TextLabel &]];
graph = ResourceFunction[
   "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "Graph", "DeleteAnchors" -> True];
In[16]:=
VertexList[graph] /. vNames
Out[16]=

Get the edges list:

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

Get the number of vertex:

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

Get the number of edges:

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

Get the vertex degree and histogram:

In[20]:=
Thread[(VertexList[graph] /. vNames) -> VertexDegree[graph]] // SortBy[#, Last] & // Reverse
Out[20]=
In[21]:=
Histogram[%[[All, 2]]]
Out[21]=

Get the vertex out degree list and histogram:

In[22]:=
Thread[(VertexList[graph] /. vNames) -> VertexOutDegree[graph]] // SortBy[#, Last] & // Reverse
Out[22]=
In[23]:=
Histogram[%[[All, 2]]]
Out[23]=

Get the vertex in degree list and histogram:

In[24]:=
Thread[VertexList[graph] -> VertexInDegree[graph]] // SortBy[#, Last] & // Reverse
Out[24]=
In[25]:=
Histogram[%[[All, 2]]]
Out[25]=

Get the BetweennessCentrality and histogram:

In[26]:=
SortBy[Thread[VertexList[graph] -> BetweennessCentrality[graph]], Last] // Reverse
Out[26]=
In[27]:=
Histogram[%[[All, 2]]]
Out[27]=

Possible Issues (3) 

Issue could be found if the pathway id is incorrect:

In[28]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227.", "Information"]
Out[28]=

Issue could be found if the property in misspelled:

In[29]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP1227", "InformationR"]
Out[29]=

Issue could be found if the graph data is missing:

In[30]:=
ResourceFunction[
 "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["WP3413", "Graph"]
Out[30]=

Neat Examples (1) 

Get the gene products frequencies of the same pathway in different species:

In[31]:=
allPaths = ResourceFunction[
   "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["All"];
In[32]:=
twoPath = Values@Normal[
    allPaths[GroupBy["Name"]][TakeLargestBy[Length, 2]][All, All, "Pathcode"]];
In[33]:=
MapThread[
 With[
   {geneProduct = Function[path,
       Normal[
        ResourceFunction[
           "WikiPathways", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][path, "DataNode"][
          Select[MatchQ[#Type, "GeneProduct"] &]][All, #TextLabel &]]
       ] /@ #1},
   BarChart[
    Reverse[SortBy[Tally[Flatten[geneProduct]], Last]][[All, 2]],
    PlotLabel -> #2, Frame -> True, FrameLabel -> {"GeneProduct", "Frequency"}
    ]
   ] &,
 {twoPath, Normal[Keys[allPaths[GroupBy["Name"]][TakeLargestBy[Length, 2]]]]}]
Out[33]=

Publisher

Lina Marcela

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.1.1 – 18 December 2024
  • 1.1.0 – 18 November 2024
  • 1.0.0 – 27 September 2024

Source Metadata

Related Resources

License Information