Class: Neurohmmer::Output

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

Overview

A class that holds methods related to Output

Class Method Summary collapse

Class Method Details

.format_seqs_for_html(hmm_results) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/neurohmmer/output.rb', line 23

def format_seqs_for_html(hmm_results)
  results = {}
  hmm_results.each do |query, hits|
    next if hits.length == 0
    results[query] = []
    hits.each do |hit|
      html_seq = format_html_seq(hit[:seq], hit[:flatseq])
      results[query] << { id: hit[:id], seq: html_seq }
    end
  end
  results
end

.to_html(hmm_results) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/neurohmmer/output.rb', line 14

def to_html(hmm_results)
  @html_results = format_seqs_for_html(hmm_results)
  template_path = File.expand_path('../../../template/contents.slim',
                                   __FILE__)
  contents_temp = File.read(template_path)
  html_content = Slim::Template.new { contents_temp }.render(self)
  File.open(conf[:html_output], 'w') { |f| f.puts html_content }
end