Function Repository Resource:

ReactomePathways

Source Notebook

Get pathways and additional information from the Reactome database

Contributed by: Lina Marcela Ruiz Galvis and Keiko Hirayama

ResourceFunction["ReactomePathways"]["Organisms"]

gives the dataset with basic information for all the organisms in Reactome.

ResourceFunction["ReactomePathways"]["ExternalDatabases"]

gives the dataset with all the external databases of Reactome.

ResourceFunction["ReactomePathways"][spcode,"PrimaryPathways"]

gives the top level pathways for a specific spcode in Reactome.

ResourceFunction["ReactomePathways"][pathcode,prop]

gives a property prop for a specific pathcode in Reactome.

ResourceFunction["ReactomePathways"][keywords,"QueryPaths"]

gives a dataset with pathways corresponding to keywords.

ResourceFunction["ReactomePathways"][externalidentifier,"QueryReactions"]

gives a dataset with reactions corresponding to keywords.

Details and Options

ResourceFunction["ReactomePathways"] is based on the Reactome database.
Supported spcode values are the NCBITaxonomyID for an organism in Reactome.
Supported pathcode values are the StableID for a pathway in Reactome.
prop for ReactomePathways[pathcode,prop] supports the following values:
"SecondaryPathways"low level pathways inside a top level pathway
"ParentPathways"all possible paths from the requested event to the top level pathway(s)
"Information"general information of a pathway
"Compartments"compartments of a pathway
"Entries"biochemical components of a pathway
"Reactions"reactions of a pathway
"Glyph"information related to the nodes in the pathway
"Arc"information related to the edges in the pathway
"Image"get the Reactome Image of the pathway
"Graph"get the graph of the pathway
"EntriesExternalIdentifiers"list of participants in a given event and their external identifiers
ReactomePathways[pathcode,"Graph"] accepts all the options of Graph and also the following options:
"ArrowHeadSize"0.01set the arrowhead size
"Distance"8set the distance between the vertex and edge
"RemoveReactions"Falsedelete vertices representing reactions
ReactomePathways[pathcode,"Image"] accepts the following options:
"Extension""png"set the file extension to one of the following:png,jpg,jpeg,svg,or gif.
"Quality"10set the quality on a scale from 1 to 10
"Flag"Nonegene name,protein or chemical identifier or Reactome identifier to highlight in the diagram
"FlagInteractors"Truewhether to take into account interactors for the flagging
"Title"Truewhether the name of the pathway is shown below
"Margin"0image margin from 0 to 20
"Ehld"Truewhether textbook-like illustrations are taken into account (Electronic Help with Learning and Discovery)
"DiagramProfile""Modern"Modern or Standard
"Token"Nonethe analysis token with the results to be overlaid on top of the given diagram
"Resource""TOTAL"the analysis resource for which the results will be overlaid on top of the given pathways overview
"AnalysisProfile""Standard"Standard, Strosobar, or Copper Plus
ResourceFunction["ReactomePathways"][keywords,"QueryPaths"] accepts any of the following as keywords: a string representing key names such as TCA or energy, ExternalIdentifiers of entries that could be mapped onto KEGG, or a list specifying the database name and ID of an external database entry that can be mapped onto KEGG.
ResourceFunction["ReactomePathways"][keywords,"QueryReactions"] accepts either of the following as keywords: ExternalIdentifiers of entries that could be mapped onto KEGG, or a list specifying the database name and ID of an external database entry that can be mapped onto KEGG.

Examples

Basic Examples (4) 

Get basic information for all the organisms in the database:

In[1]:=
ResourceFunction["ReactomePathways"]["Organisms"]
Out[2]=

Databases of the external identifiers:

In[3]:=
ResourceFunction["ReactomePathways"]["ExternalDatabases"]
Out[163]=

Get basic information for all the top pathways for Homo sapiens with NCBITaxonomyID 9606:

In[164]:=
ResourceFunction["ReactomePathways"][9606, "PrimaryPathways"]
Out[165]=

Get basic information for all the top pathways for Homo sapiens:

In[166]:=
ResourceFunction["ReactomePathways"][
 Entity["TaxonomicSpecies", "HomoSapiens::4pydj"], "PrimaryPathways"]
Out[167]=

Scope (11) 

Get basic information for all the pathways in the primary pathway "R-HSA-180786" of Homo sapiens:

In[168]:=
ResourceFunction[
 "ReactomePathways"]["R-HSA-180786", "SecondaryPathways"]
Out[169]=

Get basic information for all the parent pathways of a pathway "R-HSA-5673001" of Homo sapiens:

In[170]:=
ResourceFunction["ReactomePathways"]["R-HSA-5673001", "ParentPathways"]
Out[171]=

Get information of "R-HSA-180786" pathway for Homo sapiens:

In[172]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Information"]
Out[172]=

Get the Entries of "R-HSA-180786" pathway for Homo sapiens:

In[173]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Entries"]
Out[174]=

Get the Reactions of "R-HSA-180786" pathway for Homo sapiens:

In[175]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Reactions"]
Out[176]=

Get the Graph of "R-HSA-180786" pathway for Homo sapiens. Get the complete names of the path components hovering over them. Click the vertex name to get more information:

In[177]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Graph"]
Out[178]=

Get the Compartments of "R-HSA-180786" pathway for Homo sapiens:

In[179]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Compartments"]
Out[180]=

Get the Glyph information to build the Graph for "R-HSA-180786" pathway for Homo sapiens:

In[181]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Glyph"]
Out[182]=

Get the Arc information to build the Graph for "R-HSA-180786" pathway for Homo sapiens:

In[183]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Arc"]
Out[184]=

Get the Image of "R-HSA-180786" pathway for Homo sapiens:

In[185]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Image"]
Out[186]=

Get the ExternalIdentifiers of the entries in the "R-HSA-180786" pathway for Homo sapiens:

In[187]:=
ResourceFunction[
 "ReactomePathways"]["R-HSA-180786", "EntriesExternalIdentifiers"]
Out[188]=

Options (4) 

Customize the Graph of "R-HSA-180786" pathway for Homo sapiens:

In[189]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Graph", VertexLabelStyle -> Directive[Black, 7],
 VertexSize -> Scaled[.007], VertexStyle -> Table[i -> Red, {i, {"9668823", "9668821", "9668825"}}],
  EdgeStyle -> Table[DirectedEdge[i, "9668831"] -> Red, {i, {"9668823", "9668821", "9668825"}}]]
Out[190]=

Delete the vertices representing reactions in the Graph of "R-HSA-180786" pathway for Homo sapiens:

In[191]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Graph", "RemoveReactions" -> True, VertexLabelStyle -> Directive[Black, 7],
 VertexSize -> Scaled[.007], VertexStyle -> Table[i -> Red, {i, {"9668823", "9668821", "9668825"}}],
  EdgeStyle -> Table[DirectedEdge[i, "9668830"] -> Red, {i, {"9668823", "9668821", "9668825"}}]]
Out[192]=

Sometimes is necessary to set the thickness of the edge style in order to display in a better way the edge highlighted:

In[193]:=
ResourceFunction["ReactomePathways"]["R-HSA-174417", "Graph", "RemoveReactions" -> True, EdgeStyle -> ({"113518" \[DirectedEdge] "113550" -> RGBColor[
      1, 0, 0]} /. Rule[a_, b_] :> Rule[a, Directive[Thick, b]]), VertexSize -> Medium, VertexLabelStyle -> Directive[Red, Italic, 4]]
Out[194]=

Customize the Image of the "R-HSA-180786" pathway for Homo sapiens:

In[195]:=
ResourceFunction["ReactomePathways"]["R-HSA-180786", "Image",
 "Extension" -> "png", "Quality" -> 10, "Flag" -> "R-HSA-174417", "FlagInteractors" -> "False", "Title" -> False, "Margin" -> 0, "Ehld" -> True, "DiagramProfile" -> "Modern", "Resource" -> "TOTAL", "AnalysisProfile" -> "Standard"]
Out[215]=

Properties and Relations (14) 

Look for pathways using keywords:

In[216]:=
keys = {"TCA", "diabetes", "energy", "lipid", "glycan"};
ResourceFunction["ReactomePathways"][keys, "QueryPaths"]
Out[217]=

Look for pathways using keywords and for a particular species:

In[218]:=
ResourceFunction[
 "ReactomePathways"][keys, "QueryPaths", {"Species" -> Entity["TaxonomicSpecies", "HomoSapiens::4pydj"]}]
Out[187]=

Pathways where an external identifier can be mapped to, using the name of the source and identifier:

In[219]:=
ResourceFunction["ReactomePathways"][{"UniProt", "PTEN"}, "QueryPaths"]
Out[358]=

Pathways where an external identifier can be mapped to, using ExternalIdentifier:

In[359]:=
ResourceFunction["ReactomePathways"][
 ExternalIdentifier["UniProtKBAccessionNumber", "PTEN"], "QueryPaths"]
Out[177]=

Pathways where an external identifier can be mapped to using the name of the source and identifier, specifying the species:

In[360]:=
ResourceFunction[
 "ReactomePathways"][{"UniProt", "PTEN"}, "QueryPaths", {"Species" -> Entity["TaxonomicSpecies", "HomoSapiens::4pydj"]}]
Out[360]=

Pathways where an external identifier can be mapped to using ExternalIdentifier, specifying the species:

In[361]:=
ResourceFunction["ReactomePathways"][
 ExternalIdentifier["UniProtKBAccessionNumber", "PTEN"], "QueryPaths", {"Species" -> Entity["TaxonomicSpecies", "HomoSapiens::4pydj"]}]
Out[187]=

Reactions where an external identifier can be mapped to using ExternalIdentifier:

In[362]:=
ResourceFunction["ReactomePathways"][
 ExternalIdentifier["UniProtKBAccessionNumber", "PTEN"], "QueryReactions"]
Out[363]=

Reactions where an external identifier can be mapped to by specifying the species:

In[364]:=
ResourceFunction["ReactomePathways"][
 ExternalIdentifier["UniProtKBAccessionNumber", "PTEN"], "QueryReactions", {"Species" -> Entity["TaxonomicSpecies", "HomoSapiens::4pydj"]}]
Out[364]=

Get the vertex list of "R-HSA-180786" pathway for Homo sapiens:

In[365]:=
vNames = Normal[ResourceFunction["ReactomePathways"]["R-HSA-180786", "Entries"][All, #DatabaseID -> #Name &]];
graph = ResourceFunction["ReactomePathways"]["R-HSA-180786", "Graph", "RemoveReactions" -> True];
sr = StringReplace[#, {"entityVertex" -> "species", "_" ~~ Shortest[x : DigitCharacter ..] ~~ EndOfString :> ""}] &;
In[366]:=
sr[VertexList[graph]] /. vNames // Short
Out[366]=

Get the edge list of "R-HSA-180786" pathway for Homo sapiens:

In[367]:=
MapAt[sr, EdgeList[graph], {All, All}] /. vNames // Short
Out[367]=

Get the number of vertices for "R-HSA-180786" pathway for Homo sapiens:

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

Get the number of edges of "R-HSA-180786" pathway for Homo sapiens:

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

Get the vertex degrees:

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

Make a histogram:

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

Get the vertex out-degree list:

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

Make a histogram:

In[373]:=
Histogram[%[[All, 2]]]
Out[374]=

Get the vertex in-degree list:

In[375]:=
Thread[(sr[VertexList[graph]] /. vNames) -> VertexInDegree[graph]] // SortBy[#, Last] & // Reverse // Short
Out[375]=

Make a histogram:

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

Get the BetweennessCentrality:

In[377]:=
SortBy[Thread[(sr[VertexList[graph]] /. vNames) -> BetweennessCentrality[graph]], Last] // Reverse // Short
Out[377]=

Make a histogram:

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

Possible Issues (1) 

You will get $Failed if the pathway id is incorrect:

In[379]:=
ResourceFunction[
 "ReactomePathways"]["R-HSA-9612973y", "PrimaryPathways"]
Out[379]=

Neat Examples (1) 

Highlight the sub pathways in the "R-HSA-180786" pathway for Homo sapiens:

In[380]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/4900eab3-0fea-46f1-a7b9-d5872bfa5374"]
In[381]:=
Manipulate[
 edgeList2 = EdgeList[lowLevelsPathsGraphs[path]];
 edgeListFinal = If[
   Length[edgeList2] == Length[Intersection[edgeList1, edgeList2]],
   Thread[edgeList2 -> Red],
   SortBy[#, Last][[-1]][[1, 2]] & /@ Table[{i, j -> Red} -> SmithWatermanSimilarity[ToString@i, ToString@j], {i, edgeList2}, {j, edgeList1}]
   ];
 ResourceFunction["ReactomePathways"]["R-HSA-180786", "Graph", "RemoveReactions" -> True, EdgeStyle -> edgeListFinal, VertexSize -> Medium, VertexLabelStyle -> Directive[Red, Italic, 4],
   PlotLabel -> Style["Extension of telomeres \[OpenCurlyDoubleQuote]R-HSA-180786\[CloseCurlyDoubleQuote] pathway", 10, Black]] , {path, Keys[lowLevelsPathsGraphs]}
 ]
Out[381]=

Publisher

Lina Marcela

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 2.0.0 – 18 June 2025
  • 1.1.0 – 02 January 2025
  • 1.0.1 – 04 December 2024
  • 1.0.0 – 18 November 2024

Source Metadata

Related Resources

License Information