root/galaxy-central/tools/filters/catWrapper.py

リビジョン 2, 0.8 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1#!/usr/bin/env python
2#By, Guruprasad Ananda.
3
4from galaxy import eggs
5import sys, os
6
7def stop_err(msg):
8    sys.stderr.write(msg)
9    sys.exit()
10   
11def 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       
38if __name__ == "__main__": main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。