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, line 25
def TMHMM.reports(data)
  entry     = []
  ent_state = ''
  data.each_line do |line|
    if /^\#/ =~ line
      if ent_state == 'next'
        ent_state = 'entry'
      elsif ent_state == 'tmh'
        ent_state = 'next'
      end
    else
      ent_state = 'tmh'
    end

    if ent_state != 'next'
      entry << line
    else
      if block_given?
        yield Bio::TMHMM::Report.new(entry)
      else
        Bio::TMHMM::Report.new(entry)
      end
      entry = [line]
    end
  end

  if block_given?
    yield Bio::TMHMM::Report.new(entry)
  else
    Bio::TMHMM::Report.new(entry)
  end
end