root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/EGG-INFO/scripts/maf_print_chroms.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"""
4Read a maf from stdin and print the chromosome number for each alignment. It
5searches for 'chr' in each alignment block src, and may not be robust if other
6src formats are used.
7
8NOTE: See 'align_print_template.py' for a more general variation of this
9      program.
10
11usage: %prog refindex [options]
12"""
13
14from __future__ import division
15
16import sys
17from bx.cookbook import doc_optparse
18from bx.align import maf
19from optparse import OptionParser
20
21def __main__():
22
23    # Parse command line arguments
24    options, args = doc_optparse.parse( __doc__ )
25
26    try:
27        refindex = int( args[0] )
28    except:
29        doc_optparse.exit()
30
31    maf_reader = maf.Reader( sys.stdin )
32
33    for m in maf_reader:
34                c = m.components[ refindex ].src
35                print c[ c.rfind( "chr" ) + 3 : ]
36
37if __name__ == "__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。