def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if os.path.isdir(opts.input_path): multiple_file_upgma(opts.input_path, opts.output_path) elif os.path.isfile(opts.input_path): single_file_upgma(opts.input_path, opts.output_path) else: print("io error, check input file path") exit(1)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) if os.path.isdir(opts.input_path): multiple_file_upgma(opts.input_path,opts.output_path) elif os.path.isfile(opts.input_path): single_file_upgma(opts.input_path, opts.output_path) else: print("io error, check input file path") exit(1)
def test_single_file_upgma(self): """ single_file_upgma should throw no errors""" titles = ["hi", "ho"] distdata = numpy.array([[0, 0.5], [0.5, 0.0]]) fname = get_tmp_filename(prefix="upgma_", suffix=".txt") f = open(fname, "w") self._paths_to_clean_up.append(fname) f.write(format_distance_matrix(titles, distdata)) f.close() fname2 = get_tmp_filename(prefix="upgma_", suffix=".txt", result_constructor=str) self._paths_to_clean_up.append(fname2) single_file_upgma(fname, fname2) assert os.path.exists(fname2)
def test_single_file_upgma(self): """ single_file_upgma should throw no errors""" titles = ['hi','ho'] distdata = numpy.array([[0,.5],[.5,0.]]) fname = get_tmp_filename(prefix='upgma_',suffix='.txt') f = open(fname,'w') self._paths_to_clean_up.append(fname) f.write(format_distance_matrix(titles, distdata)) f.close() fname2 = get_tmp_filename(prefix='upgma_',suffix='.txt', result_constructor=str) self._paths_to_clean_up.append(fname2) single_file_upgma(fname,fname2) assert(os.path.exists(fname2))