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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Pass through blocks from a maf file until a certain number of columns
5have been passed.
6
7usage: %prog -c cols < maf > maf
8"""
9
10import sys
11
12from bx.align import maf
13from optparse import OptionParser
14
15def __main__():
16
17    # Parse command line arguments
18
19    parser = OptionParser()
20    parser.add_option( "-c", "--cols",  action="store" )
21
22    ( options, args ) = parser.parse_args()
23
24    maf_reader = maf.Reader( sys.stdin )
25    maf_writer = maf.Writer( sys.stdout )
26
27    if not options.cols: raise "Cols argument is required"
28    cols = int( options.cols )
29
30    count = 0
31
32    for m in maf_reader:
33
34        maf_writer.write( m )
35
36        count += m.text_size
37
38        if count >= cols: return       
39
40if __name__ == "__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。