Module: GeneValidator::GVArgValidation

Defined in:
lib/genevalidator/arg_validation.rb

Overview

TODO: If a tabular file is provided, ensure that a tabular file has the

right number of columns

TODO: assert_if_ruby_version_is_supported A module to validate the arguments passed to the Validation Class

Defined Under Namespace

Classes: Blast, Mafft

Class Method Summary collapse

Class Method Details

.add_to_path(bin_dir) ⇒ Object

Checks if dir is in $PATH and if not, it adds the dir to the $PATH.



213
214
215
216
# File 'lib/genevalidator/arg_validation.rb', line 213

def add_to_path(bin_dir)
  return if ENV['PATH'].split(':').include?(bin_dir)
  ENV['PATH'] = "#{bin_dir}:#{ENV['PATH']}"
end

.command?(command) ⇒ Boolean

Return true if the given command exists and is executable.

Returns:

  • (Boolean)


219
220
221
# File 'lib/genevalidator/arg_validation.rb', line 219

def command?(command)
  system("which #{command} > /dev/null 2>&1")
end

.validate_args(opt) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/genevalidator/arg_validation.rb', line 10

def validate_args(opt)
  @opt = opt
  assert_output_dir_does_not_exist
  assert_file_present('input file', opt[:input_fasta_file])
  assert_input_file_probably_fasta
  assert_input_contains_single_type_sequence
  assert_BLAST_output_files

  assert_validations_arg
  check_num_threads

  Blast.validate(opt) unless @opt[:test]
  Mafft.assert_mafft_installation(opt)
  @opt
end