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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Read a file containing a 0 or 1 on each line (`feature_file`), output
5all lines from stdin for which that value was 1
6
7TODO: no need to read the feature_file into memory here, just iterate in
8      parallel.
9
10usage: %prog feature_file < ...
11"""
12
13import psyco_full
14
15import sys
16
17def __main__():
18
19    feature_file = sys.argv[1]
20
21    if len( sys.argv ) > 2:
22        match = int( sys.argv[2] )
23    else:
24        match = 1
25   
26    feature_vector = [ int( line ) for line in file( feature_file ) ]
27
28    for index, line in enumerate( sys.stdin ):
29        if feature_vector[ index ] == match: print line,
30
31if __name__ == "__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。