comparison tools/filters/catWrapper.py @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9071e359b9a3
1 #!/usr/bin/env python
2 #By, Guruprasad Ananda.
3
4 from galaxy import eggs
5 import sys, os
6
7 def stop_err(msg):
8 sys.stderr.write(msg)
9 sys.exit()
10
11 def main():
12 outfile = sys.argv[1]
13 infile = sys.argv[2]
14
15 try:
16 fout = open(sys.argv[1],'w')
17 except:
18 stop_err("Output file cannot be opened for writing.")
19
20 try:
21 fin = open(sys.argv[2],'r')
22 except:
23 stop_err("Input file cannot be opened for reading.")
24
25 if len(sys.argv) < 4:
26 os.system("cp %s %s" %(infile,outfile))
27 sys.exit()
28
29 cmdline = "cat %s " %(infile)
30 for inp in sys.argv[3:]:
31 cmdline = cmdline + inp + " "
32 cmdline = cmdline + ">" + outfile
33 try:
34 os.system(cmdline)
35 except:
36 stop_err("Error encountered with cat.")
37
38 if __name__ == "__main__": main()