def get_flowgram_distances(id, flowgram, flowgrams, fc, ids, outdir, error_profile=(DENOISER_DATA_DIR + 'FLX_error_profile.dat')):
 check_flowgram_ali_exe()
 (fh, tmpfile) = init_flowgram_file(prefix=outdir)
 append_to_flowgram_file(id, flowgram, fh)
 k = 0
 names = []
 for f in flowgrams:
  if (f.Name in ids):
   fc.add(f)
   append_to_flowgram_file(f.Name, f, fh, trim=False)
   k += 1
   names.append(f.Name)
 fh.close()
 scores_fh = popen(('%s -relscore_pairid %s %s ' % (get_flowgram_ali_exe(), error_profile, tmpfile)), 'r')
 scores = [map(float, s.split()) for s in scores_fh if (s != '\n')]
 if (k != len(scores)):
  raise RuntimeError(((('Something bad has happened! I received less ' + 'alignment scores than there are flowgrams. Most likely this ') + 'means that the alignment program is not setup or corrupted. ') + 'Please run the test scripts to figure out the cause of the error.'))
 remove(tmpfile)
 return (scores, names, fc)

def get_flowgram_distances ( id , flowgram , flowgrams , fc , ids , outdir , error_profile = ( DENOISER_DATA_DIR + 'FLX_error_profile.dat' ) ) : check_flowgram_ali_exe ( ) ( fh , tmpfile ) = init_flowgram_file ( prefix = outdir ) append_to_flowgram_file ( id , flowgram , fh ) k = 0 names = [ ] for f in flowgrams : if ( f . Name in ids ) : fc . add ( f ) append_to_flowgram_file ( f . Name , f , fh , trim = False ) k += 1 names . append ( f . Name ) fh . close ( ) scores_fh = popen ( ( '%s -relscore_pairid %s %s ' % ( get_flowgram_ali_exe ( ) , error_profile , tmpfile ) ) , 'r' ) scores = [ map ( float , s . split ( ) ) for s in scores_fh if ( s != '\n' ) ] if ( k != len ( scores ) ) : raise RuntimeError ( ( ( ( 'Something bad has happened! I received less ' + 'alignment scores than there are flowgrams. Most likely this ' ) + 'means that the alignment program is not setup or corrupted. ' ) + 'Please run the test scripts to figure out the cause of the error.' ) ) remove ( tmpfile ) return ( scores , names , fc )
computes distance scores of flowgram to all flowgrams in parser .