Class: Bio::TMHMM::TmHmmResult

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#domainsObject (readonly)

Returns the value of attribute domains.



28
29
30
# File 'lib/bio/appl/tmhmm/tmhmm_runner.rb', line 28

def domains
  @domains
end

Class Method Details

.create_from_short_line(line) ⇒ Object

initialise with the output line of a eg. PFF0290w len=293 ExpAA=145.77 First60=20.51 PredHel=7 Topology=o39-61i101-120o140-162i169-186o196-218i230-252o262-284i



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bio/appl/tmhmm/tmhmm_runner.rb', line 33

def self.create_from_short_line(line)
  protein = Bio::Transmembrane::OrientedTransmembraneDomainProtein.new
  
  splits = line.strip.split("\t")
  if splits.length != 6
    raise Exception, "Incorrectly parsed short line from TMHMM: #{line}"
  end
  
  substrate = splits[5]
  if substrate.gsub!(/^Topology\=[io]/,'').nil?
    raise Exception, "Badly parsed Topology hit: #{substrate}"
  end
  
  matches = substrate.match('^(\d+?)\-')
  if !matches
    return protein #no transmembrane domains predicted
  end
  
  # eat the string from the beginning adding the transmembrane domains
  prev = matches[1]
  substrate.gsub!(/^(\d+?)-/,'')
  # match all the middle bits
  reg = /^(\d+?)([io])(\d+?)\-/
  while matches =substrate.match(reg)
    tmd = Bio::Transmembrane::OrientedTransmembraneDomain.new
    tmd.start = prev.to_i
    tmd.stop = matches[1].to_i
    tmd.orientation = parse_orientation_from_last_location(matches[2])
    protein.push tmd
    
    prev = matches[3]
    substrate.gsub!(reg, '')
  end
  #match the last bit
  if !(matches = substrate.match('(\d+?)([io])$'))
    raise Exception, "Failed to parse the last bit of: #{substrate}"
  end
  tmd = Bio::Transmembrane::OrientedTransmembraneDomain.new
  tmd.start = prev.to_i
  tmd.stop = matches[1].to_i
  tmd.orientation = parse_orientation_from_last_location(matches[2])
  protein.push tmd
  
  return protein
end

.parse_orientation_from_last_location(last_location) ⇒ Object



79
80
81
82
83
84
85
86
87
88
# File 'lib/bio/appl/tmhmm/tmhmm_runner.rb', line 79

def self.parse_orientation_from_last_location(last_location)
  case last_location
    when 'i'  
    return Bio::Transmembrane::OrientedTransmembraneDomain::OUTSIDE_IN
    when 'o'
    return Bio::Transmembrane::OrientedTransmembraneDomain::INSIDE_OUT
  else
    raise Exception, "Badly parsed topology hit due to orientation character: #{substrate}"
  end
end