def genes2phens(p2entrez_file, e2z=None): ensg2z = e2z if e2z else ut.load_dict_sets(ut.proj_path('convert', 'Hs2Hs_entrez.tab')) def dict_sets_rem_prefix(d, sep): d = dict([(k,set([vi.split(sep)[1] for vi in v])) for k,v in d.items()]) return d p2z = dict_sets_rem_prefix(ut.load_dict_sets(p2entrez_file), ":") return ut.compose_dict_sets(ensg2z, ut.dict_inverse_sets(p2z))
def custom_conversion(fromtype, totype): """ Check for a custom file in data/convert Return None if not found. """ fname = "%s2%s.tab" % (fromtype, totype) fpath = ut.proj_path('convert',fname) if os.path.exists(fpath): return ut.load_dict_sets(fpath)
def custom_conversion(fromtype, totype): """ Check for a custom file in data/convert Return None if not found. """ fname = "%s2%s.tab" % (fromtype, totype) fpath = ut.proj_path('convert', fname) if os.path.exists(fpath): return ut.load_dict_sets(fpath)
def load_havug_cxs(convert_ensg=True): fname = ut.proj_path('havug_cxs') u2e = ut.dict_inverse_sets(ut.load_dict_sets( '../../data/convert/Hs2Hs_uni.tab')) hcxs = ut.load_list_of_type(fname,set) if convert_ensg: hcxs = convert_complexes([(i,c) for i,c in enumerate(hcxs)], u2e, seqs.load_prots_from_fasta('../../data/sequences/canon/Hs.fasta')) return hcxs
def load_havug_ppis(): hints = ut.load_list_of_lists('../../docs/SupplementaryTableS2.tab') u2e = ut.dict_inverse_sets(ut.load_dict_sets('../../data/convert/Hs2Hs_uni.tab')) hints = [[list(u2e.get(p,['NoTranslation']))[0] for p in c[:2]]+[c[2]] for c in hints] return hints