class Bio::Genscan::Report

Bio::Genscan::Report - Class for Genscan report output.

Parser for the Genscan report output.

Attributes

date_run[R]

Returns

gccontent[R]

Returns C+G content of the query sequence.

genes[R]

Returns Array of Bio::Genscan::Report::Gene.

genscan_version[R]

Returns Genscan version.

isochore[R]

Returns

length[R]

Returns Length of the query sequence.

matrix[R]

Returns

name[R]

Returns Name of query sequence.

prediction[R]

Returns Array of Bio::Genscan::Report::Gene.

predictions[R]

Returns Array of Bio::Genscan::Report::Gene.

query_name[R]

Returns Name of query sequence.

sequence_name[R]

Returns Name of query sequence.

time[R]

Returns

Public Class Methods

new(report) click to toggle source

::new

Parse a Genscan report output string.

# File lib/bio/appl/genscan/report.rb, line 66
def initialize(report)
  @predictions = []
  @genscan_version = nil
  @date_run   = nil
  @time       = nil
  @query_name = nil
  @length     = nil
  @gccontent  = nil
  @isochore   = nil
  @matrix     = nil

  report.each_line("\n") do |line|
    case line
    when /^GENSCAN/
      parse_headline(line)
    when /^Sequence/
      parse_sequence(line)
    when /^Parameter/
      parse_parameter(line)
    when /^Predicted genes/
      break
    end
  end

  # rests
  i = report.index(/^Predicted gene/)
  j = report.index(/^Predicted peptide sequence/)

  # genes/exons
  genes_region = report[i...j]
  genes_region.each_line("\n") do |line|
    if /Init|Intr|Term|PlyA|Prom|Sngl/ =~ line
      gn, en = line.strip.split(" +")[0].split(/\./).map {|ii| ii.to_i }
      add_exon(gn, en, line)
    end
  end

  # sequences (peptide|CDS)
  sequence_region = report[j...report.size]
  sequence_region.gsub!(/^Predicted .+?:/, '')
  sequence_region.gsub!(/^\s*$/, '')
  sequence_region.split(Bio::FastaFormat::RS).each do |ff|
    add_seq(Bio::FastaFormat.new(ff))
  end
end