bx-python / scripts /

#!/usr/bin/env python

Read an alignment from stdin and for each block print the result of 
evaluating `template_string` (in cheetah template format). The alignment
block will be placed in the template context as `a` and the list of components
as `c`.

usage: %prog template [options]
    -f, --format = maf: Input format, maf (default) or axt

from __future__ import division

import psyco_full

import sys
from bx.cookbook import doc_optparse
from bx import align

    from Cheetah.Template import Template
    print >> sys.stderr, "This script requires the Cheetah template modules"
    sys.exit( -1 )

def main():

    # Parse command line arguments
    options, args = doc_optparse.parse( __doc__ )

        template = Template( args[0] )
        format = options.format
        if not format: format = "maf"

    reader = align.get_reader( format, sys.stdin ) 

    for a in reader: 
        template.a = a
        template.c = a.components
        print template

if __name__ == "__main__": 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.