class Bio::PSORT::PSORT1::Report
Bio::PSORT::PSORT1::Report
¶ ↑
Parser class for PSORT1
output report.
Example¶ ↑
Attributes
entry_id[RW]
final_result[RW]
origin[RW]
raw[RW]
reasoning[RW]
result_info[RW]
sequence[RW]
title[RW]
Public Class Methods
default_parser(output_report)
click to toggle source
Returns aBio::PSORT::PSORT1::Report.
# File lib/bio/appl/psort/report.rb 36 def self.default_parser(output_report) 37 rpt = self.new 38 rpt.raw = output_report 39 query_info = output_report.scan(/^Query Information\n\n(.+?)\n\n/m)[0][0].split(/\n/) 40 result_info = output_report.scan(/^Result Information\n\n(.+?)\n\n\*/m)[0][0] 41 step1 = output_report.scan(/^\*\*\* Reasoning Step: 1\n\n(.+?)\n\n/m)[0][0] 42 step2 = output_report.scan(/^\*\*\* Reasoning Step: 2\n\n(.+?)\n\n/m)[0][0] 43 final_result = output_report.scan(/\n\n----- Final Results -----\n\n(.+?)\n\n\n/m)[0][0] 44 45 rpt.entry_id = query_info[2].scan(/^>(\S+) */).to_s 46 rpt.origin = query_info[0].scan(/ORIGIN (\w+)/).to_s 47 rpt.sequence = Bio::Sequence::AA.new(query_info[3..query_info.size].to_s) 48 # rpt.reasoning 49 50 rpt.final_result = final_result.split(/\n/).map {|x| 51 x = x.strip.split(/---/).map {|y| y.strip } 52 { 'prediction' => x[0], 53 'certainty' => x[1].scan(/Certainty= (\d\.\d{3})/).to_s, 54 'comment' => x[1].scan(/\((\w+)\)/).to_s 55 } 56 } 57 return rpt 58 end
new(entry_id = '', origin = '', title = '', sequence = '', result_info = '', reasoning = {}, final_result = [])
click to toggle source
Constructs aBio::PSORT::PSORT1::Report object.
# File lib/bio/appl/psort/report.rb 72 def initialize(entry_id = '', origin = '', title = '', sequence = '', 73 result_info = '', reasoning = {}, final_result = []) 74 @entry_id = entry_id 75 @origin = origin 76 @title = title 77 @sequence = sequence 78 @result_info = result_info 79 @reasoning = reasoning 80 @final_result = final_result 81 @raw = '' 82 end
parser(output_report)
click to toggle source
Returns aBio::PSORT::PSORT1::Report.
# File lib/bio/appl/psort/report.rb 31 def self.parser(output_report) 32 self.default_parser(output_report) 33 end