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, 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
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, 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
parser(output_report) click to toggle source

Returns aBio::PSORT::PSORT1::Report.

# File lib/bio/appl/psort/report.rb, line 31
def self.parser(output_report)
  self.default_parser(output_report)
end