class Bio::TMHMM::TmHmmWrapper

Public Instance Methods

calculate(sequence) click to toggle source

Given an amino acid sequence, return a TransmembraneProtein made up of the predicted transmembrane domains

# File lib/bio/appl/tmhmm/tmhmm_runner.rb, line 8
def calculate(sequence)
  Bio::Command.mktmpdir do |d|
    line = nil
    Bio::Command.call_command(['tmhmm','-short'], :chdir => d) do |io|
      io.puts '>wrapperSeq'
      io.puts sequence
      io.close_write
      line = io.readline
    end
    
    if line.nil?
      raise Exception, "Error running locally installed TMHMM program 'tmhmm'. Is it properly installed?"
    end
    
    return TmHmmResult.create_from_short_line(line)
  end
end