1 | #!/usr/bin/python2.6 |
---|
2 | |
---|
3 | """ |
---|
4 | Read a wiggle track and print out a series of lines containing |
---|
5 | "chrom position score". Ignores track lines, handles bed, variableStep |
---|
6 | and fixedStep wiggle lines. |
---|
7 | """ |
---|
8 | |
---|
9 | import psyco_full |
---|
10 | |
---|
11 | import sys |
---|
12 | import bx.wiggle |
---|
13 | |
---|
14 | if len( sys.argv ) > 1: in_file = open( sys.argv[1] ) |
---|
15 | else: in_file = sys.stdin |
---|
16 | |
---|
17 | if len( sys.argv ) > 2: out_file = open( sys.argv[2], "w" ) |
---|
18 | else: out_file = sys.stdout |
---|
19 | |
---|
20 | for fields in bx.wiggle.Reader( in_file ): |
---|
21 | print " ".join( map( str, fields ) ) |
---|
22 | |
---|
23 | in_file.close() |
---|
24 | out_file.close() |
---|