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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Read an alignment from stdin and for each block print the result of
5evaluating `template_string` (in cheetah template format). The alignment
6block will be placed in the template context as `a` and the list of components
7as `c`.
8
9usage: %prog template [options]
10    -f, --format = maf: Input format, maf (default) or axt
11"""
12
13from __future__ import division
14
15import psyco_full
16
17import sys
18from bx.cookbook import doc_optparse
19from bx import align
20
21try:
22    from Cheetah.Template import Template
23except:
24    print >> sys.stderr, "This script requires the Cheetah template modules"
25    sys.exit( -1 )
26
27def main():
28
29    # Parse command line arguments
30    options, args = doc_optparse.parse( __doc__ )
31
32    try:
33        template = Template( args[0] )
34        format = options.format
35        if not format: format = "maf"
36    except:
37        doc_optparse.exception()
38
39    reader = align.get_reader( format, sys.stdin )
40
41    for a in reader:
42        template.a = a
43        template.c = a.components
44        print template
45
46if __name__ == "__main__":
47        main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。