root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/bx/misc/seeklzop_tests.py @ 3

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

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

行番号 
1import seeklzop
2import os
3import random
4import sys
5
6"""
7T="/Users/james/cache/hg18/align/multiz28way/chr10.maf"
8C="/Users/james/cache/hg18/align/multiz28way/chr10.maf.lzo"
9
10def test():
11    f = seeklzop.SeekableLzopFile( C, C + "t", block_cache_size=20 )
12    for line in f:
13        pass
14       
15def test_random_seeking():
16    s = os.stat( T ).st_size
17    raw = open( T )
18    f = seeklzop.SeekableLzopFile( C, C + "t", block_cache_size=20 )
19    for i in range( 1000 ):
20        seek_to = random.randrange( s )
21       
22        f.seek( seek_to )
23        raw.seek( seek_to )
24
25        l1 = f.readline()
26        l2 = raw.readline()
27       
28        assert l1 == l2, "%r != %r" % ( l1, l2 )
29        assert raw.tell() == f.tell(), "tells not equal"
30"""
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。