def run_all_assemblers options
      res = {}

      subset = false
      unless options[:assemblers] == 'all'
        subset = options[:assemblers].split(',')
        missing = []
        subset.each do |choice|
          missing < choice unless @assemblers.any do |a|
            a.name == choice || a.shortname == choice
          end
        end
        unless missing.empty?
          log.error "The specified assemblers (#{missing.join(', ')}) were not valid choices"
          log.error "Please choose from the options in --list-assembler"
          exit(1)
        end
      end

      unless options[:skip_final]
        if (File.exist? 'final_assemblies')
          logger.warn("Directory final_assemblies already exists. Some results may be overwritten.")
        end
        FileUtils.mkdir_p('final_assemblies')
        final_dir = File.expand_path 'final_assemblies'
      end

      results_filepath = Time.now.to_s.gsub(/ /, '_') + '.json'

      @assemblers.each do |assembler|
        logger.info "Starting optimisation for #{assembler.name}"

        this_res = run_assembler assembler
        logger.info "Optimisation of #{assembler.name} finished"

        # run the final assembly
        unless options[:skip_final]

          this_final_dir = File.join(final_dir, assembler.name.downcase)
          Dir.chdir this_final_dir do
            logger.info "Running full assembly for #{assembler.name}" +
                        " with optimal parameters"
            # use the full read set
            this_res[:left] = options[:left]
            this_res[:right] = options[:right]
            this_res[:threads] = options[:threads]
            final = final_assembly assembler, res
            this_res[:final] = final
          end

          res[assembler.name] = this_res

        end

        File.open(results_filepath, 'w') do |out|
          out.write JSON.pretty_generate(res)
        end
        logger.info "Result file updated: #{results_filepath}"

      end

      logger.info "All assemblers optimised"
      res
    end
def run_all_assemblers options
      res = {}

      subset = false
      unless options[:assemblers] == 'all'
        subset = options[:assemblers].split(',')
        missing = []
        subset.each do |choice|
          missing < choice unless @assemblers.any do |a|
            a.name == choice || a.shortname == choice
          end
        end
        unless missing.empty?
          log.error "The specified assemblers (#{missing.join(', ')}) were not valid choices"
          log.error "Please choose from the options in --list-assembler"
          exit(1)
        end
      end

      unless options[:skip_final]
        if (File.exist? 'final_assemblies')
          logger.warn("Directory final_assemblies already exists. Some results may be overwritten.")
        end
        FileUtils.mkdir_p('final_assemblies')
        final_dir = File.expand_path 'final_assemblies'
      end

      results_filepath = Time.now.to_s.gsub(/ /, '_') + '.json'

      @assemblers.each do |assembler|
        logger.info "Starting optimisation for #{assembler.name}"

        this_res = run_assembler assembler
        logger.info "Optimisation of #{assembler.name} finished"

        # run the final assembly
        unless options[:skip_final]

          this_final_dir = File.join(final_dir, assembler.name.downcase)
          Dir.chdir this_final_dir do
            logger.info "Running full assembly for #{assembler.name}" +
                        " with optimal parameters"
            # use the full read set
            this_res[:left] = options[:left]
            this_res[:right] = options[:right]
            this_res[:threads] = options[:threads]
            final = final_assembly assembler, res
            this_res[:final] = final
          end

          res[assembler.name] = this_res

        end

        File.open(results_filepath, 'w') do |out|
          out.write JSON.pretty_generate(res)
        end
        logger.info "Result file updated: #{results_filepath}"

      end

      logger.info "All assemblers optimised"
      res
    end
Run optimisation and final assembly for each assembler