def arr_add_spsummary(arrfeats, cutoff): sps = species_list(arrfeats.dtype.names[3:]) names = [s + '_evidence' for s in sps] newarr = ut.arr_add_feats(arrfeats, names, newtype='|S20') for i in range(len(newarr)): splist = passing_species_separate(arrfeats[i:i+1], cutoff) ut.arr_assign_row_values(newarr,i,range(len(arrfeats.dtype.names), len(newarr.dtype.names)), splist) return newarr
def arrfeats_add_ppis(arrfeats, ppis, name='ppi_score'): #assert len(arrfeats) == len(ppis), "Mismatched lengths" pdppis = pd.PairDict(ppis) newarr = ut.arr_add_feats(arrfeats, [name], newtype='<f2') notfound = 0 for row in newarr: ppi = pdppis.find((row[0],row[1])) if ppi: row[-1] = pdppis.d[ppi][0] else: notfound += 1 print "Not found:", notfound return newarr
def add_passing_features(arr, threshes): feat_names = ['passing%s' % t for t in threshes] newarr = ut.arr_add_feats(arr, feat_names) for t,name in zip(threshes, feat_names): newarr[name] = max_fracs_passing(arr, t) return newarr