def Goldstandard_from_cluster_File(gsF, foundprots=""): clusters = GS.Clusters(need_to_be_mapped=False) clusters.read_file(gsF) if foundprots != "": clusters.remove_proteins(foundprots) gs = GS.Goldstandard_from_Complexes("All") gs.complexes = clusters gs.make_pos_neg_ppis() return gs
def create_goldstandard(clusters, target_taxid, valprots): if target_taxid != "9606" and target_taxid != "": orthmap = GS.Inparanoid(taxid=target_taxid) else: orthmap = "" gs = GS.Goldstandard_from_Complexes("Goldstandard") gs.make_reference_data(clusters, orthmap, found_prots=valprots) return gs
def Goldstandard_from_PPI_File(gsF, foundprots=""): out = GS.Goldstandard_from_Complexes("gs") gsFH = open(gsF) for line in gsFH: line = line.rstrip() ida, idb, class_label = line.split("\t")[0:3] if foundprots != "" and (ida not in foundprots or idb not in foundprots): continue edge = "\t".join(sorted([ida, idb])) if class_label == "positive": out.positive.add(edge) else: out.negative.add(edge) gsFH.close() return out
def cut(args): fc, scoreF, outF = args if fc == "00000000": sys.exit() this_scores = get_fs_comb(fc) scoreCalc = CS.CalculateCoElutionScores("", "", "", "", cutoff=0.5) empty_gs = GS.Goldstandard_from_Complexes() empty_gs.positive = set([]) empty_gs.negative = set([]) scoreCalc.readTable(scoreF, empty_gs) print scoreCalc.to_predict feature_comb = feature_selector([fs.name for fs in this_scores], scoreCalc) feature_comb.open() outFH = open(outF, "w") print >> outFH, "\t".join(feature_comb.scoreCalc.header) for i in range(feature_comb.to_predict): edge, edge_scores = feature_comb.get_next() if edge == "" or edge_scores == []: continue print >> outFH, "%s\t%s" % (edge, "\t".join(map(str, edge_scores))) outFH.close() feature_comb.close()