Mercurial > repos > fubar > rg_gsea
comparison rgGSEA/rgGSEA.py @ 4:89e89b70a867 draft default tip
Uploaded
author | fubar |
---|---|
date | Sun, 09 Jun 2013 23:09:34 -0400 |
parents | 71fa159646c9 |
children |
comparison
equal
deleted
inserted
replaced
3:8e291f464aa0 | 4:89e89b70a867 |
---|---|
159 os.makedirs(opts.output_dir) | 159 os.makedirs(opts.output_dir) |
160 except: | 160 except: |
161 print >> sys.stderr,'##Error: GSEA wrapper unable to create or find output directory %s. Stopping' % (opts.output_dir) | 161 print >> sys.stderr,'##Error: GSEA wrapper unable to create or find output directory %s. Stopping' % (opts.output_dir) |
162 sys.exit(1) | 162 sys.exit(1) |
163 fakeGMT = re.sub('[^a-zA-Z0-9_]+', '', opts.input_name) # gives a more useful title for the GSEA report | 163 fakeGMT = re.sub('[^a-zA-Z0-9_]+', '', opts.input_name) # gives a more useful title for the GSEA report |
164 fakeGMT = os.path.join(opts.output_dir,fakeGMT) | 164 fakeGMT = os.path.join(opts.output_dir,fakeGMT) |
165 fakeGMT = os.path.abspath(fakeGMT) | |
165 fakeRanks = '%s.rnk' % fakeGMT | 166 fakeRanks = '%s.rnk' % fakeGMT |
166 if not fakeGMT.endswith('.gmt'): | 167 if not fakeGMT.endswith('.gmt'): |
167 fakeGMT = '%s.gmt' % fakeGMT | 168 fakeGMT = '%s.gmt' % fakeGMT |
168 if opts.builtin_gmt and opts.history_gmt: | 169 if opts.builtin_gmt and opts.history_gmt: |
169 newfile = open(fakeGMT,'w') | 170 newfile = open(fakeGMT,'w') |
321 print >> sys.stdout, '## Fixed any lower case - now have',','.join([x[0] for x in ranks[:5]]) | 322 print >> sys.stdout, '## Fixed any lower case - now have',','.join([x[0] for x in ranks[:5]]) |
322 ranks = ['\t'.join(x) for x in ranks] | 323 ranks = ['\t'.join(x) for x in ranks] |
323 if len(ranks) < 2: | 324 if len(ranks) < 2: |
324 print >> sys.stderr,'Input %s has 1 or less rows with two tab delimited fields - please check the tool documentation' % infname | 325 print >> sys.stderr,'Input %s has 1 or less rows with two tab delimited fields - please check the tool documentation' % infname |
325 sys.exit(1) | 326 sys.exit(1) |
327 print '### opening %s and writing %s' % (fakeRanks,str(ranks[:10])) | |
326 rclean = open(fakeRanks,'w') | 328 rclean = open(fakeRanks,'w') |
327 rclean.write('contig\tscore\n') | 329 rclean.write('contig\tscore\n') |
328 rclean.write('\n'.join(ranks)) | 330 rclean.write('\n'.join(ranks)) |
329 rclean.write('\n') | 331 rclean.write('\n') |
330 rclean.close() | 332 rclean.close() |