File: __main__.py

package info (click to toggle)
python-screed 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 820 kB
  • sloc: python: 3,356; makefile: 169; sh: 32; javascript: 16
file content (53 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python

# Copyright (c) 2016, The Regents of the University of California.

from __future__ import absolute_import, print_function

import argparse
import sys

from . import createscreed
from . import dump_fasta
from . import dump_fastq


class ScreedCommands(object):

    def __init__(self):
        parser = argparse.ArgumentParser(
            description="",
            usage='''screed <command> [<args>]

Available:

    db <filename>               Creates a screed database.
    dump_fasta <db> <output>    Convert a screed database to a FASTA file
    dump_fastq <db> <output>    Convert a screed database to a FASTQ file

''')

        commands = {
            'db': createscreed.main,
            'dump_fasta': dump_fasta.main,
            'dump_fastq': dump_fastq.main,
        }

        parser.add_argument('command')
        args = parser.parse_args(sys.argv[1:2])
        if args.command not in commands:
            print('Unrecognized command')
            parser.print_help()
            sys.exit(1)

        cmd = commands[args.command]
        cmd(sys.argv[2:])


def main():
    ScreedCommands()
    return 0


if __name__ == "__main__":
    main()