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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Translate a maf file containing gap ambiguity characters as produced by
5'maf_tile_2.py' to a new file in which "#" (contiguous) is replaced by "-" and
6all other types are replaces by "*".
7
8TODO: This could be much more general, should just take the translation table
9      from the command line.
10     
11usage: %prog < maf > maf
12"""
13
14from __future__ import division
15
16import psyco_full
17
18import sys
19
20import sys
21from bx.align import maf
22import string
23
24table = string.maketrans( "#=X@", "-***")
25
26def main():
27
28    maf_reader = maf.Reader( sys.stdin )
29    maf_writer = maf.Writer( sys.stdout )
30
31    for m in maf_reader:
32        for c in m.components:
33            c.text = c.text.translate( table )
34        maf_writer.write( m )   
35   
36    maf_writer.close()
37   
38if __name__ == "__main__":
39    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。