Friday, June 08, 2018

Download all KEGG pathway KGML files for SPIA analysis

Most people know KEGG pathway, but not everyone knows that it costs at least $2000 to subscribe its database. If you want to save the cost a bit, you can manually download the KEGG pathway KGML files and install in SPIA. Here I have a workaround to download all KEGG pathway files using their REST API.
## Claim: this is my personal trick. I recommend people to subscribe their KEGG FTP download to support the authors.

# change folder to the folder where your SPIA installed
cd /Library/Frameworks/R.framework/Versions/3.4/Resources/library/SPIA
# download all XML files for all human pathway
curl -s | awk '{split($1,a,":"); print "curl -s"a[2]"/kgml -o extdata/keggxml/hsa/"a[2]".xml"}' | bash

# then switch to R console



  1. Hello,

    when I do it in my terminal... it prints it on the top frame of the window but nothing is downloaded. I would appreciate your help.
    I am using a mac os 10.11.6 and tbh I don't much about unix but I am using the terminal that comes with the mac.

    Thank you,

    1. HI Vivian. Thanks for showing interest of my tips. Can you please copy the message from your terminal when you enter the commands? It's OK to use the terminal coming with Mac.