Class: Neurohmmer::Hmmer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/neurohmmer/hmmer.rb

Overview

A class that holds methods related to Hmmer

Class Method Summary collapse

Class Method Details

.analyse_outputObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/neurohmmer/hmmer.rb', line 20

def analyse_output
  hmm_results       = {}
  hmm_search_output = File.open(conf[:hmm_output])
  hmm_reports       = Bio::HMMER::HMMER3.reports(hmm_search_output)
  hmm_reports.each_with_index do |report, idx|
    next if idx + 1 == hmm_reports.length
    hmm_results[report.query] = analyse_hmm_search_report(report)
  end
  hmm_results
end

.generate_hmm_modelsObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/neurohmmer/hmmer.rb', line 31

def generate_hmm_models
  Dir.foreach(conf[:raw_data]) do |file|
    next if file !~ /fa(sta)?$/
    np_fasta_file  = File.join(conf[:raw_data], file)
    aligned_file   = File.join(conf[:raw_alignments],
                               "#{file.gsub(/fa(sta)?$/, '')}.aligned")
    hmm_model_file = File.join(conf[:hmm_dir],
                               "#{file.gsub(/fa(sta)?$/, '')}.hmm")
    mafft(np_fasta_file, aligned_file, conf[:num_threads])
    hmm_build(aligned_file, hmm_model_file)
  end
end

.searchObject



12
13
14
15
16
17
18
# File 'lib/neurohmmer/hmmer.rb', line 12

def search
  Dir.foreach(conf[:hmm_dir]) do |h|
    hmm_file = File.join(conf[:hmm_dir], h)
    next if hmm_file !~ /hmm$/
    hmm_search(opt[:input_file], hmm_file, conf[:hmm_output])
  end
end