Class: Bio::TMHMM::TmHmmWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/appl/tmhmm/tmhmm_runner.rb

Instance Method Summary collapse

Instance Method Details

#calculate(sequence) ⇒ Object

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



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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