def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.show_metrics: print("Known metrics are: %s\n" % (', '.join(list_known_metrics()),)) print("For more information, see http://scikit-bio.org/docs/latest/ge" "nerated/skbio.diversity.alpha.html#module-skbio.diversity.alpha") exit(0) almost_required_options = ['input_path', 'output_path', 'metrics'] for option in almost_required_options: if getattr(opts, option) is None: option_parser.error('Required option --%s omitted.' % option) if os.path.isdir(opts.input_path): multiple_file_alpha(opts.input_path, opts.output_path, opts.metrics, opts.tree_path) elif os.path.isfile(opts.input_path): try: f = open(opts.output_path, 'w') f.close() except IOError: if os.path.isdir(opts.output_path): option_parser.error( "ioerror, couldn't create output file. The output path is a directory, which should be a single file") else: option_parser.error("ioerror, couldn't create output file") single_file_alpha(opts.input_path, opts.metrics, opts.output_path, opts.tree_path)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.show_metrics: print("Known metrics are: %s\n" \ % (', '.join(list_known_metrics()),)) print( "For more information, see http://qiime.org/scripts/alpha_diversity_metrics.html" ) exit(0) almost_required_options = ['input_path', 'output_path', 'metrics'] for option in almost_required_options: if getattr(opts, option) == None: option_parser.error('Required option --%s omitted.' % option) if os.path.isdir(opts.input_path): multiple_file_alpha(opts.input_path, opts.output_path, opts.metrics, opts.tree_path) elif os.path.isfile(opts.input_path): try: f = open(opts.output_path, 'w') f.close() except IOError: if os.path.isdir(opts.output_path): option_parser.error( "ioerror, couldn't create output file. The output path is a directory, which should be a single file" ) else: option_parser.error("ioerror, couldn't create output file") single_file_alpha(opts.input_path, opts.metrics, opts.output_path, opts.tree_path)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.show_metrics: print("Known metrics are: %s\n" \ % (', '.join(list_known_metrics()),)) print("For more information, see http://qiime.org/scripts/alpha_diversity_metrics.html") exit(0) almost_required_options = ['input_path','output_path','metrics'] for option in almost_required_options: if getattr(opts,option) == None: option_parser.error('Required option --%s omitted.' % option) if os.path.isdir(opts.input_path): multiple_file_alpha(opts.input_path, opts.output_path, opts.metrics, opts.tree_path) elif os.path.isfile(opts.input_path): try: f = open(opts.output_path, 'w') f.close() except IOError: print("ioerror, couldn't create output file") exit(1) single_file_alpha(opts.input_path, opts.metrics, opts.output_path, opts.tree_path) else: print("io error, input path not valid. does it exist?") exit(1)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if opts.show_metrics: print("Known metrics are: %s\n" \ % (', '.join(list_known_metrics()),)) exit(0) almost_required_options = ['input_path', 'output_path', 'metrics'] for option in almost_required_options: if getattr(opts, option) == None: option_parser.error('Required option --%s omitted.' % option) if os.path.isdir(opts.input_path): multiple_file_alpha(opts.input_path, opts.output_path, opts.metrics, opts.tree_path) elif os.path.isfile(opts.input_path): try: f = open(opts.output_path, 'w') f.close() except IOError: print("ioerror, couldn't create output file") exit(1) single_file_alpha(opts.input_path, opts.metrics, opts.output_path, opts.tree_path) else: print("io error, input path not valid. does it exist?") exit(1)
PC.635 0.94 4.20239 18.0 PC.636 0.925 3.78882 16.0 ====== ======= ============= ================ """ script_info['required_options'] = [] script_info['optional_options']=[\ make_option('-i', '--input_path', help='Input OTU table filepath or input directory containing OTU' +\ ' tables for batch processing. [default: %default]', type='existing_path'), make_option('-o', '--output_path', help='Output filepath to store alpha diversity metric(s) for each sample in a tab-separated format' +\ 'or output directory when batch processing. [default: %default]', type='new_path'), make_option('-m', '--metrics', type='multiple_choice', mchoices=list_known_metrics(), default='PD_whole_tree,chao1,observed_species', help='Alpha-diversity metric(s) to use. A comma-separated list should' +\ ' be provided when multiple metrics are specified. [default: %default]'), make_option('-s', '--show_metrics', action='store_true', dest="show_metrics", help='Show the available alpha-diversity metrics and exit.'), make_option('-t', '--tree_path', default=None, help='Input newick tree filepath.' +\ ' [default: %default; REQUIRED for phylogenetic metrics]', type='existing_filepath') ] script_info['version'] = __version__
PC.635 0.94 4.20239 18.0 PC.636 0.925 3.78882 16.0 ====== ======= ============= ============= """ script_info['required_options'] = [] script_info['optional_options'] = [ make_option('-i', '--input_path', help='Input OTU table filepath or input directory containing OTU' + ' tables for batch processing. [default: %default]', type='existing_path'), make_option('-o', '--output_path', help='Output filepath to store alpha diversity metric(s) for each sample in a tab-separated format ' 'or output directory when batch processing. [default: %default]', type='new_path'), make_option('-m', '--metrics', type='multiple_choice', mchoices=list_known_metrics(), default='PD_whole_tree,chao1,observed_otus', help='Alpha-diversity metric(s) to use. A comma-separated list should' + ' be provided when multiple metrics are specified. [default: %default]'), make_option('-s', '--show_metrics', action='store_true', dest="show_metrics", help='Show the available alpha-diversity metrics and exit.'), make_option('-t', '--tree_path', default=None, help='Input newick tree filepath.' + ' [default: %default; REQUIRED for phylogenetic metrics]', type='existing_filepath') ] script_info['version'] = __version__
__maintainer__ = "Jesse Stombaugh" __email__ = "*****@*****.**" __status__ = "Development" from cogent.util.unit_test import TestCase, main import os, sys, copy from qiime.util import get_qiime_scripts_dir,make_option from html_from_script import script_path_components,get_script_info,\ _format_help,generate_choice_input,\ generate_string_input,generate_float_input,\ generate_int_input,generate_True_input,\ generate_False_input,get_html_for_options,get_html from qiime.alpha_diversity import list_known_metrics alpha_metrics=list_known_metrics(); from qiime.beta_diversity import list_known_metrics beta_metrics=list_known_metrics(); class HTMLFromScriptTests(TestCase): def setUp(self): """ """ self.headers=['head1','head2','head3'] self.test_option_file=make_option('-i', '--coord_fname', help='Input principal coordinates filepath', type='existing_path') self.test_option_colorby=make_option('-b', '--colorby', dest='colorby',\ help='Comma-separated list categories metadata categories' +\