File: denoiser_worker.py

package info (click to toggle)
qiime 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 29,704 kB
  • sloc: python: 77,837; haskell: 379; sh: 113; makefile: 103
file content (85 lines) | stat: -rwxr-xr-x 3,032 bytes parent folder | download
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
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env python

""" A simple client waiting for data to clean up 454 sequencing data"""

__author__ = "Jens Reeder"
__copyright__ = "Copyright 2011, The QIIME Project" 
__credits__ = ["Jens Reeder", "Rob Knight"]#remember to add yourself if you make changes
__license__ = "GPL"
__version__ = "1.4.0"
__maintainer__ = "Jens Reeder"
__email__ = "jens.reeder@gmail.com"
__status__ = "Release"

from qiime.util import parse_command_line_parameters, get_options_lookup,\
    make_option

from qiime.denoiser.utils import get_denoiser_data_dir
from qiime.denoiser.denoise_worker import setup_worker

options_lookup = get_options_lookup()

#denoiser_worker.py
script_info={}
script_info['brief_description'] = "Start a denoiser worker process"
script_info['script_description'] = """The workers are automatically started by the denoiser.py script.
You usually never need to use this script yourself.

A worker waits for data and does flowgram alignments once it gets it."""

script_info['script_usage'] = [ \
    ( "",
      "Start worker and connect to server listening on port 12345 on the same machine (localhost)",
      "%prog -f seqs.fna -f denoiser_out/worker99 -p 12345 -s localhost")
    ]

script_info['output_description']="Denoise worker writes a log file if verbose flag is set."

script_info['required_options']=[\

   make_option('-f','--file_path',action='store',\
                   type='string',dest='file_path',\
                   help='path used as prefix for worker data files'+\
                   '[REQUIRED]'),

    make_option('-p','--port', action='store',\
                    type='int', dest='port', help='Server port '+\
                    '[REQUIRED]'),

    make_option('-s','--server_address',action='store',\
                    type='string',dest='server',help='Server address'+\
                    '[REQUIRED]' )
    ]

script_info['optional_options']=[ \
    
    make_option('-e','--error_profile',action='store',\
                    type='string',dest='error_profile',\
                    help='Path to error profile'+\
                    ' [DEFAULT: %default]',\
                    default = get_denoiser_data_dir()+\
                    'FLX_error_profile.dat'),

    make_option('-c','--counter', action='store',\
                    type='int', dest='counter',\
                    help='Round counter to start this worker with '+\
                    ' [default: %default]', default=0)
    ]

script_info['version'] = __version__

def main(commandline_args=None):
    parser, opts, args = parse_command_line_parameters(**script_info)

    if not opts.file_path:
        parser.error("Required option --file_path not specified.")
    if not opts.port:
        parser.error("Required option --port not specified.")
    if not opts.server:
        parser.error("Required options --server_address not specified.")

    setup_worker(opts.file_path, opts.server, opts.port,
                 opts.counter, opts.verbose, opts.error_profile)
        
if __name__ == "__main__":
    main()