Mercurial > repos > nanette > nanette_test
changeset 2:900854ec76e6 draft default tip
Uploaded
author | nanette |
---|---|
date | Tue, 20 Aug 2013 08:36:47 -0400 |
parents | a0cbbd0dfcc0 |
children | |
files | test_script_path.py |
diffstat | 1 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_script_path.py Tue Aug 20 08:36:47 2013 -0400 @@ -0,0 +1,49 @@ +""" +@summary: GO enrichment analysis (hotspots) +@author: nanette.coetzer@gmail.com +@version 5 + +""" +import optparse, sys +import subprocess +import tempfile +import os, re + +def stop_err( msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + +def __main__(): + #Parse Command Line + parser = optparse.OptionParser() + parser.add_option("-i", "--input1", default=None, dest="input1", + help="genes") + parser.add_option("-o", "--output1", default=None, dest="output1", + help="star genes") + + (options, args) = parser.parse_args() + + try: + open(options.input1, "r").close() + except TypeError, e: + stop_err("You need to supply the Gene Universe file:\n" + str(e)) + except IOError, e: + stop_err("Can not open the Gene Universe file:\n" + str(e)) + + + ########################################################## + + infile = open(options.input1,"r") + inlist = [] + for line in infile: + inlist.append(line.strip()) + infile.close() + outfile = open(options.output1,"w") + for l in inlist: + outfile.write("* "+str(l)+"\n") + outfile.close() + + ############################################## + +if __name__=="__main__": + __main__()