def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    # Create the output dir if it doesn't already exist.
    output_dir = opts.output_dir
    try:
        create_dir(output_dir)
    except:
        option_parser.error("Could not create or access output directory "
                            "specified with the -o/--output_dir option.")

    otu_table_fp = opts.otu_table_fp
    table = load_table(otu_table_fp)

    estimator = ObservationRichnessEstimator(table,
                                             Chao1MultinomialPointEstimator)
    results = estimator(opts.min, opts.max, opts.num_steps,
                        opts.confidence_level)

    out_fp = join(output_dir, 'estimates_table.txt')
    with open(out_fp, 'w') as out_f:
        results.toTable(out_f)
 def setUp(self):
     """Define some sample data that will be used by the tests."""
     # Single sample, 6 observations, one of which isn't observed in sample.
     self.biom_table1 = parse_biom_table(biom_table_str1)
     self.estimator1 = ObservationRichnessEstimator(
         self.biom_table1, Chao1MultinomialPointEstimator)