Debian Codegraph @

pymzml/utils/read_moby_dick.py

raw symbols SCIP
1 #!/usr/bin/env python3
2
3 """
4 Show chapter x of indexed gzipped moby dick
5
6
7 Usage:
8
9 python read_moby_dick.py <Chapter>
10 """
11
12 # Python mzML module - pymzml
13 # Copyright (C) 2010-2019 M. Kösters, C. Fufezan
14 # The MIT License (MIT)
15
16 # Permission is hereby granted, free of charge, to any person obtaining a copy
17 # of this software and associated documentation files (the "Software"), to deal
18 # in the Software without restriction, including without limitation the rights
19 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20 # copies of the Software, and to permit persons to whom the Software is
21 # furnished to do so, subject to the following conditions:
22
23 # The above copyright notice and this permission notice shall be included in all
24 # copies or substantial portions of the Software.
25
26 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 # SOFTWARE.
33
34 from GSGR import GSGR
35 import sys
36 import time
37
38 my_Reader = GSGR("./Moby_Dick_indexed.gz")
39
40 if __name__ == "__main__":
41 if len(sys.argv) != 2:
42 print(__doc__)
43 else:
44 try:
45 chap_num = int(sys.argv[1])
46 except:
47 chap_num = sys.argv[1]
48 print(
49 """
50 Reading indexed gzip and retrieving chapter {0}
51 """.format(
52 chap_num
53 )
54 )
55 s = time.time()
56 print(
57 """{0}
58
59 Took {1:.5f} seconds to retrieve chapter
60
61 """.format(
62 my_Reader.read_block(chap_num), time.time() - s
63 )
64 )