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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Filter maf blocks for presence of wildcard columns. Blocks must meet the
5criteria of having at least `min_good` columns, each of which has more than
6`min_species` rows that are NOT wildcard bases ('*').
7
8TODO: Allow specifying the character of the wildcard base.
9
10usage: %prog min_good min_species < maf > maf
11"""
12
13from __future__ import division
14
15import psyco_full
16
17import sys
18
19import sys
20from bx.align import maf
21from optparse import OptionParser
22
23def main():
24
25    min_good = int( sys.argv[1] )
26    min_species = int( sys.argv[2] )
27
28    maf_reader = maf.Reader( sys.stdin )
29    maf_writer = maf.Writer( sys.stdout )
30
31    for m in maf_reader:
32        good = 0
33        for col in m.column_iter():
34            if col.count( '*' ) <= min_species:
35                good += 1   
36        if good >= min_good:
37            maf_writer.write( m )
38
39if __name__ == "__main__":
40    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。