root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/EGG-INFO/scripts/maf_select.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"""
4Read a feature file containing a 0 or 1 on each line, output
5all mafs whose index in maf_file corresponds to a row having a 1
6
7usage: %prog feature_file < maf_file
8"""
9
10import psyco_full
11
12import sys
13import bx.align.maf
14
15def __main__():
16
17    feature_file = sys.argv[1]
18
19    if len( sys.argv ) > 2:
20        match = int( sys.argv[2] )
21    else:
22        match = 1
23   
24    feature_vector = [ int( line ) for line in file( feature_file ) ]
25
26    maf_reader = bx.align.maf.Reader( sys.stdin )
27    maf_writer = bx.align.maf.Writer( sys.stdout )
28
29    index = 0
30
31    for m in maf_reader:
32        if feature_vector[ index ] == match: maf_writer.write( m )
33        index += 1
34
35if __name__ == "__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。