Class: Bio::TMHMM::Report

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

Overview

TMHMM report parser class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry = nil) ⇒ Report

Returns a new instance of Report



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/bio/appl/tmhmm/report.rb', line 85

def initialize(entry = nil)
  begin
    str = entry.to_str
  rescue NoMethodError
  end
  if str then
    entry = str.enum_for(:each_line)
  end
  parse_header(entry)
  @tmhs = parse_tmhs(entry)
end

Instance Attribute Details

#entry_idObject (readonly)

Returns



65
66
67
# File 'lib/bio/appl/tmhmm/report.rb', line 65

def entry_id
  @entry_id
end

#exp_aas_in_tmhsObject (readonly)

Returns



74
75
76
# File 'lib/bio/appl/tmhmm/report.rb', line 74

def exp_aas_in_tmhs
  @exp_aas_in_tmhs
end

#exp_first_60aaObject (readonly)

Returns



77
78
79
# File 'lib/bio/appl/tmhmm/report.rb', line 77

def exp_first_60aa
  @exp_first_60aa
end

#predicted_tmhsObject (readonly)

Returns



71
72
73
# File 'lib/bio/appl/tmhmm/report.rb', line 71

def predicted_tmhs
  @predicted_tmhs
end

#query_lenObject (readonly) Also known as: length

Returns



68
69
70
# File 'lib/bio/appl/tmhmm/report.rb', line 68

def query_len
  @query_len
end

#tmhsObject (readonly)

Returns an Array of Bio::TMHMM::TMH.



62
63
64
# File 'lib/bio/appl/tmhmm/report.rb', line 62

def tmhs
  @tmhs
end

#total_prob_of_N_inObject (readonly)

Returns



80
81
82
# File 'lib/bio/appl/tmhmm/report.rb', line 80

def total_prob_of_N_in
  @total_prob_of_N_in
end

Instance Method Details

#helixObject

Returns an Array of Bio::TMHMM::TMH including only “TMhelix”.



98
99
100
# File 'lib/bio/appl/tmhmm/report.rb', line 98

def helix
  @tmhs.map {|t| t if t.status == 'TMhelix' }.compact
end

#to_sObject



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/bio/appl/tmhmm/report.rb', line 103

def to_s
  [
    [
      ["Length:",                    @query_len],
      ["Number of predicted TMHs:",  @predicted_tmhs],
      ["Exp number of AAs in THMs:", @exp_aas_in_tmhs],
      ["Exp number, first 60 AAs:",  @exp_first_60aa],
      ["Total prob of N-in:",        @total_prob_of_N_in]
    ].map {|e| "\# " + [@entry_id, e].flatten.join("\t") },
    tmhs.map {|ent| ent.to_s }
  ].flatten.join("\n")
end