Class: Bio::Genscan::Report

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

Overview

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

Parser for the Genscan report output.

Defined Under Namespace

Classes: Exon, Gene

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ Report

Bio::Genscan::Report.new(str)

Parse a Genscan report output string.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# 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

Instance Attribute Details

#date_runObject (readonly)

Returns



35
36
37
# File 'lib/bio/appl/genscan/report.rb', line 35

def date_run
  @date_run
end

#gccontentObject (readonly)

Returns C+G content of the query sequence.



49
50
51
# File 'lib/bio/appl/genscan/report.rb', line 49

def gccontent
  @gccontent
end

#genscan_versionObject (readonly)

Returns Genscan version.



32
33
34
# File 'lib/bio/appl/genscan/report.rb', line 32

def genscan_version
  @genscan_version
end

#isochoreObject (readonly)

Returns



52
53
54
# File 'lib/bio/appl/genscan/report.rb', line 52

def isochore
  @isochore
end

#lengthObject (readonly)

Returns Length of the query sequence.



46
47
48
# File 'lib/bio/appl/genscan/report.rb', line 46

def length
  @length
end

#matrixObject (readonly)

Returns



55
56
57
# File 'lib/bio/appl/genscan/report.rb', line 55

def matrix
  @matrix
end

#predictionsObject (readonly) Also known as: prediction, genes

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



58
59
60
# File 'lib/bio/appl/genscan/report.rb', line 58

def predictions
  @predictions
end

#query_nameObject (readonly) Also known as: sequence_name, name

Returns Name of query sequence.



41
42
43
# File 'lib/bio/appl/genscan/report.rb', line 41

def query_name
  @query_name
end

#timeObject (readonly)

Returns



38
39
40
# File 'lib/bio/appl/genscan/report.rb', line 38

def time
  @time
end