comparison test_script_path.py @ 2:900854ec76e6 draft default tip

Uploaded
author nanette
date Tue, 20 Aug 2013 08:36:47 -0400
parents
children
comparison
equal deleted inserted replaced
1:a0cbbd0dfcc0 2:900854ec76e6
1 """
2 @summary: GO enrichment analysis (hotspots)
3 @author: nanette.coetzer@gmail.com
4 @version 5
5
6 """
7 import optparse, sys
8 import subprocess
9 import tempfile
10 import os, re
11
12 def stop_err( msg ):
13 sys.stderr.write( "%s\n" % msg )
14 sys.exit()
15
16 def __main__():
17 #Parse Command Line
18 parser = optparse.OptionParser()
19 parser.add_option("-i", "--input1", default=None, dest="input1",
20 help="genes")
21 parser.add_option("-o", "--output1", default=None, dest="output1",
22 help="star genes")
23
24 (options, args) = parser.parse_args()
25
26 try:
27 open(options.input1, "r").close()
28 except TypeError, e:
29 stop_err("You need to supply the Gene Universe file:\n" + str(e))
30 except IOError, e:
31 stop_err("Can not open the Gene Universe file:\n" + str(e))
32
33
34 ##########################################################
35
36 infile = open(options.input1,"r")
37 inlist = []
38 for line in infile:
39 inlist.append(line.strip())
40 infile.close()
41 outfile = open(options.output1,"w")
42 for l in inlist:
43 outfile.write("* "+str(l)+"\n")
44 outfile.close()
45
46 ##############################################
47
48 if __name__=="__main__":
49 __main__()