-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·74 lines (68 loc) · 2.02 KB
/
test.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
import serde_mol2
import argparse
def main(args):
'''main...'''
if args.input and args.sqlite:
serde_mol2.read_file_to_db_batch(args.input, args.sqlite, shm = not args.no_shm, desc = args.desc, comment = args.comment, compression = int(args.compress))
if args.output and args.sqlite:
m = serde_mol2.read_db_all(args.sqlite, desc = args.desc, comment = args.comment, limit = int(args.limit), offset = int(args.offset))
serde_mol2.write_mol2(m, args.output)
if args.list_desc and args.sqlite:
for desc in serde_mol2.desc_list(args.sqlite):
print(desc)
if __name__ == "__main__":
parser = argparse.ArgumentParser(usage=__doc__)
parser.add_argument(
'-i',
'--input',
nargs='+',
help="Mol2 files to read"
)
parser.add_argument(
'-o',
'--output',
help="mol2 files to write to"
)
parser.add_argument(
'-s',
'--sqlite',
help="Sqlite db to work with"
)
parser.add_argument(
'-c',
'--compress',
default='3',
help="Sqlite database to write to"
)
parser.add_argument(
'--limit',
default='0',
help="Limit the number of structures retrieved from the database. Zero means no limit."
)
parser.add_argument(
'--offset',
default='0',
help="Offset when limiting the number of structures retrieved from the database. Zero means no offset."
)
parser.add_argument(
'--no-shm',
action="store_true",
help="Do not use shm device for temporary storage"
)
parser.add_argument(
'--list-desc',
action="store_true",
help="Do not use shm device for temporary storage"
)
parser.add_argument(
'--desc',
default='',
help="Description to add or filter by"
)
parser.add_argument(
'--comment',
default='',
help="Comment to add or filter by"
)
main(parser.parse_args())