Extraction of Pathways (Reactome)

REACTOME is an open-source, open access, manually curated and peer-reviewed pathway database. OuREACTOME is an open-source, open access, manually curated and peer-reviewed pathway database. Our goal is to provide intuitive bioinformatics tools for the visualization, interpretation and analysis of pathway knowledge to support basic and clinical research, genome analysis, modeling, systems biology and education. Founded in 2003, the Reactome project is led by Lincoln Stein of OICR, Peter D’Eustachio of NYULMC, Henning Hermjakob of EMBL-EBI, and Guanming Wu of OHSU.r goal is to provide intuitive bioinformatics tools for the visualization, interpretation and analysis of pathway knowledge to support basic and clinical research, genome analysis, modeling, systems biology and education. Founded in 2003, the Reactome project is led by Lincoln Stein of OICR, Peter D’Eustachio of NYULMC, Henning Hermjakob of EMBL-EBI, and Guanming Wu of OHSU. Source

import json as json
import pandas as pd
DATA = []
HUMAN = []
with open("ReactomePathways.txt",'r') as f1:
    for line in f1:
        #print(line.split("\t"))
        sl = line.split("\t")
        RID = sl[0]
        name = sl[1]
        specis= sl[2]
        if specis[-1] == "\n":
            specis = specis[0:-1]

        DATA.append({"RID":RID, "name":name, "specis":specis})
        if specis == "Homo sapiens":
            HUMAN.append({"RID":RID, "name":name, "specis":specis})          
len(DATA)
20751
len(HUMAN)
2255
HDF = pd.DataFrame(HUMAN)
HDF.head(50)
RID name specis
0 R-HSA-164843 2-LTR circle formation Homo sapiens
1 R-HSA-73843 5-Phosphoribose 1-diphosphate biosynthesis Homo sapiens
2 R-HSA-1971475 A tetrasaccharide linker sequence is required ... Homo sapiens
3 R-HSA-5619084 ABC transporter disorders Homo sapiens
4 R-HSA-1369062 ABC transporters in lipid homeostasis Homo sapiens
5 R-HSA-382556 ABC-family proteins mediated transport Homo sapiens
6 R-HSA-9033807 ABO blood group biosynthesis Homo sapiens
7 R-HSA-418592 ADP signalling through P2Y purinoceptor 1 Homo sapiens
8 R-HSA-392170 ADP signalling through P2Y purinoceptor 12 Homo sapiens
9 R-HSA-198323 AKT phosphorylates targets in the cytosol Homo sapiens
10 R-HSA-198693 AKT phosphorylates targets in the nucleus Homo sapiens
11 R-HSA-211163 AKT-mediated inactivation of FOXO1A Homo sapiens
12 R-HSA-112122 ALKBH2 mediated reversal of alkylation damage Homo sapiens
13 R-HSA-112126 ALKBH3 mediated reversal of alkylation damage Homo sapiens
14 R-HSA-4839748 AMER1 mutants destabilize the destruction complex Homo sapiens
15 R-HSA-163680 AMPK inhibits chREBP transcriptional activatio... Homo sapiens
16 R-HSA-5467333 APC truncation mutants are not K63 polyubiquit... Homo sapiens
17 R-HSA-5467337 APC truncation mutants have impaired AXIN binding Homo sapiens
18 R-HSA-179409 APC-Cdc20 mediated degradation of Nek2A Homo sapiens
19 R-HSA-174143 APC/C-mediated degradation of cell cycle proteins Homo sapiens
20 R-HSA-174048 APC/C:Cdc20 mediated degradation of Cyclin B Homo sapiens
21 R-HSA-174154 APC/C:Cdc20 mediated degradation of Securin Homo sapiens
22 R-HSA-176409 APC/C:Cdc20 mediated degradation of mitotic pr... Homo sapiens
23 R-HSA-174178 APC/C:Cdh1 mediated degradation of Cdc20 and o... Homo sapiens
24 R-HSA-179419 APC:Cdc20 mediated degradation of cell cycle p... Homo sapiens
25 R-HSA-5649702 APEX1-Independent Resolution of AP Sites via t... Homo sapiens
26 R-HSA-180689 APOBEC3G mediated resistance to HIV-1 infection Homo sapiens
27 R-HSA-5624958 ARL13B-mediated ciliary trafficking of INPP5E Homo sapiens
28 R-HSA-170984 ARMS-mediated activation Homo sapiens
29 R-HSA-380994 ATF4 activates genes in response to endoplasmi... Homo sapiens
30 R-HSA-381183 ATF6 (ATF6-alpha) activates chaperone genes Homo sapiens
31 R-HSA-381033 ATF6 (ATF6-alpha) activates chaperones Homo sapiens
32 R-HSA-1296025 ATP sensitive Potassium channels Homo sapiens
33 R-HSA-450408 AUF1 (hnRNP D0) binds and destabilizes mRNA Homo sapiens
34 R-HSA-8854518 AURKA Activation by TPX2 Homo sapiens
35 R-HSA-5467340 AXIN missense mutants destabilize the destruct... Homo sapiens
36 R-HSA-4839735 AXIN mutants destabilize the destruction compl... Homo sapiens
37 R-HSA-2161541 Abacavir metabolism Homo sapiens
38 R-HSA-2161517 Abacavir transmembrane transport Homo sapiens
39 R-HSA-2161522 Abacavir transport and metabolism Homo sapiens
40 R-HSA-73930 Abasic sugar-phosphate removal via the single-... Homo sapiens
41 R-HSA-2978092 Abnormal conversion of 2-oxoglutarate to 2-hyd... Homo sapiens
42 R-HSA-167242 Abortive elongation of HIV-1 transcript in the... Homo sapiens
43 R-HSA-156582 Acetylation Homo sapiens
44 R-HSA-264642 Acetylcholine Neurotransmitter Release Cycle Homo sapiens
45 R-HSA-181431 Acetylcholine binding and downstream events Homo sapiens
46 R-HSA-399997 Acetylcholine regulates insulin secretion Homo sapiens
47 R-HSA-1300645 Acrosome Reaction and Sperm:Oocyte Membrane Bi... Homo sapiens
48 R-HSA-2122948 Activated NOTCH1 Transmits Signal to the Nucleus Homo sapiens
49 R-HSA-9032845 Activated NTRK2 signals through CDK5 Homo sapiens

HDF.to_csv("Allpathways_HomoSpiens.csv")
with open("pathways.txt", 'w')as file:
    for item in HDF["name"]:
        file.write(item)
        file.write("\n")

Extraction of All Uniprot to Pathways

import json as json
import pandas as pd
DATA = []
HUMAN = []
with open("UniProt2Reactome_All_Levels.txt",'r') as f1:
    for line in f1:

        #print(line.split("\t"))
        sl = line.split("\t")
        #print(sl)
        UID = sl[0]
        RID = sl[1]
        WAD = sl[2]
        name = sl[3]
        GEN = sl[4]
        specis= sl[5]

        if specis[-1] == "\n":
            specis = specis[0:-1]

        DATA.append({"UID": UID,\
                     "RID":RID,\
                     "WAD":WAD,\
                     "name":name,\
                     "GEN": GEN,\
                     "specis":specis\
                    })

        if specis == "Homo sapiens":
            HUMAN.append({"UID": UID,\
                         "RID":RID,\
                         "WAD":WAD,\
                         "name":name,\
                         "GEN":GEN,\
                         "specis":specis\
                    })
len(DATA)
784328
len(HUMAN)
125359
HDF = pd.DataFrame(HUMAN)
HDF.head(50)
GEN RID UID WAD name specis
0 TAS R-HSA-109582 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-10... Hemostasis Homo sapiens
1 TAS R-HSA-1280218 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-12... Adaptive Immune System Homo sapiens
2 IEA R-HSA-1280218 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-12... Adaptive Immune System Homo sapiens
3 TAS R-HSA-166658 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Complement cascade Homo sapiens
4 TAS R-HSA-166663 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Initial triggering of complement Homo sapiens
5 TAS R-HSA-166786 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Creation of C4 and C2 activators Homo sapiens
6 TAS R-HSA-168249 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Innate Immune System Homo sapiens
7 IEA R-HSA-168249 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Innate Immune System Homo sapiens
8 TAS R-HSA-168256 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Immune System Homo sapiens
9 IEA R-HSA-168256 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-16... Immune System Homo sapiens
10 TAS R-HSA-173623 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-17... Classical antibody-mediated complement activation Homo sapiens
11 TAS R-HSA-198933 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-19... Immunoregulatory interactions between a Lympho... Homo sapiens
12 TAS R-HSA-202733 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... Cell surface interactions at the vascular wall Homo sapiens
13 TAS R-HSA-2029480 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... Fcgamma receptor (FCGR) dependent phagocytosis Homo sapiens
14 IEA R-HSA-2029480 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... Fcgamma receptor (FCGR) dependent phagocytosis Homo sapiens
15 IEA R-HSA-2029481 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... FCGR activation Homo sapiens
16 TAS R-HSA-2029481 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... FCGR activation Homo sapiens
17 TAS R-HSA-2029482 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... Regulation of actin dynamics for phagocytic cu... Homo sapiens
18 TAS R-HSA-2029485 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-20... Role of phospholipids in phagocytosis Homo sapiens
19 TAS R-HSA-2168880 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-21... Scavenging of heme from plasma Homo sapiens
20 TAS R-HSA-2173782 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-21... Binding and Uptake of Ligands by Scavenger Rec... Homo sapiens
21 TAS R-HSA-2454202 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-24... Fc epsilon receptor (FCERI) signaling Homo sapiens
22 IEA R-HSA-2454202 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-24... Fc epsilon receptor (FCERI) signaling Homo sapiens
23 TAS R-HSA-2730905 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-27... Role of LAT2/NTAL/LAB on calcium mobilization Homo sapiens
24 IEA R-HSA-2730905 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-27... Role of LAT2/NTAL/LAB on calcium mobilization Homo sapiens
25 TAS R-HSA-2871796 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-28... FCERI mediated MAPK activation Homo sapiens
26 TAS R-HSA-2871809 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-28... FCERI mediated Ca+2 mobilization Homo sapiens
27 IEA R-HSA-2871809 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-28... FCERI mediated Ca+2 mobilization Homo sapiens
28 TAS R-HSA-2871837 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-28... FCERI mediated NF-kB activation Homo sapiens
29 TAS R-HSA-5653656 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-56... Vesicle-mediated transport Homo sapiens
30 TAS R-HSA-5690714 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-56... CD22 mediated BCR regulation Homo sapiens
31 TAS R-HSA-977606 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-97... Regulation of Complement cascade Homo sapiens
32 TAS R-HSA-983695 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-98... Antigen activates B Cell Receptor (BCR) leadin... Homo sapiens
33 IEA R-HSA-983695 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-98... Antigen activates B Cell Receptor (BCR) leadin... Homo sapiens
34 TAS R-HSA-983705 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-98... Signaling by the B Cell Receptor (BCR) Homo sapiens
35 IEA R-HSA-983705 A0A075B6P5 https://reactome.org/PathwayBrowser/#/R-HSA-98... Signaling by the B Cell Receptor (BCR) Homo sapiens
36 TAS R-HSA-109582 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-10... Hemostasis Homo sapiens
37 TAS R-HSA-1280218 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-12... Adaptive Immune System Homo sapiens
38 IEA R-HSA-1280218 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-12... Adaptive Immune System Homo sapiens
39 TAS R-HSA-166658 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Complement cascade Homo sapiens
40 TAS R-HSA-166663 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Initial triggering of complement Homo sapiens
41 TAS R-HSA-166786 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Creation of C4 and C2 activators Homo sapiens
42 TAS R-HSA-168249 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Innate Immune System Homo sapiens
43 IEA R-HSA-168249 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Innate Immune System Homo sapiens
44 TAS R-HSA-168256 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Immune System Homo sapiens
45 IEA R-HSA-168256 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-16... Immune System Homo sapiens
46 TAS R-HSA-173623 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-17... Classical antibody-mediated complement activation Homo sapiens
47 TAS R-HSA-198933 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-19... Immunoregulatory interactions between a Lympho... Homo sapiens
48 TAS R-HSA-202733 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-20... Cell surface interactions at the vascular wall Homo sapiens
49 TAS R-HSA-2029480 A0A075B6S6 https://reactome.org/PathwayBrowser/#/R-HSA-20... Fcgamma receptor (FCGR) dependent phagocytosis Homo sapiens
HDF.to_csv("Uniprot2Pathways_HomoSpiens.csv")

Uniprot to Pathways

unames = list(set(HDF['name']))
len(unames)
2229
Name2uniprot = []
for name in unames:
    alluniprot = []
    for ID,nm in zip(HDF['UID'],HDF['name']):
        if nm == name:
            alluniprot.append(ID)
    Name2uniprot.append({"Pathway": name,"UIDs":alluniprot, "count": len(alluniprot)})
NUP = pd.DataFrame(Name2uniprot)
NUP.to_csv("Pathways2Uniprot.csv")