class Bio::TMHMM

TMHMM class for www.cbs.dtu.dk/services/TMHMM/

Public Class Methods

reports(data) { |report| ... } click to toggle source

Splits multiple reports into a report entry.

   # File lib/bio/appl/tmhmm/report.rb
25 def TMHMM.reports(data)
26   entry     = []
27   ent_state = ''
28   data.each_line do |line|
29     if /^\#/ =~ line
30       if ent_state == 'next'
31         ent_state = 'entry'
32       elsif ent_state == 'tmh'
33         ent_state = 'next'
34       end
35     else
36       ent_state = 'tmh'
37     end
38 
39     if ent_state != 'next'
40       entry << line
41     else
42       if block_given?
43         yield Bio::TMHMM::Report.new(entry)
44       else
45         Bio::TMHMM::Report.new(entry)
46       end
47       entry = [line]
48     end
49   end
50 
51   if block_given?
52     yield Bio::TMHMM::Report.new(entry)
53   else
54     Bio::TMHMM::Report.new(entry)
55   end
56 end