root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/bx/intervals/operations/__init__.py

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

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

行番号 
1"""
2High level operations on genomic intervals. Most accept and produce iterables
3of `bx.io.inervals.io.GenomicInterval` objects.
4"""
5
6from bx.bitset import *
7from bx.filter import *
8
9def warn( msg ):
10    print >> sys.stderr, msg
11
12def fail( msg ):
13    print >> sys.stderr, msg
14    sys.exit(1)
15
16BED_DEFAULT_COLS = 0, 1, 2, 5
17MAX_END = 512*1024*1024
18
19def bits_set_in_range( bits, range_start, range_end ):
20    """
21    Yield start,end tuples for each span of set bits in [range_start,range_end)
22    """
23    end = range_start
24    while 1:
25        start = bits.next_set( end )
26        end = min( bits.next_clear( start ), range_end )
27        if start >= end: break
28        yield start, end
29       
30def bits_clear_in_range( bits, range_start, range_end ):
31    """
32    Yield start,end tuples for each span of clear bits in [range_start,range_end)
33    """
34    end = range_start
35    while 1:
36        start = bits.next_clear( end )
37        if start >= range_end: break
38        end = min( bits.next_set( start ), range_end )
39        yield start, end
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。