예제 #1
0
파일: test_init.py 프로젝트: biocore/pyqi
 def setUp(self):
     self.obj = optparse_factory(
         ghetto, [OptparseUsageExample('a', 'b', 'c')], [
             OptparseOption(
                 Type=str, Parameter=ghetto.CommandIns['c'], ShortName='n')
         ], [
             OptparseResult(Type=str,
                            Parameter=ghetto.CommandOuts['itsaresult'],
                            Handler=oh)
         ], '2.0-dev')
예제 #2
0
                   ShortName='i',
                   Name='input_dir',
                   Required=True,
                   Help='Path to the directory with the time results',
                   ),
    OptparseOption(Parameter=cmd_in_lookup('job_ids'),
                   Type='str',
                   Action='store',
                   Handler=string_list_handler,
                   ShortName='w',
                   Name='wait_on',
                   Required=False,
                   Help='Comma-separated list of job ids to wait for before '
                        'processing the results'),
    OptparseOption(Parameter=None,
                   Type='new_dirpath',
                   ShortName='o',
                   Name='output-dir',
                   Required=True,
                   Help='The output directory')
]

# outputs map result keys to output options and handlers. It is not necessary
# to supply an associated option, but if you do, it must be an option from the
# inputs list (above).
outputs = [
    OptparseResult(Parameter=cmd_out_lookup('bench_data'),
                   Handler=write_bench_results,
                   InputName='output-dir'),
]
    ),
    OptparseOption(
        Parameter=cmd_in_lookup('labels'),
        Type='str',
        Action='store',  # default is 'store', change if desired
        Handler=string_list_handler,  # must be defined if desired
        ShortName='l',  # must be defined if desired
        # Name='labels', # implied by Parameter
        # Required=True, # implied by Parameter
        # Help='List of strings to label each data series on the plot', # implied by Parameter
    ),
    OptparseOption(Parameter=None,
                   Type='new_dirpath',
                   ShortName='o',
                   Name='output-dir',
                   Required=True,
                   Help='The output directory')
]

# outputs map result keys to output options and handlers. It is not necessary
# to supply an associated option, but if you do, it must be an option from the
# inputs list (above).
outputs = [
    OptparseResult(Parameter=cmd_out_lookup('mem_fig'),
                   Handler=write_matplotlib_figure,
                   InputName='output-dir'),
    OptparseResult(Parameter=cmd_out_lookup('time_fig'),
                   Handler=write_matplotlib_figure,
                   InputName='output-dir'),
]
예제 #4
0
    # normalization to relative_abundance
    OptparseOption(Parameter=cmd_in_lookup('relative_abund'),
                   ShortName='r',
                   Action='store_true',
                   Help='convert table to relative abundance'),

    # conversion to presensce/absence
    OptparseOption(Parameter=cmd_in_lookup('presence_absence'),
                   ShortName='p',
                   Action='store_true',
                   Help='convert table to presence/absence'),

    # if relative abundance then normalize by sample or by observation
    OptparseOption(Parameter=cmd_in_lookup('axis'),
                   ShortName='a',
                   Default='sample'),
    OptparseOption(Parameter=None,
                   Type='new_filepath',
                   ShortName='o',
                   Name='output-fp',
                   Required=True,
                   Help='the output filepath')
]

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('table'),
                   Handler=write_biom_table,
                   InputName='output-fp')
]
예제 #5
0
from pyqi.commands.make_bash_completion import CommandConstructor

cmd_in_lookup = make_command_in_collection_lookup_f(CommandConstructor)
cmd_out_lookup = make_command_out_collection_lookup_f(CommandConstructor)

usage_examples = [
    OptparseUsageExample(
        ShortDesc="Create a bash completion script",
        LongDesc="Create a bash completion script for use with a pyqi driver",
        Ex=
        "%prog --command-config-module pyqi.interfaces.optparse.config --driver-name pyqi -o ~/.bash_completion.d/pyqi"
    )
]

inputs = [
    OptparseOption(Parameter=cmd_in_lookup('command_config_module')),
    OptparseOption(Parameter=cmd_in_lookup('driver_name')),
    OptparseOption(Parameter=None,
                   Type='new_filepath',
                   ShortName='o',
                   Name='output-fp',
                   Required=True,
                   Help='output filepath')
]

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('result'),
                   Handler=write_string,
                   InputName='output-fp')
]
예제 #6
0
usage_examples = [
    OptparseUsageExample(ShortDesc="Basic script usage",
                         LongDesc="Write a summary of table.biom to "
                                  "table_summary.txt",
                         Ex="%prog -i table.biom -o table_summary.txt")
]

inputs = [
    OptparseOption(Parameter=cmd_in_lookup('table'),
                   Type="existing_filepath",
                   Handler=load_biom_table_with_file_contents,
                   ShortName='i',
                   Name='input-fp'),
    OptparseOption(Parameter=cmd_in_lookup('qualitative'),
                   Type=None,
                   Action="store_true"),
    OptparseOption(Parameter=None,
                   Type='new_filepath',
                   ShortName='o',
                   Name='output-fp',
                   Required=False,
                   Default=None,
                   Help='the output filepath')
]

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('biom_summary'),
                   Handler=write_or_print_list_of_strings,
                   InputName='output-fp')
]
예제 #7
0
파일: test_init.py 프로젝트: biocore/pyqi
 def _get_outputs(self):
     return [
         OptparseResult(Parameter=ghetto.CommandOuts['itsaresult'],
                        Handler=oh)
     ]
예제 #8
0
usage_examples = [
    OptparseUsageExample(ShortDesc="Validating a BIOM file",
                         LongDesc="Validate the contents of table.biom for "
                         "adherence to the BIOM format specification",
                         Ex="%prog -i table.biom")
]

inputs = [
    OptparseOption(Parameter=cmd_in_lookup('table'),
                   Type='existing_filepath',
                   Handler=None,
                   ShortName='i',
                   Name='input-fp',
                   Help='the input filepath to validate against the BIOM '
                   'format specification'),
    OptparseOption(Parameter=cmd_in_lookup('is_json'),
                   Type=None,
                   Action='store_true'),
    OptparseOption(Parameter=cmd_in_lookup('format_version'), ShortName='f'),
    OptparseOption(Parameter=cmd_in_lookup('detailed_report'),
                   Type=None,
                   Action='store_true')
]

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('report_lines'),
                   Handler=print_list_of_strings),
    OptparseResult(Parameter=cmd_out_lookup('valid_table'),
                   Handler=report_table_validity)
]
예제 #9
0
        # Help='Path to the directory with the time results', # implied by Parameter
    ),
    OptparseOption(Parameter=None,
                   Type='new_dirpath',
                   ShortName='o',
                   Name='output-dir',
                   Required=True,
                   Help='The output directory')
]

# outputs map result keys to output options and handlers. It is not necessary
# to supply an associated option, but if you do, it must be an option from the
# inputs list (above).
outputs = [
    OptparseResult(Parameter=cmd_out_lookup('bench_data'),
                   Handler=write_summarized_results,
                   InputName='output-dir'),
    OptparseResult(Parameter=cmd_out_lookup('mem_fig'),
                   Handler=write_matplotlib_figure,
                   InputName='output-dir'),
    OptparseResult(Parameter=cmd_out_lookup('mem_str'),
                   Handler=write_string_to_dir,
                   InputName='output-dir'),
    OptparseResult(Parameter=cmd_out_lookup('time_fig'),
                   Handler=write_matplotlib_figure,
                   InputName='output-dir'),
    OptparseResult(Parameter=cmd_out_lookup('time_str'),
                   Handler=write_string_to_dir,
                   InputName='output-dir'),
]
예제 #10
0
from pyqi.core.interfaces.optparse import (OptparseUsageExample,
                                           OptparseResult)
from pyqi.core.command import make_command_out_collection_lookup_f
from pyqi.core.interfaces.optparse.output_handler import print_list_of_strings
from biom.commands.installation_informer import CommandConstructor

__author__ = "Jai Ram Rideout"
__copyright__ = "Copyright 2011-2013, The BIOM Format Development Team"
__credits__ = ["Jai Ram Rideout", "Greg Caporaso", "Daniel McDonald"]
__license__ = "BSD"
__url__ = "http://biom-format.org"
__maintainer__ = "Jai Ram Rideout"
__email__ = "*****@*****.**"

cmd_out_lookup = make_command_out_collection_lookup_f(CommandConstructor)

usage_examples = [
    OptparseUsageExample(ShortDesc="Displaying installation info",
                         LongDesc="Display biom-format installation "
                         "information",
                         Ex="%prog")
]

inputs = []

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('install_info_lines'),
                   Handler=print_list_of_strings)
]
예제 #11
0
inputs = [
    OptparseOption(Parameter=cmdin_lookup('command'),
                   ShortName='c',
                   Handler=command_handler),
    OptparseOption(Parameter=cmdin_lookup('command_module'), ShortName='m'),
    OptparseOption(Parameter=cmdin_lookup('author'), ShortName='a'),
    OptparseOption(Parameter=cmdin_lookup('email'), ShortName='e'),
    OptparseOption(Parameter=cmdin_lookup('license'), ShortName='l'),
    OptparseOption(Parameter=cmdin_lookup('copyright')),
    OptparseOption(Parameter=cmdin_lookup('version'), Name='config-version'),
    OptparseOption(Parameter=cmdin_lookup('credits'),
                   Handler=string_list_handler,
                   Help='comma-separated list of other authors'),
    OptparseOption(
        Parameter=None,
        Type='new_filepath',
        ShortName='o',
        Name='output-fp',
        Required=True,
        Help=
        'output filepath to store generated optparse Python configuration file'
    )
]

outputs = [
    OptparseResult(Parameter=cmdout_lookup('result'),
                   Handler=write_list_of_strings,
                   InputName='output-fp')
]
예제 #12
0
]

inputs = [
    OptparseOption(Parameter=cmd_in_lookup('tickmark_in_box_index'),
                   Type=int,
                   Action='store', # default is 'store', change if desired
                   ShortName=None, # must be defined if desired
                   ),
    OptparseOption(Parameter=cmd_in_lookup('text'),
                   Type=str,
                   Action='store',
                   Handler=driver
                   ),
    OptparseOption(Parameter=cmd_in_lookup('box_width'),
                   Type=int,
                   Action='store', # default is 'store', change if desired
                   ShortName=None, # must be defined if desired
                   ),
    OptparseOption(Parameter=cmd_in_lookup('buffer_size'),
                   Type=int,
                   Action='store', # default is 'store', change if desired
                   ShortName=None, # must be defined if desired
                   )
]

outputs = [
    OptparseResult(Parameter=cmd_out_lookup('orp_word'),
                    Handler=box_writer, # must be defined
                    InputName=None), # define if tying to an OptparseOption
]
예제 #13
0
__credits__ = ["Evan Bolyen"]

from pyqi.core.interfaces.optparse import (OptparseOption, OptparseResult,
                                           OptparseUsageExample)
from pyqi.core.interfaces.optparse.input_handler import string_list_handler
from pyqi.core.interfaces.optparse.output_handler import print_string
from pyqi.core.command import make_command_in_collection_lookup_f, make_command_out_collection_lookup_f
from pyqi.commands.serve_html_interface import CommandConstructor

cmdin_lookup = make_command_in_collection_lookup_f(CommandConstructor)
cmdout_lookup = make_command_out_collection_lookup_f(CommandConstructor)

usage_examples = [
    OptparseUsageExample(
        ShortDesc="Start html interface",
        LongDesc=
        "Starts an html interface server on the specified --port and --interface-module",
        Ex='%prog -p 8080 -m pyqi.interfaces.html.config')
]

inputs = [
    OptparseOption(Parameter=cmdin_lookup('port'), ShortName='p', Type=int),
    OptparseOption(Parameter=cmdin_lookup('interface_module'),
                   ShortName='m',
                   Required=True)
]

outputs = [
    OptparseResult(Parameter=cmdout_lookup('result'), Handler=print_string)
]
예제 #14
0
    ),
    OptparseOption(Parameter=None,
                   Type='new_filepath',
                   ShortName='o',
                   Name='output-fp',
                   Required=True,
                   Help='the output filepath')
]

# outputs map result keys to output options and handlers. It is not necessary
# to supply an associated option, but if you do, it must be an option from the
# inputs list (above).
outputs = [
    # An example option that maps to a CommandIn.
    # OptparseResult(Parameter=cmd_out_lookup('name_of_a_command_out'),
    #                Handler=write_string, # a function applied to the output of the Command
    #                # the name of the option (defined in inputs, above), whose
    #                # value will be made available to Handler. This name
    #                # can be either an underscored or dashed version of the
    #                # option name (e.g., 'output_fp' or 'output-fp')
    #                InputName='output-fp'),
    #
    # An example option that does not map to a CommandIn.
    # OptparseResult(Parameter=cmd_out_lookup('some_other_result'),
    #                Handler=print_string)
    OptparseResult(
        Parameter=cmd_out_lookup('bench_suite'),
        Handler=write_string,  # must be defined
        InputName='output-fp'),  # define if tying to an OptparseOption
]