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

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

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

行番号 
1#!/usr/bin/python2.6
2
3"""
4Read TFLOC output from stdin and write out a summary in which the nth line
5contains the number of sites found in the nth alignment of the input.
6
7TODO: This is very special case, should it be here?
8"""
9
10import sys
11
12counts = dict()
13
14max_index = -1
15
16for line in sys.stdin:
17    if line[0].isdigit():
18        current_index = int( line )
19        max_index = max( current_index, max_index )       
20    elif line[0] == "'":
21        try: counts[ current_index ] += 1
22        except: counts[ current_index ] = 1
23    else:
24        raise "Invalid input line " + line
25
26for i in range( max_index + 1 ):
27    print counts.get( i, 0 )
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。