bio 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. data/bin/bioruby +107 -0
  2. data/bin/br_biofetch.rb +59 -0
  3. data/bin/br_bioflat.rb +294 -0
  4. data/bin/br_biogetseq.rb +57 -0
  5. data/bin/br_pmfetch.rb +431 -0
  6. data/doc/BioRuby.rd.ja +225 -0
  7. data/doc/Changes-0.7.rd +236 -0
  8. data/doc/Design.rd.ja +341 -0
  9. data/doc/KEGG_API.rd +1437 -0
  10. data/doc/KEGG_API.rd.ja +1399 -0
  11. data/doc/TODO.rd.ja +138 -0
  12. data/doc/Tutorial.rd +1138 -0
  13. data/doc/Tutorial.rd.ja +2110 -0
  14. data/etc/bioinformatics/seqdatabase.ini +210 -0
  15. data/lib/bio.rb +256 -0
  16. data/lib/bio/alignment.rb +1906 -0
  17. data/lib/bio/appl/bl2seq/report.rb +350 -0
  18. data/lib/bio/appl/blast.rb +269 -0
  19. data/lib/bio/appl/blast/format0.rb +1402 -0
  20. data/lib/bio/appl/blast/format8.rb +95 -0
  21. data/lib/bio/appl/blast/report.rb +652 -0
  22. data/lib/bio/appl/blast/rexml.rb +151 -0
  23. data/lib/bio/appl/blast/wublast.rb +553 -0
  24. data/lib/bio/appl/blast/xmlparser.rb +222 -0
  25. data/lib/bio/appl/blat/report.rb +392 -0
  26. data/lib/bio/appl/clustalw.rb +191 -0
  27. data/lib/bio/appl/clustalw/report.rb +154 -0
  28. data/lib/bio/appl/emboss.rb +68 -0
  29. data/lib/bio/appl/fasta.rb +262 -0
  30. data/lib/bio/appl/fasta/format10.rb +428 -0
  31. data/lib/bio/appl/fasta/format6.rb +37 -0
  32. data/lib/bio/appl/genscan/report.rb +570 -0
  33. data/lib/bio/appl/hmmer.rb +129 -0
  34. data/lib/bio/appl/hmmer/report.rb +556 -0
  35. data/lib/bio/appl/mafft.rb +222 -0
  36. data/lib/bio/appl/mafft/report.rb +119 -0
  37. data/lib/bio/appl/psort.rb +555 -0
  38. data/lib/bio/appl/psort/report.rb +473 -0
  39. data/lib/bio/appl/sim4.rb +134 -0
  40. data/lib/bio/appl/sim4/report.rb +501 -0
  41. data/lib/bio/appl/sosui/report.rb +166 -0
  42. data/lib/bio/appl/spidey/report.rb +604 -0
  43. data/lib/bio/appl/targetp/report.rb +283 -0
  44. data/lib/bio/appl/tmhmm/report.rb +238 -0
  45. data/lib/bio/command.rb +166 -0
  46. data/lib/bio/data/aa.rb +354 -0
  47. data/lib/bio/data/codontable.rb +740 -0
  48. data/lib/bio/data/na.rb +226 -0
  49. data/lib/bio/db.rb +340 -0
  50. data/lib/bio/db/aaindex.rb +280 -0
  51. data/lib/bio/db/embl/common.rb +332 -0
  52. data/lib/bio/db/embl/embl.rb +446 -0
  53. data/lib/bio/db/embl/sptr.rb +954 -0
  54. data/lib/bio/db/embl/swissprot.rb +32 -0
  55. data/lib/bio/db/embl/trembl.rb +31 -0
  56. data/lib/bio/db/embl/uniprot.rb +32 -0
  57. data/lib/bio/db/fantom.rb +604 -0
  58. data/lib/bio/db/fasta.rb +869 -0
  59. data/lib/bio/db/genbank/common.rb +299 -0
  60. data/lib/bio/db/genbank/ddbj.rb +34 -0
  61. data/lib/bio/db/genbank/genbank.rb +354 -0
  62. data/lib/bio/db/genbank/genpept.rb +73 -0
  63. data/lib/bio/db/genbank/refseq.rb +31 -0
  64. data/lib/bio/db/gff.rb +106 -0
  65. data/lib/bio/db/go.rb +497 -0
  66. data/lib/bio/db/kegg/brite.rb +51 -0
  67. data/lib/bio/db/kegg/cell.rb +88 -0
  68. data/lib/bio/db/kegg/compound.rb +130 -0
  69. data/lib/bio/db/kegg/enzyme.rb +125 -0
  70. data/lib/bio/db/kegg/expression.rb +173 -0
  71. data/lib/bio/db/kegg/genes.rb +293 -0
  72. data/lib/bio/db/kegg/genome.rb +362 -0
  73. data/lib/bio/db/kegg/glycan.rb +213 -0
  74. data/lib/bio/db/kegg/keggtab.rb +418 -0
  75. data/lib/bio/db/kegg/kgml.rb +299 -0
  76. data/lib/bio/db/kegg/ko.rb +178 -0
  77. data/lib/bio/db/kegg/reaction.rb +97 -0
  78. data/lib/bio/db/litdb.rb +131 -0
  79. data/lib/bio/db/medline.rb +317 -0
  80. data/lib/bio/db/nbrf.rb +199 -0
  81. data/lib/bio/db/pdb.rb +38 -0
  82. data/lib/bio/db/pdb/atom.rb +60 -0
  83. data/lib/bio/db/pdb/chain.rb +117 -0
  84. data/lib/bio/db/pdb/model.rb +106 -0
  85. data/lib/bio/db/pdb/pdb.rb +1682 -0
  86. data/lib/bio/db/pdb/residue.rb +122 -0
  87. data/lib/bio/db/pdb/utils.rb +234 -0
  88. data/lib/bio/db/prosite.rb +616 -0
  89. data/lib/bio/db/rebase.rb +417 -0
  90. data/lib/bio/db/transfac.rb +387 -0
  91. data/lib/bio/feature.rb +201 -0
  92. data/lib/bio/io/brdb.rb +103 -0
  93. data/lib/bio/io/das.rb +471 -0
  94. data/lib/bio/io/dbget.rb +212 -0
  95. data/lib/bio/io/ddbjxml.rb +614 -0
  96. data/lib/bio/io/fastacmd.rb +123 -0
  97. data/lib/bio/io/fetch.rb +114 -0
  98. data/lib/bio/io/flatfile.rb +496 -0
  99. data/lib/bio/io/flatfile/bdb.rb +266 -0
  100. data/lib/bio/io/flatfile/index.rb +1308 -0
  101. data/lib/bio/io/flatfile/indexer.rb +778 -0
  102. data/lib/bio/io/higet.rb +92 -0
  103. data/lib/bio/io/keggapi.rb +863 -0
  104. data/lib/bio/io/pubmed.rb +189 -0
  105. data/lib/bio/io/registry.rb +308 -0
  106. data/lib/bio/io/soapwsdl.rb +114 -0
  107. data/lib/bio/io/sql.rb +428 -0
  108. data/lib/bio/location.rb +650 -0
  109. data/lib/bio/pathway.rb +991 -0
  110. data/lib/bio/reference.rb +308 -0
  111. data/lib/bio/sequence.rb +593 -0
  112. data/lib/bio/shell.rb +51 -0
  113. data/lib/bio/shell/core.rb +512 -0
  114. data/lib/bio/shell/plugin/codon.rb +228 -0
  115. data/lib/bio/shell/plugin/entry.rb +85 -0
  116. data/lib/bio/shell/plugin/flatfile.rb +119 -0
  117. data/lib/bio/shell/plugin/keggapi.rb +187 -0
  118. data/lib/bio/shell/plugin/midi.rb +448 -0
  119. data/lib/bio/shell/plugin/obda.rb +63 -0
  120. data/lib/bio/shell/plugin/seq.rb +238 -0
  121. data/lib/bio/shell/session.rb +214 -0
  122. data/lib/bio/util/color_scheme.rb +214 -0
  123. data/lib/bio/util/color_scheme/buried.rb +78 -0
  124. data/lib/bio/util/color_scheme/helix.rb +78 -0
  125. data/lib/bio/util/color_scheme/hydropathy.rb +83 -0
  126. data/lib/bio/util/color_scheme/nucleotide.rb +50 -0
  127. data/lib/bio/util/color_scheme/strand.rb +78 -0
  128. data/lib/bio/util/color_scheme/taylor.rb +69 -0
  129. data/lib/bio/util/color_scheme/turn.rb +78 -0
  130. data/lib/bio/util/color_scheme/zappo.rb +69 -0
  131. data/lib/bio/util/contingency_table.rb +337 -0
  132. data/lib/bio/util/sirna.rb +306 -0
  133. data/lib/bioruby.rb +34 -0
  134. data/sample/biofetch.rb +475 -0
  135. data/sample/color_scheme_na.rb +99 -0
  136. data/sample/dbget +37 -0
  137. data/sample/fasta2tab.rb +99 -0
  138. data/sample/fsplit.rb +51 -0
  139. data/sample/gb2fasta.rb +31 -0
  140. data/sample/gb2tab.rb +325 -0
  141. data/sample/gbtab2mysql.rb +161 -0
  142. data/sample/genes2nuc.rb +33 -0
  143. data/sample/genes2pep.rb +33 -0
  144. data/sample/genes2tab.rb +81 -0
  145. data/sample/genome2rb.rb +29 -0
  146. data/sample/genome2tab.rb +76 -0
  147. data/sample/goslim.rb +311 -0
  148. data/sample/gt2fasta.rb +47 -0
  149. data/sample/pmfetch.rb +42 -0
  150. data/sample/pmsearch.rb +42 -0
  151. data/sample/psortplot_html.rb +222 -0
  152. data/sample/ssearch2tab.rb +96 -0
  153. data/sample/tdiary.rb +158 -0
  154. data/sample/tfastx2tab.rb +100 -0
  155. data/sample/vs-genes.rb +212 -0
  156. data/test/data/SOSUI/sample.report +11 -0
  157. data/test/data/TMHMM/sample.report +21 -0
  158. data/test/data/blast/eco:b0002.faa +15 -0
  159. data/test/data/blast/eco:b0002.faa.m0 +128 -0
  160. data/test/data/blast/eco:b0002.faa.m7 +65 -0
  161. data/test/data/blast/eco:b0002.faa.m8 +1 -0
  162. data/test/data/embl/AB090716.embl +65 -0
  163. data/test/data/genscan/sample.report +63 -0
  164. data/test/data/prosite/prosite.dat +2233 -0
  165. data/test/data/refseq/nm_126355.entret +64 -0
  166. data/test/data/uniprot/p53_human.uniprot +1456 -0
  167. data/test/runner.rb +10 -0
  168. data/test/unit/bio/appl/blast/test_report.rb +427 -0
  169. data/test/unit/bio/appl/blast/test_xmlparser.rb +400 -0
  170. data/test/unit/bio/appl/genscan/test_report.rb +195 -0
  171. data/test/unit/bio/appl/sosui/test_report.rb +94 -0
  172. data/test/unit/bio/appl/targetp/test_report.rb +159 -0
  173. data/test/unit/bio/appl/test_blast.rb +159 -0
  174. data/test/unit/bio/appl/test_fasta.rb +142 -0
  175. data/test/unit/bio/appl/tmhmm/test_report.rb +139 -0
  176. data/test/unit/bio/data/test_aa.rb +103 -0
  177. data/test/unit/bio/data/test_codontable.rb +120 -0
  178. data/test/unit/bio/data/test_na.rb +89 -0
  179. data/test/unit/bio/db/embl/test_common.rb +130 -0
  180. data/test/unit/bio/db/embl/test_embl.rb +227 -0
  181. data/test/unit/bio/db/embl/test_sptr.rb +268 -0
  182. data/test/unit/bio/db/embl/test_uniprot.rb +44 -0
  183. data/test/unit/bio/db/kegg/test_genes.rb +58 -0
  184. data/test/unit/bio/db/test_fasta.rb +263 -0
  185. data/test/unit/bio/db/test_gff.rb +140 -0
  186. data/test/unit/bio/db/test_prosite.rb +1450 -0
  187. data/test/unit/bio/io/test_ddbjxml.rb +87 -0
  188. data/test/unit/bio/io/test_soapwsdl.rb +45 -0
  189. data/test/unit/bio/shell/plugin/test_seq.rb +175 -0
  190. data/test/unit/bio/test_alignment.rb +1028 -0
  191. data/test/unit/bio/test_command.rb +71 -0
  192. data/test/unit/bio/test_db.rb +109 -0
  193. data/test/unit/bio/test_feature.rb +128 -0
  194. data/test/unit/bio/test_location.rb +51 -0
  195. data/test/unit/bio/test_pathway.rb +485 -0
  196. data/test/unit/bio/test_sequence.rb +386 -0
  197. data/test/unit/bio/test_shell.rb +31 -0
  198. data/test/unit/bio/util/test_color_scheme.rb +45 -0
  199. data/test/unit/bio/util/test_contingency_table.rb +106 -0
  200. data/test/unit/bio/util/test_sirna.rb +258 -0
  201. metadata +295 -0
@@ -0,0 +1,570 @@
1
+ #
2
+ # = bio/appl/genscan/report.rb - Genscan report classes
3
+ #
4
+ # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao <n@bioruby.org>
5
+ # License:: LGPL
6
+ #
7
+ # $Id: report.rb,v 1.8 2005/12/18 15:58:40 k Exp $
8
+ #
9
+ # == Description
10
+ #
11
+ #
12
+ # == Example
13
+ # == References
14
+ #
15
+ #--
16
+ #
17
+ # This library is free software; you can redistribute it and/or
18
+ # modify it under the terms of the GNU Lesser General Public
19
+ # License as published by the Free Software Foundation; either
20
+ # version 2 of the License, or (at your option) any later version.
21
+ #
22
+ # This library is distributed in the hope that it will be useful,
23
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ # Lesser General Public License for more details.
26
+ #
27
+ # You should have received a copy of the GNU Lesser General Public
28
+ # License along with this library; if not, write to the Free Software
29
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
+ #
31
+ # $Id: report.rb,v 1.8 2005/12/18 15:58:40 k Exp $
32
+ #
33
+ #++
34
+ #
35
+
36
+ require 'bio/db/fasta'
37
+
38
+
39
+ module Bio
40
+
41
+ # = Bio::Genscan
42
+ class Genscan
43
+
44
+ # = Bio::Genscan::Report - Class for Genscan report output.
45
+ #
46
+ # Parser for the Genscan report output.
47
+ # * Genscan http://genes.mit.edu/GENSCAN.html
48
+ class Report
49
+
50
+ # Returns Genscan version.
51
+ attr_reader :genscan_version
52
+
53
+ # Returns
54
+ attr_reader :date_run
55
+
56
+ # Returns
57
+ attr_reader :time
58
+
59
+ # Returns Name of query sequence.
60
+ attr_reader :query_name
61
+ alias_method :sequence_name, :query_name
62
+ alias_method :name, :query_name
63
+
64
+ # Returns Length of the query sequence.
65
+ attr_reader :length
66
+
67
+ # Returns C+G content of the query sequence.
68
+ attr_reader :gccontent
69
+
70
+ # Returns
71
+ attr_reader :isochore
72
+
73
+ # Returns
74
+ attr_reader :matrix
75
+
76
+ # Returns Array of Bio::Genscan::Report::Gene.
77
+ attr_reader :predictions
78
+ alias_method :prediction, :predictions
79
+ alias_method :genes, :predictions
80
+
81
+
82
+ # Bio::Genscan::Report.new(str)
83
+ #
84
+ # Parse a Genscan report output string.
85
+ def initialize(report)
86
+ @predictions = []
87
+ @genscan_version = nil
88
+ @date_run = nil
89
+ @time = nil
90
+ @query_name = nil
91
+ @length = nil
92
+ @gccontent = nil
93
+ @isochore = nil
94
+ @matrix = nil
95
+
96
+ report.each("\n") do |line|
97
+ case line
98
+ when /^GENSCAN/
99
+ parse_headline(line)
100
+ when /^Sequence/
101
+ parse_sequence(line)
102
+ when /^Parameter/
103
+ parse_parameter(line)
104
+ when /^Predicted genes/
105
+ break
106
+ end
107
+ end
108
+
109
+ # rests
110
+ i = report.index(/^Predicted gene/)
111
+ j = report.index(/^Predicted peptide sequence/)
112
+
113
+ # genes/exons
114
+ genes_region = report[i...j]
115
+ genes_region.each("\n") do |line|
116
+ if /Init|Intr|Term|PlyA|Prom|Sngl/ =~ line
117
+ gn, en = line.strip.split(" +")[0].split(/\./).map {|i| i.to_i }
118
+ add_exon(gn, en, line)
119
+ end
120
+ end
121
+
122
+ # sequences (peptide|CDS)
123
+ sequence_region = report[j...report.size]
124
+ sequence_region.gsub!(/^Predicted .+?:/, '')
125
+ sequence_region.gsub!(/^\s*$/, '')
126
+ sequence_region.split(Bio::FastaFormat::RS).each do |ff|
127
+ add_seq(Bio::FastaFormat.new(ff))
128
+ end
129
+ end
130
+
131
+
132
+ # Bio::Genscan::Report#parse_headline
133
+ def parse_headline(line)
134
+ tmp = line.chomp.split(/\t/)
135
+ @genscan_version = tmp[0].split(' ')[1]
136
+ @date_run = tmp[1].split(': ')[1]
137
+ @time = tmp[2].split(': ')[1]
138
+ end
139
+ private :parse_headline
140
+
141
+
142
+ # Bio::Genscan::Report#parse_sequence
143
+ def parse_sequence(line)
144
+ if /^Sequence (\S+) : (\d+) bp : (\d+[\.\d]+)% C\+G : Isochore (\d+.+?)$/ =~ line
145
+ @query_name = $1
146
+ @length = $2.to_i
147
+ @gccontent = $3.to_f
148
+ @isochore = $4
149
+ else
150
+ raise "Error: [#{line.inspect}]"
151
+ end
152
+ end
153
+ private :parse_sequence
154
+
155
+
156
+ # Bio::Genscan::Report#parse_parameter
157
+ def parse_parameter(line)
158
+ if /^Parameter matrix: (\w.+)$/ =~ line.chomp
159
+ @matrix = $1
160
+ else
161
+ raise "Error: [#{line}]"
162
+ end
163
+ end
164
+ private :parse_parameter
165
+
166
+
167
+ # Bio::Genscan::Report#add_gene
168
+ def add_gene(gn)
169
+ @predictions[gn - 1] = Gene.new(gn)
170
+ end
171
+ private :add_gene
172
+
173
+
174
+ # Bio::Genscan::Report#add_exon
175
+ def add_exon(gn, en, line)
176
+ exon = Exon.parser(line)
177
+ case line
178
+ when /Prom/
179
+ begin
180
+ @predictions[gn - 1].set_promoter(exon)
181
+ rescue NameError
182
+ add_gene(gn)
183
+ @predictions[gn - 1].set_promoter(exon)
184
+ end
185
+ when /PlyA/
186
+ @predictions[gn - 1].set_polyA(exon)
187
+ else
188
+ begin
189
+ @predictions[gn - 1].exons[en - 1] = exon
190
+ rescue NameError
191
+ add_gene(gn)
192
+ @predictions[gn - 1].exons[en - 1] = exon
193
+ end
194
+ end
195
+ end
196
+ private :add_exon
197
+
198
+
199
+ # Bio::Genscan::Report#add_seq
200
+ def add_seq(seq)
201
+ if /peptide_(\d+)/ =~ seq.definition
202
+ gn = $1.to_i
203
+ @predictions[gn - 1].set_aaseq(seq)
204
+ elsif /CDS_(\d+)/ =~ seq.definition
205
+ gn = $1.to_i
206
+ @predictions[gn - 1].set_naseq(seq)
207
+ end
208
+ end
209
+ private :add_seq
210
+
211
+
212
+ # = Container class of predicted gene structures.
213
+ class Gene
214
+
215
+ # Bio::Genescan::Report::Gene.new(gene_number)
216
+ def initialize(gn)
217
+ @number = gn.to_i
218
+ @aaseq = Bio::FastaFormat.new("")
219
+ @naseq = Bio::FastaFormat.new("")
220
+ @promoter = nil
221
+ @exons = []
222
+ @polyA = nil
223
+ end
224
+
225
+ # Returns "Gn", gene number field.
226
+ attr_reader :number
227
+
228
+ # Returns Bio::FastaFormat object.
229
+ attr_reader :aaseq
230
+
231
+ # Returns Bio::FastaFormat object.
232
+ attr_reader :naseq
233
+
234
+ # Returns Array of Bio::Genscan::Report::Exon.
235
+ attr_reader :exons
236
+
237
+ # Returns Bio::Genscan::Report::Exon object.
238
+ attr_reader :promoter
239
+
240
+ # Returns Bio::Genscan::Report::Exon object.
241
+ attr_reader :polyA
242
+
243
+
244
+ # Bio::Genescan::Report::Gene#seq_aaseq
245
+ def set_aaseq(seq)
246
+ @aaseq = seq
247
+ end
248
+
249
+
250
+ # Bio::Genescan::Report::Gene#seq_naseq
251
+ def set_naseq(seq)
252
+ @naseq = seq
253
+ end
254
+
255
+
256
+ # Bio::Genescan::Report::Gene#seq_promoter
257
+ def set_promoter(segment)
258
+ @promoter = segment
259
+ end
260
+
261
+
262
+ # Bio::Genescan::Report::Gene#seq_polyA
263
+ def set_polyA(segment)
264
+ @polyA = segment
265
+ end
266
+
267
+ end # class Gene
268
+
269
+
270
+ # = Container class of a predicted gene structure.
271
+ class Exon
272
+
273
+ #
274
+ TYPES = {
275
+ 'Init' => 'Initial exon',
276
+ 'Intr' => 'Internal exon',
277
+ 'Term' => 'Terminal exon',
278
+ 'Sngl' => 'Single-exon gene',
279
+ 'Prom' => 'Promoter',
280
+ 'PlyA' => 'poly-A signal'
281
+ }
282
+
283
+
284
+ # Bio::Genescan::Report::Exon.parser
285
+ def self.parser(line)
286
+ e = line.strip.split(/ +/)
287
+ case line
288
+ when /PlyA/, /Prom/
289
+ e[12] = e[6].clone
290
+ e[11] = 0
291
+ [6,7,8,9,10].each {|i| e[i] = nil }
292
+ end
293
+ self.new(e[0], e[1], e[2], e[3], e[4], e[5], e[6],
294
+ e[7], e[8], e[9], e[10], e[11], e[12])
295
+ end
296
+
297
+
298
+ # Returns
299
+ attr_reader :gene_number
300
+
301
+ # Returns "Ex", exon number field
302
+ attr_reader :number
303
+
304
+ # Returns "Type" field.
305
+ attr_reader :exon_type
306
+
307
+ # Returns "S" field.
308
+ attr_reader :strand
309
+
310
+ # Returns Returns first position of the region. "Begin" field.
311
+ attr_reader :first
312
+
313
+ # Returns Returns last position of the region. "End" field.
314
+ attr_reader :last
315
+
316
+ # Returns "Fr" field.
317
+ attr_reader :frame
318
+
319
+ # Returns "Ph" field.
320
+ attr_reader :phase
321
+
322
+ # Returns "CodRg" field.
323
+ attr_reader :score
324
+
325
+ # Returns "P" field.
326
+ attr_reader :p_value
327
+
328
+ # Returns "Tscr" field.
329
+ attr_reader :t_score
330
+ alias_method :coding_region_score, :score
331
+
332
+
333
+ # Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first,
334
+ # end, length, frame, phase, acceptor_score, donor_score, score, p_value,
335
+ # t_score)
336
+ def initialize(gnex, t, s, b, e, len, fr, ph, iac, dot, cr, prob, ts)
337
+ @gene_number, @number = gnex.split(".").map {|n| n.to_i }
338
+ @exon_type = t
339
+ @strand = s
340
+ @first = b.to_i
341
+ @last = e.to_i
342
+ @length = len.to_i
343
+ @frame = fr
344
+ @phase = ph
345
+ @i_ac = iac.to_i
346
+ @do_t = dot.to_i
347
+ @score = cr.to_i
348
+ @p_value = prob.to_f
349
+ @t_score = ts.to_f
350
+ end
351
+
352
+
353
+
354
+ # Bio::Genescan::Report::Exon#exon_type_long
355
+ #
356
+ # Returns a human-readable "Type" of exon.
357
+ def exon_type_long
358
+ TYPES[exon_type]
359
+ end
360
+
361
+
362
+ # Bio::Genescan::Report::Exon#range
363
+ #
364
+ # Returns Range object of the region.
365
+ def range
366
+ Range.new(@first, @last)
367
+ end
368
+
369
+
370
+ # Bio::Genescan::Report::Exon#acceptor_score
371
+ #
372
+ # "I/Ac" field.
373
+ def acceptor_score
374
+ @i_ac
375
+ end
376
+ alias_method :initiation_score, :acceptor_score
377
+
378
+
379
+ # Bio::Genescan::Report::Exon#donor_score
380
+ #
381
+ # "Do/T" field.
382
+ def donor_score
383
+ @do_t
384
+ end
385
+ alias_method :termination_score, :donor_score
386
+
387
+ end # class Exon
388
+
389
+ end # class Report
390
+
391
+ end # class Genscan
392
+
393
+ end # module Bio
394
+
395
+
396
+
397
+
398
+
399
+ # testing code
400
+
401
+ if __FILE__ == $0
402
+
403
+ if $<.filename != '-'
404
+ report = $<.read
405
+ else
406
+ report = File.open(__FILE__, 'r').read.scan(/^>>>> (.+)$/).join("\n")
407
+ end
408
+
409
+
410
+ puts "= class Bio::Genscan::Report "
411
+ report = Bio::Genscan::Report.new(report)
412
+
413
+
414
+ print " report.genscan_version #=> "
415
+ p report.genscan_version
416
+ print " report.date_run #=> "
417
+ p report.date_run
418
+ print " report.time #=> "
419
+ p report.time
420
+
421
+ print " report.query_name #=> "
422
+ p report.query_name
423
+ print " report.length #=> "
424
+ p report.length
425
+ print " report.gccontent #=> "
426
+ p report.gccontent
427
+ print " report.isochore #=> "
428
+ p report.isochore
429
+
430
+ print " report.matrix #=> "
431
+ p report.matrix
432
+
433
+ puts " report.predictions (Array of Bio::Genscan::Report::Gene) "
434
+ print " report.predictions.size #=> "
435
+ p report.predictions.size
436
+
437
+
438
+ report.predictions.each {|gene|
439
+ puts "\n== class Bio::Genscan::Report::Gene "
440
+ print " gene.number #=> "
441
+ p gene.number
442
+ print " gene.aaseq (Bio::FastaFormat) #=> "
443
+ p gene.aaseq
444
+ print " gene.naseq (Bio::FastaFormat) #=> "
445
+ p gene.naseq
446
+ print " ene.promoter (Bio::Genscan::Report::Exon) #=> "
447
+ p gene.promoter
448
+ print " gene.polyA (Bio::Genscan::Report::Exon) #=> "
449
+ p gene.polyA
450
+ puts " gene.exons (Array of Bio::Genscan::Report::Exon) "
451
+ print " gene.exons.size #=> "
452
+ p gene.exons.size
453
+
454
+
455
+ gene.exons.each {|exon|
456
+ puts "\n== class Bio::Genscan::Report::Exon "
457
+ print " exon.number #=> "
458
+ p exon.number
459
+ print " exon.exon_type #=> "
460
+ p exon.exon_type
461
+ print " exon.exon_type_long #=> "
462
+ p exon.exon_type_long
463
+ print " exon.strand #=> "
464
+ p exon.strand
465
+ print " exon.first #=> "
466
+ p exon.first
467
+ print " exon.last #=> "
468
+ p exon.last
469
+ print " exon.range (Range) #=> "
470
+ p exon.range
471
+ print " exon.frame #=> "
472
+ p exon.frame
473
+ print " exon.phase #=> "
474
+ p exon.phase
475
+ print " exon.acceptor_score #=> "
476
+ p exon.acceptor_score
477
+ print " exon.donor_score #=> "
478
+ p exon.donor_score
479
+ print " exon.initiation_score #=> "
480
+ p exon.initiation_score
481
+ print " exon.termination_score #=> "
482
+ p exon.termination_score
483
+ print " exon.score #=> "
484
+ p exon.score
485
+ print " exon.p_value #=> "
486
+ p exon.p_value
487
+ print " exon.t_score #=> "
488
+ p exon.t_score
489
+ puts
490
+ }
491
+ puts
492
+ }
493
+
494
+ end
495
+
496
+
497
+
498
+
499
+
500
+ =begin
501
+
502
+
503
+ = Sample Genscan report with '^>>>> '.
504
+
505
+
506
+ >>>> GENSCAN 1.0 Date run: 30-May-103 Time: 14:06:28
507
+ >>>>
508
+ >>>> Sequence HUMRASH : 12942 bp : 68.17% C+G : Isochore 4 (57 - 100 C+G%)
509
+ >>>>
510
+ >>>> Parameter matrix: HumanIso.smat
511
+ >>>>
512
+ >>>> Predicted genes/exons:
513
+ >>>>
514
+ >>>> Gn.Ex Type S .Begin ...End .Len Fr Ph I/Ac Do/T CodRg P.... Tscr..
515
+ >>>> ----- ---- - ------ ------ ---- -- -- ---- ---- ----- ----- ------
516
+ >>>>
517
+ >>>> 1.01 Init + 1664 1774 111 1 0 94 83 212 0.997 21.33
518
+ >>>> 1.02 Intr + 2042 2220 179 1 2 104 66 408 0.997 40.12
519
+ >>>> 1.03 Intr + 2374 2533 160 1 1 89 94 302 0.999 32.08
520
+ >>>> 1.04 Term + 3231 3350 120 2 0 115 48 202 0.980 18.31
521
+ >>>> 1.05 PlyA + 3722 3727 6 -5.80
522
+ >>>>
523
+ >>>> 2.00 Prom + 6469 6508 40 -7.92
524
+ >>>> 2.01 Init + 8153 8263 111 1 0 94 83 212 0.998 21.33
525
+ >>>> 2.02 Intr + 8531 8709 179 1 2 104 66 408 0.997 40.12
526
+ >>>> 2.03 Intr + 8863 9022 160 1 1 89 94 302 0.999 32.08
527
+ >>>> 2.04 Term + 9720 9839 120 2 0 115 48 202 0.961 18.31
528
+ >>>>
529
+ >>>> Predicted peptide sequence(s):
530
+ >>>>
531
+ >>>> Predicted coding sequence(s):
532
+ >>>>
533
+ >>>>
534
+ >>>> >HUMRASH|GENSCAN_predicted_peptide_1|189_aa
535
+ >>>> MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG
536
+ >>>> QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL
537
+ >>>> AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG
538
+ >>>> CMSCKCVLS
539
+ >>>>
540
+ >>>> >HUMRASH|GENSCAN_predicted_CDS_1|570_bp
541
+ >>>> atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc
542
+ >>>> atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac
543
+ >>>> cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc
544
+ >>>> caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt
545
+ >>>> gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc
546
+ >>>> aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg
547
+ >>>> gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc
548
+ >>>> tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg
549
+ >>>> cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc
550
+ >>>> tgcatgagctgcaagtgtgtgctctcctga
551
+ >>>>
552
+ >>>> >HUMRASH|GENSCAN_predicted_peptide_2|189_aa
553
+ >>>> MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG
554
+ >>>> QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL
555
+ >>>> AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG
556
+ >>>> CMSCKCVLS
557
+ >>>>
558
+ >>>> >HUMRASH|GENSCAN_predicted_CDS_2|570_bp
559
+ >>>> atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc
560
+ >>>> atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac
561
+ >>>> cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc
562
+ >>>> caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt
563
+ >>>> gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc
564
+ >>>> aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg
565
+ >>>> gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc
566
+ >>>> tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg
567
+ >>>> cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc
568
+ >>>> tgcatgagctgcaagtgtgtgctctcctga
569
+
570
+ =end