<commit_before># @package MiGA
# @license Artistic-2.0

##
# Helper module for workflows
module MiGA::Cli::Action::Wf
  def default_opts_for_wf
    cli.expect_files = true
    cli.defaults = {
      clean: false, regexp: MiGA::Cli.FILE_REGEXP,
      project_type: :genomes, dataset_type: :popgenome,
      ncbi_draft: true
    }
  end

  def opts_for_wf(opt, files_desc, params = {})
    {
      multi: false, cleanup: true, project_type: false, ncbi: true
    }.each { |k, v| params[k] = v if params[k].nil? }
    opt.on(
      '-o', '--out_dir PATH',
      '(Mandatory) Directory to be created with all output data'
    ) { |v| cli[:outdir] = v }
    opt.separator ''
    opt.separator "    FILES...: #{files_desc}"
    opt.separator ''
    opt.separator 'Workflow Control Options'
    opt.on(
      '-C', '--collection STRING',
      'Collection of essential genes to use as reference',
      'One of: dupont_2012 (default), lee_2019'
    ) { |v| cli[:ess_coll] = v }
    if params[:ncbi]
      opt.on(
        '-T', '--ncbi-taxon STRING',
        'Download all the genomes in NCBI classified as this taxon'
      ) { |v| cli[:ncbi_taxon] = v }
      opt.on(
        '--no-draft',
        'Only download complete genomes, not drafts'
      ) { |v| cli[:ncbi_draft] = v }
    end
    if params[:cleanup]
      opt.on(
        '-c', '--clean',
        'Clean all intermediate files after generating the reports'
      ) { |v| cli[:clean] = v }
    end
    opt.on(
      '-R', '--name-regexp REGEXP', Regexp,
      'Regular expression indicating how to extract the name from the path',
      "By default: '#{cli[:regexp]}'"
    ) { |v| cli[:regexp] = v }
    opt.on(
      '--type STRING',
      "Type of datasets. By default: #{cli[:dataset_type]}",
      'Recognized types:',
      *MiGA::Dataset.KNOWN_TYPES
        .map do |k, v|
          "~ #{k}: #{v[:description]}" unless !params[:multi] && v[:multi]
        end.compact
    ) { |v| cli[:dataset_type] = v.downcase.to_sym }
    if params[:project_type]
      opt.on(
        '--project-type STRING',
        "Type of project. By default: #{cli[:project_type]}",
        'Recognized types:',
        *MiGA::Project.KNOWN_TYPES
          .map do |k, v|
            "~ #{k}: #{v[:description]}" unless !params[:multi] && v[:multi]
          end.compact
      ) { |v| cli[:project_type] = v.downcase.to_sym }
    end
    opt.on(
      '--daemon PATH',
      'Use custom daemon configuration in JSON format',
      'By default: ~/.miga_daemon.json'
    ) { |v| cli[:daemon_json] = v }
    opt.on(
      '-j', '--jobs INT',
      'Number of parallel jobs to execute',
      'By default controlled by the daemon configuration (maxjobs)'
    ) { |v| cli[:jobs] = v.to_i }
    opt.on(
      '-t', '--threads INT',
      'Number of CPUs to use per job',
      'By default controlled by the daemon configuration (ppn)'
    ) { |v| cli[:threads] = v.to_i }
  end

  def opts_for_wf_distances(opt)
    opt.on('--fast', 'Alias to: --aai-p diamond --ani-p fastani') do
      cli[:aai_p] = 'diamond'
      cli[:ani_p] = 'fastani'
    end
    opt.on(
      '--haai-p STRING',
      'hAAI search engine. One of: blast+ (default), blat, diamond, no'
    ) { |v| cli[:haai_p] = v }
    opt.on(
      '--aai-p STRING',
      'AAI search engine. One of: blast+ (default), blat, diamond'
    ) { |v| cli[:aai_p] = v }
    opt.on(
      '--ani-p STRING',
      'ANI search engine. One of: blast+ (default), blat, fastani'
    ) { |v| cli[:ani_p] = v }
  end<commit_msg>New workflows option --sensitive<commit_after># @package MiGA
# @license Artistic-2.0

##
# Helper module for workflows
module MiGA::Cli::Action::Wf
  def default_opts_for_wf
    cli.expect_files = true
    cli.defaults = {
      clean: false, regexp: MiGA::Cli.FILE_REGEXP,
      project_type: :genomes, dataset_type: :popgenome,
      ncbi_draft: true
    }
  end

  def opts_for_wf(opt, files_desc, params = {})
    {
      multi: false, cleanup: true, project_type: false, ncbi: true
    }.each { |k, v| params[k] = v if params[k].nil? }
    opt.on(
      '-o', '--out_dir PATH',
      '(Mandatory) Directory to be created with all output data'
    ) { |v| cli[:outdir] = v }
    opt.separator ''
    opt.separator "    FILES...: #{files_desc}"
    opt.separator ''
    opt.separator 'Workflow Control Options'
    opt.on(
      '-C', '--collection STRING',
      'Collection of essential genes to use as reference',
      'One of: dupont_2012 (default), lee_2019'
    ) { |v| cli[:ess_coll] = v }
    if params[:ncbi]
      opt.on(
        '-T', '--ncbi-taxon STRING',
        'Download all the genomes in NCBI classified as this taxon'
      ) { |v| cli[:ncbi_taxon] = v }
      opt.on(
        '--no-draft',
        'Only download complete genomes, not drafts'
      ) { |v| cli[:ncbi_draft] = v }
    end
    if params[:cleanup]
      opt.on(
        '-c', '--clean',
        'Clean all intermediate files after generating the reports'
      ) { |v| cli[:clean] = v }
    end
    opt.on(
      '-R', '--name-regexp REGEXP', Regexp,
      'Regular expression indicating how to extract the name from the path',
      "By default: '#{cli[:regexp]}'"
    ) { |v| cli[:regexp] = v }
    opt.on(
      '--type STRING',
      "Type of datasets. By default: #{cli[:dataset_type]}",
      'Recognized types:',
      *MiGA::Dataset.KNOWN_TYPES
        .map do |k, v|
          "~ #{k}: #{v[:description]}" unless !params[:multi] && v[:multi]
        end.compact
    ) { |v| cli[:dataset_type] = v.downcase.to_sym }
    if params[:project_type]
      opt.on(
        '--project-type STRING',
        "Type of project. By default: #{cli[:project_type]}",
        'Recognized types:',
        *MiGA::Project.KNOWN_TYPES
          .map do |k, v|
            "~ #{k}: #{v[:description]}" unless !params[:multi] && v[:multi]
          end.compact
      ) { |v| cli[:project_type] = v.downcase.to_sym }
    end
    opt.on(
      '--daemon PATH',
      'Use custom daemon configuration in JSON format',
      'By default: ~/.miga_daemon.json'
    ) { |v| cli[:daemon_json] = v }
    opt.on(
      '-j', '--jobs INT',
      'Number of parallel jobs to execute',
      'By default controlled by the daemon configuration (maxjobs)'
    ) { |v| cli[:jobs] = v.to_i }
    opt.on(
      '-t', '--threads INT',
      'Number of CPUs to use per job',
      'By default controlled by the daemon configuration (ppn)'
    ) { |v| cli[:threads] = v.to_i }
  end

  def opts_for_wf_distances(opt)
    opt.on('--sensitive', 'Alias to: --aai-p blast+ --ani-p blast+') do
      cli[:aai_p] = 'blast+'
      cli[:ani_p] = 'blast+'
    end
    opt.on('--fast', 'Alias to: --aai-p diamond --ani-p fastani') do
      cli[:aai_p] = 'diamond'
      cli[:ani_p] = 'fastani'
    end
    opt.on(
      '--haai-p STRING',
      'hAAI search engine. One of: blast+ (default), blat, diamond, no'
    ) { |v| cli[:haai_p] = v }
    opt.on(
      '--aai-p STRING',
      'AAI search engine. One of: blast+ (default), blat, diamond'
    ) { |v| cli[:aai_p] = v }
    opt.on(
      '--ani-p STRING',
      'ANI search engine. One of: blast+ (default), blat, fastani'
    ) { |v| cli[:ani_p] = v }
  end
{'fraction_non_alphanumeric': 0.164037414491135, 'fraction_numerical': 0.0027921262041044254, 'mean_word_length': 2.295308187672493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6479369', 'n_tokens_mistral': 2657, 'n_tokens_neox': 2539, 'n_words': 687}