| Class | Bio::Genscan::Report |
| In: |
lib/bio/appl/genscan/report.rb
|
| Parent: | Object |
Parser for the Genscan report output.
| query_name | -> | sequence_name |
| query_name | -> | name |
| predictions | -> | prediction |
| predictions | -> | genes |
| date_run | [R] | Returns |
| gccontent | [R] | Returns C+G content of the query sequence. |
| genscan_version | [R] | Returns Genscan version. |
| isochore | [R] | Returns |
| length | [R] | Returns Length of the query sequence. |
| matrix | [R] | Returns |
| predictions | [R] | Returns Array of Bio::Genscan::Report::Gene. |
| query_name | [R] | Returns Name of query sequence. |
| time | [R] | Returns |
Parse a Genscan report output string.
# File lib/bio/appl/genscan/report.rb, line 67
67: def initialize(report)
68: @predictions = []
69: @genscan_version = nil
70: @date_run = nil
71: @time = nil
72: @query_name = nil
73: @length = nil
74: @gccontent = nil
75: @isochore = nil
76: @matrix = nil
77:
78: report.each_line("\n") do |line|
79: case line
80: when /^GENSCAN/
81: parse_headline(line)
82: when /^Sequence/
83: parse_sequence(line)
84: when /^Parameter/
85: parse_parameter(line)
86: when /^Predicted genes/
87: break
88: end
89: end
90:
91: # rests
92: i = report.index(/^Predicted gene/)
93: j = report.index(/^Predicted peptide sequence/)
94:
95: # genes/exons
96: genes_region = report[i...j]
97: genes_region.each_line("\n") do |line|
98: if /Init|Intr|Term|PlyA|Prom|Sngl/ =~ line
99: gn, en = line.strip.split(" +")[0].split(/\./).map {|i| i.to_i }
100: add_exon(gn, en, line)
101: end
102: end
103:
104: # sequences (peptide|CDS)
105: sequence_region = report[j...report.size]
106: sequence_region.gsub!(/^Predicted .+?:/, '')
107: sequence_region.gsub!(/^\s*$/, '')
108: sequence_region.split(Bio::FastaFormat::RS).each do |ff|
109: add_seq(Bio::FastaFormat.new(ff))
110: end
111: end