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

リビジョン 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 a MAF from standard input and print average GC content of each alignment
5
6usage: %prog < maf > out
7"""
8
9from __future__ import division
10
11import sys
12
13from bx.align import maf
14
15
16def __main__():
17   
18    maf_reader = maf.Reader( sys.stdin )
19
20    for m in maf_reader:
21        gc = 0
22        bases = 0
23        for c in m.components:
24          gc += c.text.count( 'G' )
25          gc += c.text.count( 'C' )
26          gc += c.text.count( 'g' )
27          gc += c.text.count( 'c' )
28          bases += ( len( c.text ) - c.text.count( '-' ) )
29
30        print gc / bases
31
32if __name__ == "__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。