-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy path__main__.py
More file actions
39 lines (30 loc) · 954 Bytes
/
__main__.py
File metadata and controls
39 lines (30 loc) · 954 Bytes
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
#!/usr/bin/env python
import argparse
import logging
import sys
from .__init__ import __version__
from .samplot import add_plot
from .samplot_vcf import add_vcf
def main(args=None):
logging.basicConfig(level=logging.INFO, stream=sys.stderr,
format="%(module)s - %(levelname)s: %(message)s")
if args is None:
args = sys.argv[1:]
parser = argparse.ArgumentParser(
prog="samplot", formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument(
"-v",
"--version",
help="Installed version",
action="version",
version="%(prog)s " + str(__version__),
)
sub = parser.add_subparsers(title="[sub-commands]", dest="command")
sub.required = True
add_plot(sub)
add_vcf(sub)
args,extra_args = parser.parse_known_args(args)
args.func(parser, args, extra_args)
if __name__ == "__main__":
sys.exit(main() or 0)