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

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