Esempio n. 1
0
def main(argv=()):
    with errors.clean_commandline_error_exit():
        if len(argv) > 1:
            errors.log_and_raise(
                'Command line parsing failure: make_examples does not accept '
                'positional arguments but some are present on the command line: '
                '"{}".'.format(str(argv)), errors.CommandLineError)
        del argv  # Unused.

        proto_utils.uses_fast_cpp_protos_or_die()

        logging_level.set_from_flag()
        hts_verbose.set(hts_verbose.htsLogLevel[FLAGS.hts_logging_level])

        # Set up options; may do I/O.
        options = default_options(add_flags=True, flags_obj=FLAGS)

        # Check arguments that apply to any mode.
        if not options.reference_filename:
            errors.log_and_raise('ref argument is required.',
                                 errors.CommandLineError)
        if not options.reads_filename:
            errors.log_and_raise('reads argument is required.',
                                 errors.CommandLineError)
        if not options.examples_filename:
            errors.log_and_raise('examples argument is required.',
                                 errors.CommandLineError)
        if options.n_cores != 1:
            errors.log_and_raise(
                'Currently only supports n_cores == 1 but got {}.'.format(
                    options.n_cores), errors.CommandLineError)

        # Check for argument issues specific to train mode.
        if in_training_mode(options):
            if not options.truth_variants_filename:
                errors.log_and_raise(
                    'truth_variants is required when in training mode.',
                    errors.CommandLineError)
            if not options.confident_regions_filename:
                errors.log_and_raise(
                    'confident_regions is required when in training mode.',
                    errors.CommandLineError)
            if options.gvcf_filename:
                errors.log_and_raise('gvcf is not allowed in training mode.',
                                     errors.CommandLineError)
        else:
            # Check for argument issues specific to calling mode.
            if options.variant_caller_options.sample_name == _UNKNOWN_SAMPLE:
                errors.log_and_raise(
                    'sample_name must be specified in calling mode.',
                    errors.CommandLineError)
            if options.variant_caller_options.gq_resolution < 1:
                errors.log_and_raise(
                    'gq_resolution must be a non-negative integer.',
                    errors.CommandLineError)

        # Run!
        make_examples_runner(options)
Esempio n. 2
0
def main(argv=()):
  with errors.clean_commandline_error_exit():
    if len(argv) > 1:
      errors.log_and_raise(
          'Command line parsing failure: make_examples does not accept '
          'positional arguments but some are present on the command line: '
          '"{}".'.format(str(argv)), errors.CommandLineError)
    del argv  # Unused.

    proto_utils.uses_fast_cpp_protos_or_die()

    logging_level.set_from_flag()
    hts_verbose.set(hts_verbose.htsLogLevel[FLAGS.hts_logging_level])

    # Set up options; may do I/O.
    options = default_options(add_flags=True, flags_obj=FLAGS)

    # Check arguments that apply to any mode.
    if not options.reference_filename:
      errors.log_and_raise('ref argument is required.', errors.CommandLineError)
    if not options.reads_filename:
      errors.log_and_raise('reads argument is required.',
                           errors.CommandLineError)
    if not options.examples_filename:
      errors.log_and_raise('examples argument is required.',
                           errors.CommandLineError)
    if options.n_cores != 1:
      errors.log_and_raise(
          'Currently only supports n_cores == 1 but got {}.'.format(
              options.n_cores), errors.CommandLineError)

    # Check for argument issues specific to train mode.
    if in_training_mode(options):
      if not options.truth_variants_filename:
        errors.log_and_raise(
            'truth_variants is required when in training mode.',
            errors.CommandLineError)
      if not options.confident_regions_filename:
        errors.log_and_raise(
            'confident_regions is required when in training mode.',
            errors.CommandLineError)
      if options.gvcf_filename:
        errors.log_and_raise('gvcf is not allowed in training mode.',
                             errors.CommandLineError)
    else:
      # Check for argument issues specific to calling mode.
      if options.variant_caller_options.sample_name == _UNKNOWN_SAMPLE:
        errors.log_and_raise('sample_name must be specified in calling mode.',
                             errors.CommandLineError)
      if options.variant_caller_options.gq_resolution < 1:
        errors.log_and_raise('gq_resolution must be a non-negative integer.',
                             errors.CommandLineError)

    # Run!
    make_examples_runner(options)
Esempio n. 3
0
def main(argv=()):
    with errors.clean_commandline_error_exit():
        if len(argv) > 1:
            errors.log_and_raise(
                'Command line parsing failure: make_examples does not accept '
                'positional arguments but some are present on the command line: '
                '"{}".'.format(str(argv)), errors.CommandLineError)
        del argv  # Unused.

        proto_utils.uses_fast_cpp_protos_or_die()

        logging_level.set_from_flag()
        hts_verbose.set(hts_verbose.htsLogLevel[FLAGS.hts_logging_level])

        # Set up options; may do I/O.
        options = default_options(add_flags=True, flags_obj=FLAGS)
        check_options_are_valid(options)

        # Run!
        make_examples_core.make_examples_runner(options)
Esempio n. 4
0
    def test_set(self):
        hts_verbose.set(hts_verbose.htsLogLevel.HTS_LOG_TRACE)
        level = hts_verbose.get()
        self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_TRACE)

        hts_verbose.set(hts_verbose.htsLogLevel.HTS_LOG_INFO)
        level = hts_verbose.get()
        self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_INFO)

        hts_verbose.set(hts_verbose.htsLogLevel['HTS_LOG_DEBUG'])
        level = hts_verbose.get()
        self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_DEBUG)
Esempio n. 5
0
  def test_set(self):
    hts_verbose.set(hts_verbose.htsLogLevel.HTS_LOG_TRACE)
    level = hts_verbose.get()
    self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_TRACE)

    hts_verbose.set(hts_verbose.htsLogLevel.HTS_LOG_INFO)
    level = hts_verbose.get()
    self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_INFO)

    hts_verbose.set(hts_verbose.htsLogLevel['HTS_LOG_DEBUG'])
    level = hts_verbose.get()
    self.assertEqual(level, hts_verbose.htsLogLevel.HTS_LOG_DEBUG)