Hi,

I have been struggling to extract the set of genes related to each pathway from KEGG. I read multiple topics on biostar on how to do this but apparently there is something wrong. I downloaded the bret hierarchy file in order to get genes on the pathway level that I want. However, there seem to be multiple methods which some of them are working and the others are not.

In this topic, (https://www.biostars.org/p/69336/) a nice method has been mentioned by Pierre on how to do this using the following url: http://togows.dbcls.jp/entry/pathway/hsa05200/genes.json. However, when I try this for other pathways, the json list is empty (e.g., http://togows.dbcls.jp/entry/pathway/hsa01200/genes.json).

Another method which I found in this answer (https://www.biostars.org/p/71737/), was using the REST API. However, also for some of the pathways, there are no genes (e.g., http://rest.kegg.jp/get/hsa01200).

Surprisingly, if I take the same pathway, and I go to: http://www.genome.jp/dbget-bin/get_linkdb?-t+genes+path:hsa01200 I'm able to find the list of genes that I'm looking for.

Can someone tell me what is the difference between these 3 methods and what is the recommended method to do this.
I'm able to get a list of genes by using the <a href="https://www.biostars.org/p/150274/">kg tool</a> as shown below. Perhaps this is enough to meet your needs. I would also like to be able to specify the type of gene identifier, such as Entrez ID or Ensembl ID (<a href="https://github.com/endrebak/kg/issues/1">link to issue</a>), but this has not been implemented yet as far as I can tell.

**Command:**

    kg --mergecol=0 --noheader --genes --definition --species=hsa <(echo 01200)

**Output:** (trimmed)

```
Cache path is: /Users/slowikow/.kegg/ (Time:  Thu, 29 Oct 2015 10:10:24 )
Get KEGG gene to external gene map. (Time:  Thu, 29 Oct 2015 10:10:24 )
Get KEGG path to gene map. (Time:  Thu, 29 Oct 2015 10:10:25 )
Get KEGG pathway to definition map. (Time:  Thu, 29 Oct 2015 10:10:25 )
Connect KEGG gene map and KEGG pathway map. (Time:  Thu, 29 Oct 2015 10:10:26 )
/Users/slowikow/anaconda/lib/python2.7/site-packages/ebs/merge_cols.py:74: FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
  in_df = in_df.sort(pre_merge_sort_order_col)
Attaching pathway definitions. (Time:  Thu, 29 Oct 2015 10:10:26 )
01200   ME3     Carbon metabolism
01200   PGAMA   Carbon metabolism
01200   PGAM-B  Carbon metabolism
01200   HEL-S-35        Carbon metabolism
01200   PGAM1   Carbon metabolism
01200   PFKF    Carbon metabolism
```