class Bio::TMHMM::Report
TMHMM
report parser class.¶ ↑
Attributes
entry_id[R]
Returns
exp_aas_in_tmhs[R]
Returns
exp_first_60aa[R]
Returns
length[R]
Returns
predicted_tmhs[R]
Returns
query_len[R]
Returns
tmhs[R]
Returns an Array of Bio::TMHMM::TMH
.
total_prob_of_N_in[R]
Returns
Public Class Methods
new(entry = nil)
click to toggle source
# File lib/bio/appl/tmhmm/report.rb 85 def initialize(entry = nil) 86 begin 87 str = entry.to_str 88 rescue NoMethodError 89 end 90 if str then 91 entry = str.enum_for(:each_line) 92 end 93 parse_header(entry) 94 @tmhs = parse_tmhs(entry) 95 end
Public Instance Methods
helix()
click to toggle source
Returns an Array of Bio::TMHMM::TMH
including only “TMhelix”.
# File lib/bio/appl/tmhmm/report.rb 98 def helix 99 @tmhs.map {|t| t if t.status == 'TMhelix' }.compact 100 end
to_s()
click to toggle source
# File lib/bio/appl/tmhmm/report.rb 103 def to_s 104 [ 105 [ 106 ["Length:", @query_len], 107 ["Number of predicted TMHs:", @predicted_tmhs], 108 ["Exp number of AAs in THMs:", @exp_aas_in_tmhs], 109 ["Exp number, first 60 AAs:", @exp_first_60aa], 110 ["Total prob of N-in:", @total_prob_of_N_in] 111 ].map {|e| "\# " + [@entry_id, e].flatten.join("\t") }, 112 tmhs.map {|ent| ent.to_s } 113 ].flatten.join("\n") 114 end
Private Instance Methods
parse_header(raw)
click to toggle source
# File lib/bio/appl/tmhmm/report.rb 120 def parse_header(raw) 121 raw.each do |line| 122 next unless /^#/.match(line) 123 124 case line 125 when / (\S.+) Length: +(\d+)/ 126 @entry_id = $1.strip 127 @query_len = $2.to_i 128 when /Number of predicted TMHs: +(\d+)/ 129 @predicted_tmhs = $1.to_i 130 when /Exp number of AAs in TMHs: +([\d\.]+)/ 131 @exp_aas_in_tmhs = $1.to_f 132 when /Exp number, first 60 AAs: +([\d\.]+)/ 133 @exp_first_60aa = $1.to_f 134 when /Total prob of N-in: +([\d\.]+)/ 135 @total_prob_of_N_in = $1.to_f 136 end 137 end 138 end
parse_tmhs(raw)
click to toggle source
# File lib/bio/appl/tmhmm/report.rb 141 def parse_tmhs(raw) 142 tmhs = [] 143 raw.each do |line| 144 case line 145 when /^[^\#]/ 146 eid,version,status,r0,r1 = line.split(/\s+/) 147 tmhs << Bio::TMHMM::TMH.new(eid.strip, 148 version.strip, 149 status.strip, 150 Range.new(r0.to_i, r1.to_i)) 151 end 152 end 153 tmhs 154 end