def kegg_conv(target_db, source_db, option=None):
 if (option and (option not in ['turtle', 'n-triple'])):
  raise Exception('Invalid option arg for kegg conv request.')
 if isinstance(source_db, list):
  source_db = '+'.join(source_db)
 if ((target_db in ['ncbi-gi', 'ncbi-geneid', 'uniprot']) or (source_db in ['ncbi-gi', 'ncbi-geneid', 'uniprot']) or ((target_db in ['drug', 'compound', 'glycan']) and (source_db in ['pubchem', 'glycan'])) or ((target_db in ['pubchem', 'glycan']) and (source_db in ['drug', 'compound', 'glycan']))):
  if option:
   resp = _q('conv', target_db, source_db, option)
  else:
   resp = _q('conv', target_db, source_db)
  return resp
 else:
  raise Exception('Bad argument target_db or source_db for kegg conv request.')

def kegg_conv ( target_db , source_db , option = None ) : if ( option and ( option not in [ 'turtle' , 'n-triple' ] ) ) : raise Exception ( 'Invalid option arg for kegg conv request.' ) if isinstance ( source_db , list ) : source_db = '+' . join ( source_db ) if ( ( target_db in [ 'ncbi-gi' , 'ncbi-geneid' , 'uniprot' ] ) or ( source_db in [ 'ncbi-gi' , 'ncbi-geneid' , 'uniprot' ] ) or ( ( target_db in [ 'drug' , 'compound' , 'glycan' ] ) and ( source_db in [ 'pubchem' , 'glycan' ] ) ) or ( ( target_db in [ 'pubchem' , 'glycan' ] ) and ( source_db in [ 'drug' , 'compound' , 'glycan' ] ) ) ) : if option : resp = _q ( 'conv' , target_db , source_db , option ) else : resp = _q ( 'conv' , target_db , source_db ) return resp else : raise Exception ( 'Bad argument target_db or source_db for kegg conv request.' )
kegg conv - convert kegg identifiers to/from outside identifiers target_db - target database source_db_or_dbentries - source database or database entries option - can be "turtle" or "n-triple" .