def main(args,args_from_ui=None): ''' the main entry point into dose_analysis_tool ''' # register the tool with tool ops work_dir = tool_ops.register_tool('dose_analysis_tool', args, start_path = args.out, args_from_ui = args_from_ui) #build_SC(args,work_dir) #build_query(args,work_dir) if args.probe: build_probe_curves(args,work_dir) if args.result: analyze_query(args,work_dir)
def main(args,args_from_ui=None): ''' the main entry point into dose_analysis_tool ''' # register the tool with tool ops work_dir = tool_ops.register_tool('dose_analysis_tool', args, start_path = args.out, args_from_ui = args_from_ui) #metics based on gctx input build_SC(args,work_dir) template_heatmap(args,work_dir) if args.probe: build_probe_curves_and_summary(args,work_dir) #query based functions if args.query: build_query(args,work_dir) if args.result or args.resultDir: analyze_query(args,work_dir)
def main(args, args_from_ui=None): ''' the main entry point into dose_analysis_tool ''' # register the tool with tool ops work_dir = tool_ops.register_tool('dose_analysis_tool', args, start_path=args.out, args_from_ui=args_from_ui) #make signature for each dose fup = os.path.join(work_dir, 'tmp_up_list.gmt') fdn = os.path.join(work_dir, 'tmp_dn_list.gmt') #fup = '/xchip/cogs/hogstrom/analysis/scratch/tmp_up_list.gmt' #fdn = '/xchip/cogs/hogstrom/analysis/scratch/tmp_dn_list.gmt' open(fup, 'w') #overwrite existing grp file open(fdn, 'w') #overwrite existing grp file n_edge = 50 db = gct.GCT() #db.read(gctfile) db.read(args.res) cids = db.get_cids() pertIDs = [x.split(':')[1] for x in cids] doses = [float(x.split(':')[2]) for x in cids] perts = db.get_column_meta('pert_desc') probes = db.get_rids() cellLs = db.get_column_meta('cell_id') timePs = db.get_column_meta('pert_time') mtrx = db.matrix #matrix of data from gct file #loop through each column of data for i, pertID in enumerate(pertIDs): profile = mtrx[:, i] n_prof = len(profile) iprofile = profile.argsort() #indices that sort array iprofile = iprofile[::-1] #switch indicies to decend sprofile = profile[iprofile] itop = iprofile[0:(n_edge)] ibot = iprofile[-n_edge:n_prof] col_name = perts[i] + '_' + str( doses[i]) + 'um_' + cellLs[i] + '_' + timePs[i] ptop = [] pbot = [] for j, it in enumerate(itop): ptop.append(probes[it]) #make probe id list for j, ip in enumerate(ibot): pbot.append(probes[ip]) #make probe id list #write to gmt list with open(fup, 'a') as f: f.write(col_name + '\t' + col_name + '\t') for pt in ptop: f.write(pt + '\t') f.write('\n') with open(fdn, 'a') as f: f.write(col_name + '\t' + col_name + '\t') for pb in pbot: f.write(pb + '\t') f.write('\n') #python system call os.chdir(work_dir) cmd = 'rum -q local query_tool --uptag ' + fup + ' --dntag ' + fdn + ' --metric eslm' os.system(cmd)