def combine_pres_ppis(resa, resb): res = ut.struct_copy(resa) res.name = 'combined: %s, %s' % (resa.name, resb.name) res.ppis = pd.pd_lol(pd.pd_combine_ppis(pd.PairDict(resa.ppis), pd.PairDict(resb.ppis), combine_or)) res.ppis.sort(key=lambda x: x[2], reverse=True) return res
def merge_maps(cxppis_list, threshold=.5): pds = [pd.PairDict(p) for p in cxppis_list] pdall = reduce(lambda x,y: pd.pd_combine_ppis(x,y,comb_func=max), pds) ps_merged = [list(p)+list(v) for p,v in pdall.d.items() if len([1 for whichpd in pds if whichpd.find(p)]) >= len(cxppis_list) * threshold] return ps_merged
def combine_ppis(a,b): ppis = pd.pd_lol(pd.pd_combine_ppis(pd.PairDict(a), pd.PairDict(b), combine_or)) return ppis