def expand_otu_ids(otu_map, otus_to_expand, ignore_missing=False):
 result = []
 for o in otus_to_expand:
  otu_id = o.split()[0]
  try:
   result += otu_map[otu_id]
  except KeyError:
   if ignore_missing:
    continue
   else:
    raise KeyError(('OTU id not in OTU map: %s' % o.split()[0]))
 return result

def expand_otu_ids ( otu_map , otus_to_expand , ignore_missing = False ) : result = [ ] for o in otus_to_expand : otu_id = o . split ( ) [ 0 ] try : result += otu_map [ otu_id ] except KeyError : if ignore_missing : continue else : raise KeyError ( ( 'OTU id not in OTU map: %s' % o . split ( ) [ 0 ] ) ) return result
from otu map and otu ids .