class GeneValidator::GVArgValidation::Blast

Validates BLAST Installation (And BLAST databases)

Constants

EXIT_BLAST_NOT_COMPATIBLE
EXIT_BLAST_NOT_INSTALLED

Use the following exit codes, or 1.

EXIT_NO_BLAST_DATABASE
MINIMUM_BLAST_VERSION

Use a fixed minimum version of BLAST+

Public Class Methods

assert_blast_installation() click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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

Private Class Methods

assert_blast_compatible() click to toggle source
# File lib/genevalidator/arg_validation.rb, line 167
def assert_blast_compatible
  version = `blastdbcmd -version`.split[1]
  return if version >= MINIMUM_BLAST_VERSION
  warn "*** Your BLAST+ version #{version} is outdated."
  warn '    GeneValidator needs NCBI BLAST+ version' \
               " #{MINIMUM_BLAST_VERSION} or higher."
  exit EXIT_BLAST_NOT_COMPATIBLE
end
assert_blast_installed() click to toggle source
# File lib/genevalidator/arg_validation.rb, line 161
def assert_blast_installed
  return if GVArgValidation.command?('blastdbcmd')
  warn '*** Could not find BLAST+ binaries.'
  exit EXIT_BLAST_NOT_INSTALLED
end