0
|
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 parser.add_option("-m", "--myflag", default=None, dest="myflag",
|
|
24 help="star genes")
|
|
25 (options, args) = parser.parse_args()
|
|
26
|
|
27 try:
|
|
28 open(options.input1, "r").close()
|
|
29 except TypeError, e:
|
|
30 stop_err("You need to supply the Gene Universe file:\n" + str(e))
|
|
31 except IOError, e:
|
|
32 stop_err("Can not open the Gene Universe file:\n" + str(e))
|
|
33
|
|
34
|
|
35 ##########################################################
|
|
36
|
|
37 infile = open(options.input1,"r")
|
|
38 inlist = []
|
|
39 for line in infile:
|
|
40 inlist.append(line.strip())
|
|
41 infile.close()
|
|
42 outfile = open(options.output1,"w")
|
|
43 for l in inlist:
|
|
44 outfile.write("* "+str(l)+"\n")
|
7
|
45 outfile.write("--- TEST ---" + "\n")
|
0
|
46 outfile.write(options.myflag + "\n")
|
7
|
47 outfile.write("--- TEST ---" + "\n")
|
0
|
48 outfile.close()
|
|
49
|
|
50 ##############################################
|
|
51
|
|
52 if __name__=="__main__":
|
|
53 __main__()
|