Class: Bio::PSORT::PSORT1::Report
- Defined in:
- lib/bio/appl/psort/report.rb
Overview
Bio::PSORT::PSORT1::Report
Parser class for PSORT1 output report.
Example
Instance Attribute Summary collapse
-
#entry_id ⇒ Object
Returns the value of attribute entry_id.
-
#final_result ⇒ Object
Returns the value of attribute final_result.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#reasoning ⇒ Object
Returns the value of attribute reasoning.
-
#result_info ⇒ Object
Returns the value of attribute result_info.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.default_parser(output_report) ⇒ Object
Returns aBio::PSORT::PSORT1::Report.
-
.parser(output_report) ⇒ Object
Returns aBio::PSORT::PSORT1::Report.
Instance Method Summary collapse
-
#initialize(entry_id = '', origin = '', title = '', sequence = '', result_info = '', reasoning = {}, final_result = []) ⇒ Report
constructor
Constructs aBio::PSORT::PSORT1::Report object.
Constructor Details
#initialize(entry_id = '', origin = '', title = '', sequence = '', result_info = '', reasoning = {}, final_result = []) ⇒ Report
Constructs aBio::PSORT::PSORT1::Report object.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/bio/appl/psort/report.rb', line 72 def initialize(entry_id = '', origin = '', title = '', sequence = '', result_info = '', reasoning = {}, final_result = []) @entry_id = entry_id @origin = origin @title = title @sequence = sequence @result_info = result_info @reasoning = reasoning @final_result = final_result @raw = '' end |
Instance Attribute Details
#entry_id ⇒ Object
Returns the value of attribute entry_id.
60 61 62 |
# File 'lib/bio/appl/psort/report.rb', line 60 def entry_id @entry_id end |
#final_result ⇒ Object
Returns the value of attribute final_result.
66 67 68 |
# File 'lib/bio/appl/psort/report.rb', line 66 def final_result @final_result end |
#origin ⇒ Object
Returns the value of attribute origin.
61 62 63 |
# File 'lib/bio/appl/psort/report.rb', line 61 def origin @origin end |
#raw ⇒ Object
Returns the value of attribute raw.
67 68 69 |
# File 'lib/bio/appl/psort/report.rb', line 67 def raw @raw end |
#reasoning ⇒ Object
Returns the value of attribute reasoning.
65 66 67 |
# File 'lib/bio/appl/psort/report.rb', line 65 def reasoning @reasoning end |
#result_info ⇒ Object
Returns the value of attribute result_info.
64 65 66 |
# File 'lib/bio/appl/psort/report.rb', line 64 def result_info @result_info end |
#sequence ⇒ Object
Returns the value of attribute sequence.
63 64 65 |
# File 'lib/bio/appl/psort/report.rb', line 63 def sequence @sequence end |
#title ⇒ Object
Returns the value of attribute title.
62 63 64 |
# File 'lib/bio/appl/psort/report.rb', line 62 def title @title end |
Class Method Details
.default_parser(output_report) ⇒ Object
Returns aBio::PSORT::PSORT1::Report.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bio/appl/psort/report.rb', line 36 def self.default_parser(output_report) rpt = self.new rpt.raw = output_report query_info = output_report.scan(/^Query Information\n\n(.+?)\n\n/m)[0][0].split(/\n/) result_info = output_report.scan(/^Result Information\n\n(.+?)\n\n\*/m)[0][0] step1 = output_report.scan(/^\*\*\* Reasoning Step: 1\n\n(.+?)\n\n/m)[0][0] step2 = output_report.scan(/^\*\*\* Reasoning Step: 2\n\n(.+?)\n\n/m)[0][0] final_result = output_report.scan(/\n\n----- Final Results -----\n\n(.+?)\n\n\n/m)[0][0] rpt.entry_id = query_info[2].scan(/^>(\S+) */).to_s rpt.origin = query_info[0].scan(/ORIGIN (\w+)/).to_s rpt.sequence = Bio::Sequence::AA.new(query_info[3..query_info.size].to_s) # rpt.reasoning rpt.final_result = final_result.split(/\n/).map {|x| x = x.strip.split(/---/).map {|y| y.strip } { 'prediction' => x[0], 'certainty' => x[1].scan(/Certainty= (\d\.\d{3})/).to_s, 'comment' => x[1].scan(/\((\w+)\)/).to_s } } return rpt end |
.parser(output_report) ⇒ Object
Returns aBio::PSORT::PSORT1::Report.
31 32 33 |
# File 'lib/bio/appl/psort/report.rb', line 31 def self.parser(output_report) self.default_parser(output_report) end |