def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) params = eval(str(opts)) params["metrics"] = ",".join(opts.metrics) # create local copies of command-line options input_path = opts.input_path output_dir = opts.output_path metrics_list = opts.metrics tree_fp = opts.tree_path # Check the tree exists if phylogenetically-aware measure is used for metric in metrics_list: try: metric_f = get_phylogenetic_metric(metric) if tree_fp is None: option_parser.error("metric %s requires a tree, but " "none found" % metric) except AttributeError: pass if isfile(input_path): # single otu table mode parallel_runner = ParallelBetaDiversitySingle( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep, ) parallel_runner( input_path, output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=opts.suppress_submit_jobs, ) else: input_fps = glob("%s/*" % input_path) parallel_runner = ParallelBetaDiversityMultiple( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep, ) parallel_runner( input_fps, output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=opts.suppress_submit_jobs, )
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) params = eval(str(opts)) params['metrics'] = ','.join(opts.metrics) # create local copies of command-line options input_path = opts.input_path output_dir = opts.output_path metrics_list = opts.metrics tree_fp = opts.tree_path # Check the tree exists if phylogenetically-aware measure is used for metric in metrics_list: try: metric_f = get_phylogenetic_metric(metric) if tree_fp == None: stderr.write("metric %s requires a tree, but none found\n"\ % (metric,)) exit(1) except AttributeError: pass if isfile(input_path): # single otu table mode parallel_runner = ParallelBetaDiversitySingle( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep) parallel_runner(input_path, output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=False) else: input_fps = glob('%s/*' % input_path) parallel_runner = ParallelBetaDiversityMultiple( cluster_jobs_fp=opts.cluster_jobs_fp, jobs_to_start=opts.jobs_to_start, retain_temp_files=opts.retain_temp_files, suppress_polling=opts.suppress_polling, seconds_to_sleep=opts.seconds_to_sleep) parallel_runner(input_fps, output_dir, params, job_prefix=opts.job_prefix, poll_directly=opts.poll_directly, suppress_submit_jobs=False)