-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeleteHDF5.py
33 lines (26 loc) · 1.13 KB
/
deleteHDF5.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
#!/usr/bin/python3.6
import sys, os, time
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 = """
This script aims to delete specific source in hdf5 file
"""
parser = OptionParser(description= description, formatter = CustomHelpFormatter())
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()
# open hdf5 file
hdf5 = nad.hdf5(option.hdf5, specie = option.specie)
# delete specific source
print("""
Warning: %s will be deleted from %s
There will be 5 seconds before deletion, please be cautious about what you did
""" %(option.source, option.hdf5))
time.sleep(5)
hdf5.delete_source(option.source)
print("%s has been removed from %s" %(option.source, option.hdf5))