root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/EGG-INFO/scripts/lav_to_axt.py

リビジョン 3, 1.1 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1#!/usr/bin/python2.6
2"""
3Application to convert LAV file to AXT file. Reads a LAV file from standard
4input and writes a AXT file to standard out;  some statistics are written
5to standard error.
6
7usage: lav_to_axt [--silent] [path=replacement] < lav_file > axt_file
8"""
9
10__author__ = "Bob Harris (rsharris@bx.psu.edu)"
11
12import sys
13import copy
14import bx.align.lav
15import bx.align.axt
16
17def usage(s=None):
18        message = __doc__
19        if (s == None): sys.exit (message)
20        else:           sys.exit ("%s\n%s" % (s,message))
21
22
23def main():
24
25        # parse the command line
26
27        silent = False
28        pathSubs = []
29
30        for arg in sys.argv[1:]:
31                if ("=" in arg):
32                        ix = arg.find("=")
33                        pathSubs.append((arg[:ix],arg[ix+1:]))
34                elif (arg == "--silent"):
35                        silent = True
36                else:
37                        usage("unrecognized argument: " + arg)
38
39        # read the alignments and other info
40
41        out = bx.align.axt.Writer(sys.stdout)
42
43        lavsRead = axtsWritten = 0
44        for lavBlock in bx.align.lav.Reader(sys.stdin,path_subs=pathSubs):
45                lavsRead += 1
46
47                out.write (lavBlock)
48                axtsWritten += 1
49
50        if (not silent):
51                sys.stderr.write ("%d blocks read, %d written\n" % (lavsRead,axtsWritten))
52
53
54if __name__ == "__main__": main()
55
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。