for c in category_list: c.out() parser = argparse.ArgumentParser() parser.add_argument( 'fusion_cluster_file', action='store', help= 'Fusion reannation file clustered by head/tail genes. (.reann.cluster file)' ) parser.add_argument('outdir', action='store', help='outdir to write files to') args = parser.parse_args() cluster = args.fusion_cluster_file outdir = args.outdir category_stats = pygeneann.CategoryFusionStats(cluster) fusion_list = category_stats.category_list for i in range(2, 8): filtered_list = filter(lambda x: len(x.tools) == i, fusion_list) #print(i, len(filtered_list)) #if i == 5: f = open(os.path.join(outdir, cluster + "." + str(i) + "CALLERS"), "w+") sys.stdout = f output_filtered_list(filtered_list) f.close()
parser = argparse.ArgumentParser() parser.add_argument('fusion_cluster_file', action='store', help='cluster file)') parser.add_argument('--TP', required=False, action='store', help='TP cluster file)') args = parser.parse_args() # len(sys.argv) will be 4 with TP file, and 2 without #print(len(sys.argv)) category_stats = pygeneann.CategoryFusionStats(args.fusion_cluster_file) fusion_list = category_stats.category_list descending_fusion_list = [] # get number of tools i = max([len(fusion.tools) for fusion in fusion_list]) #generate list sorted by tool number in descending order while i > 0: fusions_num_tools = filter_tools_num(fusion_list, i) descending_fusion_list += fusions_num_tools i -= 1 #output_filtered_list(descending_fusion_list) if len(sys.argv) == 4: category_stats_TP = pygeneann.CategoryFusionStats(args.TP) fusion_list_TP = category_stats_TP.category_list TP_FIDs = [fusion.fusion_IDs for fusion in fusion_list_TP]