Skip to content

Latest commit

 

History

History
22 lines (21 loc) · 556 Bytes

gms_kegg_code_tid.md

File metadata and controls

22 lines (21 loc) · 556 Bytes

kegg org code to t_number : moriyta (gm, growth_media, KEGG API)

kegg_api

async ({})=>{
  let kegg_api = "http://rest.kegg.jp/list/organism";
  let options_text = {
    method: "get",
    mode:  "cors"
  };
  let text = await fetch(kegg_api, options_text).then(res => res.text());
  let list = text.split(/\n/);
  let r = {};
  for(let i = 0; i < list.length; i++){
    let tmp = list[i].split(/\t/);
    if(tmp[0]){
      let name = tmp[2].replace(/ +\(.+$/, "");
      r[tmp[1]] = {tid: tmp[0], label: name}
    }
  }
  return r;
};