How to: remember that you once knew how to parse KEGG

Recently, someone asked me if I could generate a list of genes associated with a particular pathway. Sure, I said and hacked together some rather nasty code in R which, given a KEGG pathway identifier, used a combination of the KEGG REST API, DBGET and biomaRt to return HGNC symbols. Coincidentally, someone asked the same question at Biostar. Pierre recommended the TogoWS REST service, which provides an API to multiple biological data sources. An article describing TogoWS was published in 2010. An excellent suggestion – and one which, I later discovered, I had bookmarked. Twice. As long ago as 2008. This “rediscovery of things I once knew” happens to me with increasing frequency now, which makes me wonder whether (1) we really are drowning in information, (2) my online curation tools/methods require improvement or (3) my mind is not what it was. Perhaps some combination of all three. Anyway – using Ruby (1.8.7), a list of HGNC symbols given a KEGG pathway, e.g. MAPK signaling, is as simple as: require 'rubygems' require 'open-uri' require 'json/pure' j = JSON.parse(open("http://togows.dbcls.jp/entry/pathway/hsa04010/genes.json").read) g = j.first.values.map {|v| /^(.*?);/.match(v)[1] } # first 5 genes g[0..4] # ["MAP3K14", "FGF17", "FGF6", "DUSP9", "MAP3K6"] This code parses the JSON returned from TogoWS into an array with one element; the element is a hash with key/value pairs of the form:...
Source: What You're Doing Is Rather Desperate - Category: Bioinformaticians Authors: Tags: bioinformatics programming ruby biostar how to kegg pathways rest Source Type: blogs