File: blasrToBed.py

package info (click to toggle)
pbsuite 15.8.24%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,512 kB
  • ctags: 1,951
  • sloc: python: 10,962; sh: 147; xml: 21; makefile: 14
file content (26 lines) | stat: -rwxr-xr-x 679 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python
import sys
from pbsuite.utils.FileHandlers import M4File, M5File

if __name__ == '__main__':
    try:
        fn = sys.argv[1]
    except:
        sys.stderr.write(("Error! Expected One Argument, " \
                          "an m4 or m5 alignment file\n"))
        exit(1)

    if fn.endswith('.m4'):
        file = M4File(sys.argv[1])
    elif fn.endswith('.m5'):
        file = M5File(sys.argv[1])
    else:
        print "Unrecognized File Type (expecting  .m4 or .m5)"
        exit(1)
    
    if len(sys.argv) == 3:
        out = open(sys.argv[2],'w')
    else:
        out = sys.stdout
    
    out.write("\n".join(map(lambda x: x.toBed(), file))+"\n")