Class: GeneValidator::GVArgValidation::Blast

Inherits:
Object
  • Object
show all
Defined in:
lib/genevalidator/arg_validation.rb

Overview

Validates BLAST Installation (And BLAST databases)

Constant Summary collapse

MINIMUM_BLAST_VERSION =

Use a fixed minimum version of BLAST+

'2.2.30+'.freeze
EXIT_BLAST_NOT_INSTALLED =

Use the following exit codes, or 1.

2
EXIT_BLAST_NOT_COMPATIBLE =
3
EXIT_NO_BLAST_DATABASE =
4

Class Method Summary collapse

Class Method Details

.assert_blast_installationObject



145
146
147
148
149
# File 'lib/genevalidator/arg_validation.rb', line 145

def assert_blast_installation
  # Validate BLAST installation
  assert_blast_installed
  assert_blast_compatible
end

.assert_local_blast_database_exists(db) ⇒ Object



151
152
153
154
155
156
157
# File 'lib/genevalidator/arg_validation.rb', line 151

def assert_local_blast_database_exists(db)
  return if system("blastdbcmd -db #{db} -info > /dev/null 2>&1")
  warn '*** No BLAST database found at the provided path.'
  warn '    Please ensure that the provided path is correct' \
               ' and then try again.'
  exit EXIT_NO_BLAST_DATABASE
end

.validate(opt) ⇒ Object



140
141
142
143
# File 'lib/genevalidator/arg_validation.rb', line 140

def validate(opt)
  assert_blast_installation
  assert_local_blast_database_exists(opt[:db]) if opt[:db] !~ /remote/
end