-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdumpHDF5.py
38 lines (30 loc) · 1.25 KB
/
dumpHDF5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python3.6
import sys, os
from optparse import OptionParser, IndentedHelpFormatter
sys.path.append('/data2/yztxwd/scripts/python/Module')
import numpyArrayDict as nad
class CustomHelpFormatter(IndentedHelpFormatter):
def format_description(self, description):
return description
description = """
"""
parser = OptionParser(description= description, formatter = CustomHelpFormatter())
parser.add_option('-f','--file',dest='file',help='midpoint/coverage bedgraph file separated by comma')
parser.add_option('-o','--specie',dest='specie',help='species')
parser.add_option('-d','--database',dest='hdf5',help='hdf5 saving midpoint/coverage information')
parser.add_option('-s','--source',dest='source',help='index name in hdf5 file')
option, argument = parser.parse_args()
filenames = option.file.split(',')
ifFirst = True
count = 0
for i in filenames:
count += 1
print("Processing No.%s file.........." %count)
if ifFirst:
intermediate = nad.numpyArrayDict(specie=option.specie).create_dict_fromfile(i)
ifFirst=False
else:
intermediate.add_dict_fromfile(i)
print("Dumping into hdf5 file........")
intermediate.dump_hdf5(option.hdf5, option.source)
print("Script Done!")