def gen_fps():
    """generate finger print files"""
    global data_src ,output_dir 
    logger = TaskFileLogger("GenFP")

    h_vars = load_hydro_var()
    if not os.path.exists(output_dir):
        os.mkdir(output_dir)

    for h_type,var_d in h_vars.items():
        print "considering %s" %h_type

        t_output_dir = os.path.join(output_dir,h_type)
        if not os.path.exists(t_output_dir):
            print "creating path %s" %t_output_dir
            os.mkdir(t_output_dir)
        logger.log("%s started" %(h_type))

        for fname in glob.glob(data_src):
            complex_id = os.path.basename(fname).split('.')[0] 
            fp_path = os.path.join(t_output_dir,complex_id + ".fp" )
            if os.path.exists(fp_path):
                #print "%s processed" %complex_id
                continue
            print "processing %s,fp saved as %s" %(fname , fp_path )
            c = Complex(fname,hydro_dict = var_d)
            c.get_fp()
            c.write_fp_to_file(fp_path)

        logger.log("%s finished" %(h_type))
def do_gen_mat_task(h_name):
    """generate the similarity matrix"""
    logger = TaskFileLogger("GenMat")

    global fp_root,db
    
    logger.log("%s started" %(h_name))
    gen_sim_matrix(db,\
                    col_name = "%s_dist_mat" %h_name,\
                    fp_dir = os.path.join(fp_root,h_name))
    logger.log("%s finished" %(h_name))