def print_splitted_fp_in_csv(res_or_tri, which=0): """ split 360 bits into parts """ data_dir = os.path.join(data480_root, "fp_aaindex_if_padded" if res_or_tri == "res" else "fp_aaindex_if_padded_tri") delimiter = "," cids = complex_ids(data_dir) name = ("%s 3 bits" % (res_or_tri), "atb 4 bits", "15 bits") from ve.fp.complex_util.padding import PaddedComplexFingerPrint, OverallSpatialDistribution atg_dist, atb_dist, tri_dist = OverallSpatialDistribution.from_cache() first_3_count = sum(atg_dist.values() if res_or_tri == "res" else tri_dist.values()) * 3 second_3_count = sum(atb_dist.values()) * 3 last_15_count = sum(atg_dist.values()) * 15 first_3_dataloader = make_dataloader(data_dir, make_single_line_converter(slice(0, first_3_count))) second_3_dataloader = make_dataloader( data_dir, make_single_line_converter(slice(first_3_count, first_3_count + second_3_count)) ) last_15_dataloader = make_dataloader( data_dir, make_single_line_converter( slice(first_3_count + second_3_count, first_3_count + second_3_count + last_15_count) ), ) dls = [first_3_dataloader, second_3_dataloader, last_15_dataloader] print ("cid, %s" % name[which]) for cid in sorted(cids): print ("%s,%s" % (cid, delimiter.join(map(lambda d: "%.2f" % d, dls[which](cid)))))
def gen_dist_matrix(plane_type, atg_or_atb, res_or_tri): data_dir = os.path.join(data237_fp175_padded_root, "%s-%s-%s" % (plane_type, atg_or_atb, res_or_tri)) dataloader = make_dataloader(data_dir, make_single_line_converter(None)) c_id_list = complex_ids(data_dir) complex_pairwise_calc(c_id_list, dataloader, corr_coef, callback=callback)
def gen_pairwise_dist(res_or_tri): data_dir = os.path.join(data480_root, "fp_aaindex_if_padded" if res_or_tri == "res" else "fp_aaindex_if_padded_tri") dataloader = make_dataloader(data_dir, make_single_line_converter(None)) c_id_list = complex_ids(data_dir) complex_pairwise_calc(c_id_list, dataloader, corr_coef, callback=callback)
def print_fp_in_csv(plane_type, atg_or_atb, res_or_tri): data_dir = os.path.join(data237_fp175_padded_root, "%s-%s-%s" % (plane_type, atg_or_atb, res_or_tri)) dataloader = make_dataloader(data_dir, make_single_line_converter(None)) delimiter = "," cids = complex_ids(data_dir) for cid in sorted(cids): print ("%s,%s," % (cid, delimiter.join(map(lambda d: "%.2f" % d, dataloader(cid)))))
import os from source import make_dataloader, make_single_line_converter, make_fp_str_saver, load_cids from ve.config import data237_root fp370_atg_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atg"), make_single_line_converter(slice(0, 370))) fp370_atb_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atb"), make_single_line_converter(slice(0, 370))) first_110_atg_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atg"), make_single_line_converter(slice(0, 110))) second_110_atg_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atg"), make_single_line_converter(slice(110, 220))) last_150_atg_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atg"), make_single_line_converter(slice(220, 370))) first_110_atb_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atb"), make_single_line_converter(slice(0, 110))) second_110_atb_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atb"), make_single_line_converter(slice(110, 220))) last_150_atb_dataloader = make_dataloader(os.path.join(data237_root, "fp_370_atb"), make_single_line_converter(slice(220, 370))) first_110_atg_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atg_first_110")) second_110_atg_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atg_second_110")) last_150_atg_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atg_last_150")) first_110_atb_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atb_first_110")) second_110_atb_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atb_second_110")) last_150_atb_datasaver = make_fp_str_saver(os.path.join(data237_root, "fp_370_atb_last_150")) def print_splitted_fp_in_csv(use_atg = True): """ split 360 bits into parts """ delimiter = " " cids = load_cids("data/fp_370_atb.txt") print("cid, first 110, second 110, last 150")