comparison SMART/DiffExpAnal/loadHTSeqResultFiles.py @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
comparison
equal deleted inserted replaced
30:5677346472b5 31:0ab839023fe4
1 #!/usr/bin/env python
2
3 import optparse, sys
4
5
6 def __main__():
7 #Parse Command Line
8 parser = optparse.OptionParser()
9 parser.add_option('-i', '--inputs', dest='inputFiles', default=None, help='several input files. (seperated by @ or @@' )
10 parser.add_option( '-o', '--output', dest='outputFile', default=None, help='The output list of HTSeq results files(.tabular) on txt format.' )
11 ( options, args ) = parser.parse_args()
12
13
14 out = open(options.outputFile, 'w')
15 out.write("label\tfiles\tgroup\n")
16 if options.inputFiles == None:
17 raise Exception, 'input file name is not defined!'
18
19 groupCount = 1
20 fileCount = 0
21
22 inputFiles = sys.argv[6:]
23 print '\n\nthe length of inputfiles is : %s \n' % len(inputFiles)
24 i = 0
25 while i < (len(inputFiles)-1):
26 if inputFiles[i] == "@":
27 i += 1
28 fileCount = 1
29 groupCount += 1
30 out.write("Group%s_%s\t%s\t%s\n" % (groupCount, fileCount, inputFiles[i], groupCount))
31 else:
32 fileCount += 1
33 out.write("Group%s_%s\t%s\t%s\n" % (groupCount, fileCount, inputFiles[i], groupCount))
34 i += 1
35
36 out.close()
37
38
39
40 if __name__=="__main__": __main__()