bio 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/COPYING +56 -0
  2. data/COPYING.ja +51 -0
  3. data/ChangeLog +540 -0
  4. data/GPL +340 -0
  5. data/LEGAL +141 -0
  6. data/LGPL +504 -0
  7. data/README.rdoc +4 -2
  8. data/Rakefile +2 -2
  9. data/bioruby.gemspec +17 -29
  10. data/doc/Tutorial.rd +118 -90
  11. data/doc/Tutorial.rd.html +124 -87
  12. data/lib/bio/appl/blast.rb +2 -2
  13. data/lib/bio/appl/blast/format0.rb +1 -1
  14. data/lib/bio/appl/fasta.rb +5 -12
  15. data/lib/bio/appl/fasta/format10.rb +96 -6
  16. data/lib/bio/appl/gcg/msf.rb +11 -14
  17. data/lib/bio/appl/pts1.rb +0 -4
  18. data/lib/bio/appl/sim4/report.rb +50 -17
  19. data/lib/bio/db/biosql/biosql_to_biosequence.rb +10 -0
  20. data/lib/bio/db/biosql/sequence.rb +234 -298
  21. data/lib/bio/db/embl/embl.rb +0 -3
  22. data/lib/bio/db/genbank/common.rb +3 -1
  23. data/lib/bio/io/biosql/ar-biosql.rb +257 -0
  24. data/lib/bio/io/biosql/biosql.rb +39 -0
  25. data/lib/bio/io/biosql/config/database.yml +5 -4
  26. data/lib/bio/io/ncbirest.rb +12 -5
  27. data/lib/bio/io/pubmed.rb +5 -1
  28. data/lib/bio/io/sql.rb +43 -150
  29. data/lib/bio/sequence/compat.rb +5 -1
  30. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +6 -4
  31. data/lib/bio/version.rb +1 -1
  32. data/test/data/gcg/pileup-aa.msf +67 -0
  33. data/test/data/sim4/complement-A4.sim4 +43 -0
  34. data/test/data/sim4/simple-A4.sim4 +25 -0
  35. data/test/data/sim4/simple2-A4.sim4 +25 -0
  36. data/test/functional/bio/io/test_pubmed.rb +129 -0
  37. data/test/unit/bio/appl/bl2seq/test_report.rb +5 -5
  38. data/test/unit/bio/appl/gcg/test_msf.rb +154 -0
  39. data/test/unit/bio/appl/hmmer/test_report.rb +2 -2
  40. data/test/unit/bio/appl/sim4/test_report.rb +869 -0
  41. data/test/unit/bio/appl/test_blast.rb +1 -1
  42. data/test/unit/bio/db/biosql/tc_biosql.rb +110 -0
  43. data/test/unit/bio/db/biosql/ts_suite_biosql.rb +8 -0
  44. data/test/unit/bio/test_feature.rb +18 -17
  45. data/test/unit/bio/test_reference.rb +18 -18
  46. data/test/unit/bio/test_sequence.rb +1 -1
  47. metadata +18 -30
  48. data/lib/bio/io/biosql/biodatabase.rb +0 -64
  49. data/lib/bio/io/biosql/bioentry.rb +0 -29
  50. data/lib/bio/io/biosql/bioentry_dbxref.rb +0 -11
  51. data/lib/bio/io/biosql/bioentry_path.rb +0 -12
  52. data/lib/bio/io/biosql/bioentry_qualifier_value.rb +0 -10
  53. data/lib/bio/io/biosql/bioentry_reference.rb +0 -10
  54. data/lib/bio/io/biosql/bioentry_relationship.rb +0 -10
  55. data/lib/bio/io/biosql/biosequence.rb +0 -11
  56. data/lib/bio/io/biosql/comment.rb +0 -7
  57. data/lib/bio/io/biosql/dbxref.rb +0 -13
  58. data/lib/bio/io/biosql/dbxref_qualifier_value.rb +0 -12
  59. data/lib/bio/io/biosql/location.rb +0 -32
  60. data/lib/bio/io/biosql/location_qualifier_value.rb +0 -11
  61. data/lib/bio/io/biosql/ontology.rb +0 -10
  62. data/lib/bio/io/biosql/reference.rb +0 -9
  63. data/lib/bio/io/biosql/seqfeature.rb +0 -32
  64. data/lib/bio/io/biosql/seqfeature_dbxref.rb +0 -11
  65. data/lib/bio/io/biosql/seqfeature_path.rb +0 -11
  66. data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +0 -20
  67. data/lib/bio/io/biosql/seqfeature_relationship.rb +0 -11
  68. data/lib/bio/io/biosql/taxon.rb +0 -12
  69. data/lib/bio/io/biosql/taxon_name.rb +0 -9
  70. data/lib/bio/io/biosql/term.rb +0 -27
  71. data/lib/bio/io/biosql/term_dbxref.rb +0 -11
  72. data/lib/bio/io/biosql/term_path.rb +0 -12
  73. data/lib/bio/io/biosql/term_relationship.rb +0 -13
  74. data/lib/bio/io/biosql/term_relationship_term.rb +0 -11
  75. data/lib/bio/io/biosql/term_synonym.rb +0 -10
@@ -4,7 +4,7 @@
4
4
  # Copyright:: Copyright (C) 2006 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_report.rb,v 1.3 2007/04/05 23:35:43 trevor Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
10
  require 'pathname'
@@ -41,7 +41,7 @@ module Bio
41
41
  assert_equal(Array, ary.class)
42
42
  end
43
43
 
44
- def test_reports_ary
44
+ def test_reports_ary_contents
45
45
  Bio::HMMER.reports(Bio::TestHMMERReportData.output).each do |report|
46
46
  assert_equal(Bio::HMMER::Report, report.class)
47
47
  end
@@ -0,0 +1,869 @@
1
+ #
2
+ # test/unit/bio/appl/sim4/test_report.rb - Unit test for Bio::Sim4
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Naohisa Goto <ng@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id:$
9
+ #
10
+
11
+ require 'pathname'
12
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
13
+ $:.unshift(libpath) unless $:.include?(libpath)
14
+
15
+ require 'test/unit'
16
+ require 'bio/appl/sim4/report'
17
+
18
+ module Bio
19
+
20
+ class TestDataForSim4Report
21
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
22
+ DataPath = Pathname.new(File.join(bioruby_root, 'test', 'data', 'sim4')).cleanpath.to_s
23
+
24
+ def initialize(filename)
25
+ @filename = filename
26
+ end
27
+
28
+ def read
29
+ File.read(File.join(DataPath,@filename))
30
+ end
31
+
32
+ def report
33
+ Bio::Sim4::Report.new(self.read)
34
+ end
35
+
36
+ def self.report(filename)
37
+ self.new(filename).report
38
+ end
39
+
40
+ def self.report1
41
+ filename = "simple-A4.sim4"
42
+ self.new(filename).report
43
+ end
44
+
45
+ def self.report2
46
+ filename = "simple2-A4.sim4"
47
+ self.new(filename).report
48
+ end
49
+
50
+ def self.report4
51
+ filename = "complement-A4.sim4"
52
+ self.new(filename).report
53
+ end
54
+
55
+ end #class TestDataForSim4Report
56
+
57
+
58
+ class TestSim4Report < Test::Unit::TestCase
59
+
60
+ def setup
61
+ @sim4 = TestDataForSim4Report.report1
62
+ end
63
+
64
+ def test_hits
65
+ assert_kind_of(Array, @sim4.hits)
66
+ assert_equal(1, @sim4.hits.size)
67
+ assert_instance_of(Bio::Sim4::Report::Hit, @sim4.hits[0])
68
+ end
69
+
70
+ def test_all_hits
71
+ assert_kind_of(Array, @sim4.all_hits)
72
+ assert_equal(1, @sim4.all_hits.size)
73
+ assert_instance_of(Bio::Sim4::Report::Hit, @sim4.all_hits[0])
74
+ end
75
+
76
+ def exec_test_seq1_len(sd)
77
+ assert_equal(94, sd.len)
78
+ end
79
+ private :exec_test_seq1_len
80
+
81
+ def test_seq1
82
+ sd = @sim4.seq1
83
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
84
+ assert_equal('mrna1', sd.entry_id)
85
+ assert_equal('mrna1', sd.definition)
86
+ assert_equal('sample10-1.fst', sd.filename)
87
+ exec_test_seq1_len(sd)
88
+ end
89
+
90
+ def exec_test_each(meth)
91
+ count = 0
92
+ assert_nothing_raised {
93
+ @sim4.__send__(meth) do |x|
94
+ count += 1
95
+ end
96
+ }
97
+ assert_equal(1, count)
98
+ @sim4.__send__(meth) do |x|
99
+ assert_instance_of(Bio::Sim4::Report::Hit, x)
100
+ end
101
+ end
102
+ private :exec_test_each
103
+
104
+ def test_each
105
+ exec_test_each(:each)
106
+ end
107
+
108
+ def test_each_hit
109
+ exec_test_each(:each_hit)
110
+ end
111
+
112
+ def test_num_hits
113
+ assert_equal(1, @sim4.num_hits)
114
+ end
115
+
116
+ def test_query_def
117
+ assert_equal('mrna1', @sim4.query_def)
118
+ end
119
+
120
+ def test_query_id
121
+ assert_equal('mrna1', @sim4.query_id)
122
+ end
123
+
124
+ def test_query_len
125
+ assert_equal(94, @sim4.query_len)
126
+ end
127
+
128
+ end #class TestSim4Report
129
+
130
+ class TestSim4ReportHit < Test::Unit::TestCase
131
+
132
+ def setup
133
+ @hit = TestDataForSim4Report.report1.hits.first
134
+ end
135
+
136
+ def test_align
137
+ a = [
138
+ [ "TTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG",
139
+ "||||||||||||||||||||||||||||||||||||||||",
140
+ "TTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG" ],
141
+ [ " ",
142
+ "<<<...<<<",
143
+ "CTG...TAC" ],
144
+ [ "TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAGCTAA",
145
+ "|||||||||||||||| |||||||||||||-|||||||||||||||-||||||||",
146
+ "TCTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCAAGCTAA" ]
147
+ ]
148
+ assert_equal(a, @hit.align)
149
+ end
150
+
151
+ def test_complement?
152
+ assert_equal(nil, @hit.complement?)
153
+ end
154
+
155
+ def test_definition
156
+ assert_equal('genome1', @hit.definition)
157
+ end
158
+
159
+ def test_each
160
+ count = 0
161
+ assert_nothing_raised {
162
+ @hit.each do |x|
163
+ count += 1
164
+ end
165
+ }
166
+ assert_equal(2, count)
167
+ @hit.each do |x|
168
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
169
+ end
170
+ end
171
+
172
+ def exec_test_exons(meth)
173
+ assert_kind_of(Array, @hit.__send__(meth))
174
+ assert_equal(2, @hit.__send__(meth).size)
175
+ @hit.__send__(meth).each do |x|
176
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
177
+ end
178
+ end
179
+ private :exec_test_exons
180
+
181
+ def test_exons
182
+ exec_test_exons(:exons)
183
+ end
184
+
185
+ def test_hit_id
186
+ assert_equal('genome1', @hit.hit_id)
187
+ end
188
+
189
+ def test_hsps
190
+ exec_test_exons(:hsps)
191
+ end
192
+
193
+ def test_introns
194
+ assert_kind_of(Array, @hit.introns)
195
+ assert_equal(1, @hit.introns.size)
196
+ @hit.introns.each do |x|
197
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
198
+ end
199
+ end
200
+
201
+ def test_len
202
+ assert_equal(599, @hit.len)
203
+ end
204
+
205
+ def test_query_def
206
+ assert_equal('mrna1', @hit.query_def)
207
+ end
208
+
209
+ def test_query_id
210
+ assert_equal('mrna1', @hit.query_id)
211
+ end
212
+
213
+ def test_query_len
214
+ assert_equal(94, @hit.query_len)
215
+ end
216
+
217
+ def test_segmentpairs
218
+ assert_kind_of(Array, @hit.segmentpairs)
219
+ assert_equal(3, @hit.segmentpairs.size)
220
+ @hit.segmentpairs.each do |x|
221
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
222
+ end
223
+ end
224
+
225
+ def exec_test_seq1_len(sd)
226
+ assert_equal(94, sd.len)
227
+ end
228
+ private :exec_test_seq1_len
229
+
230
+ def test_seq1
231
+ sd = @hit.seq1
232
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
233
+ assert_equal('mrna1', sd.entry_id)
234
+ assert_equal('mrna1', sd.definition)
235
+ assert_equal('sample10-1.fst', sd.filename)
236
+ exec_test_seq1_len(sd)
237
+ end
238
+
239
+ def test_seq2
240
+ sd = @hit.seq2
241
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
242
+ assert_equal('genome1', sd.entry_id)
243
+ assert_equal('genome1', sd.definition)
244
+ assert_equal(599, sd.len)
245
+ #assert_equal('sample10-2.fst', sd.filename)
246
+ assert_equal('sample10-2.fst (genome1)', sd.filename)
247
+ end
248
+
249
+ def test_target_def
250
+ assert_equal('genome1', @hit.target_def)
251
+ end
252
+
253
+ def test_target_id
254
+ assert_equal('genome1', @hit.target_id)
255
+ end
256
+
257
+ def test_target_len
258
+ assert_equal(599, @hit.target_len)
259
+ end
260
+ end #class TestSim4ReportHit
261
+
262
+ class TestSim4ReportSegmentPair_exon < Test::Unit::TestCase
263
+ def setup
264
+ @exon = TestDataForSim4Report.report1.hits[0].exons[1]
265
+ end
266
+
267
+ def test_align_len
268
+ assert_equal(55, @exon.align_len)
269
+ end
270
+
271
+ def test_direction
272
+ assert_equal("", @exon.direction)
273
+ end
274
+
275
+ def test_hit_from
276
+ assert_equal(404, @exon.hit_from)
277
+ end
278
+
279
+ def test_hit_to
280
+ assert_equal(457, @exon.hit_to)
281
+ end
282
+
283
+ def test_hseq
284
+ hseq = "TCTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCAAGCTAA"
285
+ assert_equal(hseq, @exon.hseq)
286
+ end
287
+
288
+ def test_midline
289
+ midline = "|||||||||||||||| |||||||||||||-|||||||||||||||-||||||||"
290
+ assert_equal(midline, @exon.midline)
291
+ end
292
+
293
+ def test_percent_identity
294
+ #assert_equal(94, @exon.percent_identity)
295
+ assert_equal("94", @exon.percent_identity)
296
+ end
297
+
298
+ def test_qseq
299
+ qseq = "TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAGCTAA"
300
+ assert_equal(qseq, @exon.qseq)
301
+ end
302
+
303
+ def test_query_from
304
+ assert_equal(41, @exon.query_from)
305
+ end
306
+
307
+ def test_query_to
308
+ assert_equal(94, @exon.query_to)
309
+ end
310
+
311
+ def exec_test_seq1_from_to(seg)
312
+ assert_equal(41, seg.from)
313
+ assert_equal(94, seg.to)
314
+ end
315
+ private :exec_test_seq1_from_to
316
+
317
+ def test_seq1
318
+ assert_instance_of(Bio::Sim4::Report::Segment, @exon.seq1)
319
+ assert_equal("TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAGCTAA",
320
+ @exon.seq1.seq)
321
+ exec_test_seq1_from_to(@exon.seq1)
322
+ end
323
+
324
+ def test_seq2
325
+ assert_instance_of(Bio::Sim4::Report::Segment, @exon.seq2)
326
+ assert_equal(404, @exon.seq2.from)
327
+ assert_equal(457, @exon.seq2.to)
328
+ assert_equal("TCTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCAAGCTAA",
329
+ @exon.seq2.seq)
330
+ end
331
+ end #class TestSim4ReportSegmentPair_exon
332
+
333
+ class TestSim4ReportSegmentPair_intron < Test::Unit::TestCase
334
+ def setup
335
+ @intron = TestDataForSim4Report.report1.hits[0].introns[0]
336
+ end
337
+
338
+ def test_align_len
339
+ assert_equal(9, @intron.align_len)
340
+ end
341
+
342
+ def test_direction
343
+ assert_equal(nil, @intron.direction)
344
+ end
345
+
346
+ def test_hit_from
347
+ assert_equal(185, @intron.hit_from)
348
+ end
349
+
350
+ def test_hit_to
351
+ assert_equal(403, @intron.hit_to)
352
+ end
353
+
354
+ def test_hseq
355
+ hseq = "CTG...TAC"
356
+ assert_equal(hseq, @intron.hseq)
357
+ end
358
+
359
+ def test_midline
360
+ midline = "<<<...<<<"
361
+ assert_equal(midline, @intron.midline)
362
+ end
363
+
364
+ def test_percent_identity
365
+ assert_equal(nil, @intron.percent_identity)
366
+ end
367
+
368
+ def test_qseq
369
+ qseq = " "
370
+ assert_equal(qseq, @intron.qseq)
371
+ end
372
+
373
+ def test_query_from
374
+ assert_equal(0, @intron.query_from)
375
+ end
376
+
377
+ def test_query_to
378
+ assert_equal(0, @intron.query_to)
379
+ end
380
+
381
+ def test_seq1
382
+ assert_instance_of(Bio::Sim4::Report::Segment, @intron.seq1)
383
+ assert_equal(0, @intron.seq1.from)
384
+ assert_equal(0, @intron.seq1.to)
385
+ assert_equal(" ", @intron.seq1.seq)
386
+ end
387
+
388
+ def test_seq2
389
+ assert_instance_of(Bio::Sim4::Report::Segment, @intron.seq2)
390
+ assert_equal(185, @intron.seq2.from)
391
+ assert_equal(403, @intron.seq2.to)
392
+ assert_equal("CTG...TAC", @intron.seq2.seq)
393
+ end
394
+ end #class TestSim4ReportSegmentPair_intron
395
+
396
+
397
+ class TestSim4Report2 < TestSim4Report
398
+ def setup
399
+ @sim4 = TestDataForSim4Report.report2
400
+ end
401
+
402
+ def test_query_len
403
+ assert_equal(96, @sim4.query_len)
404
+ end
405
+
406
+ def exec_test_seq1_len(sd)
407
+ assert_equal(96, sd.len)
408
+ end
409
+ private :exec_test_seq1_len
410
+ end #class TestSim4Report2
411
+
412
+ class TestSim4ReportHit2 < TestSim4ReportHit
413
+ def setup
414
+ @hit = TestDataForSim4Report.report2.hits.first
415
+ end
416
+
417
+ def test_align
418
+ a = [
419
+ [ "AGTTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG",
420
+ "||||||||||||||||||||||||||||||||||||||||||",
421
+ "AGTTGTTTCCGTCGCTGGTTATTGTCTAGAACGCAAAAATAG" ],
422
+ [ " ",
423
+ "<<<...<<<",
424
+ "CTG...TAC" ],
425
+ [ "TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAGCTAA",
426
+ "|||||||||||||||| |||||||||||||-|||||||||||||||-||||||||",
427
+ "TCTACACATCACTAGCCTGGGTGGGCGGAA GAGCAGCTCGCCACTTCAAGCTAA" ]
428
+ ]
429
+ assert_equal(a, @hit.align)
430
+ end
431
+
432
+ def test_query_len
433
+ assert_equal(96, @hit.query_len)
434
+ end
435
+
436
+ def exec_test_seq1_len(sd)
437
+ assert_equal(96, sd.len)
438
+ end
439
+ private :exec_test_seq1_len
440
+ end #class TestSim4ReportHit2
441
+
442
+
443
+ class TestSim4ReportSegmentPair2_exon < TestSim4ReportSegmentPair_exon
444
+ def setup
445
+ @exon = TestDataForSim4Report.report2.hits[0].exons[1]
446
+ end
447
+
448
+ def test_query_from
449
+ assert_equal(43, @exon.query_from)
450
+ end
451
+
452
+ def test_query_to
453
+ assert_equal(96, @exon.query_to)
454
+ end
455
+
456
+ def exec_test_seq1_from_to(seg)
457
+ assert_equal(43, seg.from)
458
+ assert_equal(96, seg.to)
459
+ end
460
+ private :exec_test_seq1_from_to
461
+
462
+ end #class TestSim4ReportSegmentPair2_exon
463
+
464
+
465
+ class TestSim4ReportSegmentPair2_intron < TestSim4ReportSegmentPair_intron
466
+ def setup
467
+ @intron = TestDataForSim4Report.report2.hits[0].introns[0]
468
+ end
469
+ end #class TestSim4ReportSegmentPair2_intron
470
+
471
+
472
+ class TestSim4Report4 < TestSim4Report
473
+
474
+ def setup
475
+ @sim4 = TestDataForSim4Report.report4
476
+ end
477
+
478
+ def exec_test_seq1_len(sd)
479
+ assert_equal(284, sd.len)
480
+ end
481
+ private :exec_test_seq1_len
482
+
483
+ def test_seq1
484
+ sd = @sim4.seq1
485
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
486
+ assert_equal('mrna4c', sd.entry_id)
487
+ assert_equal('mrna4c', sd.definition)
488
+ assert_equal('sample41-1c.fst', sd.filename)
489
+ exec_test_seq1_len(sd)
490
+ end
491
+
492
+ def test_query_def
493
+ assert_equal('mrna4c', @sim4.query_def)
494
+ end
495
+
496
+ def test_query_id
497
+ assert_equal('mrna4c', @sim4.query_id)
498
+ end
499
+
500
+ def test_query_len
501
+ assert_equal(284, @sim4.query_len)
502
+ end
503
+
504
+ end #class TestSim4Report4
505
+
506
+ class TestSim4ReportHit4 < TestSim4ReportHit
507
+
508
+ def setup
509
+ @hit = TestDataForSim4Report.report4.hits.first
510
+ end
511
+
512
+ def test_align
513
+ a = [
514
+ [ "TTTTAGCCGGCACGAGATTG AGCGTATGATCACGCGCGCGGCCTCCT CAGAGTGATGCATGATACAACTT AT ",
515
+ "||||||||||||||||||||-||||-||||||||||||||||||||||-|-|||| ||||||||||||||||- |-",
516
+ "TTTTAGCCGGCACGAGATTGCAGCG ATGATCACGCGCGCGGCCTCCTAC GAGTCATGCATGATACAACTTCTTG"],
517
+ [ " ",
518
+ ">>>...>>>",
519
+ "GTT...GAT" ],
520
+ [ "ATATGTACTTAGCTGGCAACCGAGATTTACTTTCGAAGCACTGTGATGAACCCGCGGCCCTTTGAGCGCT",
521
+ "|||||||||||||-|||||||||||||||||||||||| |||||||||||||||||-|||||||||||||",
522
+ "ATATGTACTTAGC GGCAACCGAGATTTACTTTCGAAGGACTGTGATGAACCCGCG CCCTTTGAGCGCT" ],
523
+ [ "", "", "" ],
524
+ [ "TATATATGTACTTAGCGG ACACCGAGATTTACTTTCGAAGGACTGTGGATGAACCCGCGCCCTTTGAGCGCT",
525
+ "||||||||||||||||||-|-|||||||||||||||||||||||||||-||||||||||||||||||||||||",
526
+ "TATATATGTACTTAGCGGCA ACCGAGATTTACTTTCGAAGGACTGTG ATGAACCCGCGCCCTTTGAGCGCT" ]
527
+ ]
528
+ assert_equal(a, @hit.align)
529
+ end
530
+
531
+ def test_complement?
532
+ assert_equal(true, @hit.complement?)
533
+ end
534
+
535
+ def test_definition
536
+ assert_equal('genome4', @hit.definition)
537
+ end
538
+
539
+ def test_each
540
+ count = 0
541
+ assert_nothing_raised {
542
+ @hit.each do |x|
543
+ count += 1
544
+ end
545
+ }
546
+ assert_equal(3, count)
547
+ @hit.each do |x|
548
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
549
+ end
550
+ end
551
+
552
+ def exec_test_exons(meth)
553
+ assert_kind_of(Array, @hit.__send__(meth))
554
+ assert_equal(3, @hit.__send__(meth).size)
555
+ @hit.__send__(meth).each do |x|
556
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
557
+ end
558
+ end
559
+ private :exec_test_exons
560
+
561
+ def test_hit_id
562
+ assert_equal('genome4', @hit.hit_id)
563
+ end
564
+
565
+ def test_introns
566
+ assert_kind_of(Array, @hit.introns)
567
+ assert_equal(2, @hit.introns.size)
568
+ @hit.introns.each do |x|
569
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
570
+ end
571
+ end
572
+
573
+ def test_len
574
+ assert_equal(770, @hit.len)
575
+ end
576
+
577
+ def test_query_def
578
+ assert_equal('mrna4c', @hit.query_def)
579
+ end
580
+
581
+ def test_query_id
582
+ assert_equal('mrna4c', @hit.query_id)
583
+ end
584
+
585
+ def test_query_len
586
+ assert_equal(284, @hit.query_len)
587
+ end
588
+
589
+ def test_segmentpairs
590
+ assert_kind_of(Array, @hit.segmentpairs)
591
+ assert_equal(5, @hit.segmentpairs.size)
592
+ @hit.segmentpairs.each do |x|
593
+ assert_instance_of(Bio::Sim4::Report::SegmentPair, x)
594
+ end
595
+ end
596
+
597
+ def exec_test_seq1_len(sd)
598
+ assert_equal(284, sd.len)
599
+ end
600
+ private :exec_test_seq1_len
601
+
602
+ def test_seq1
603
+ sd = @hit.seq1
604
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
605
+ assert_equal('mrna4c', sd.entry_id)
606
+ assert_equal('mrna4c', sd.definition)
607
+ assert_equal('sample41-1c.fst', sd.filename)
608
+ exec_test_seq1_len(sd)
609
+ end
610
+
611
+ def test_seq2
612
+ sd = @hit.seq2
613
+ assert_instance_of(Bio::Sim4::Report::SeqDesc, sd)
614
+ assert_equal('genome4', sd.entry_id)
615
+ assert_equal('genome4', sd.definition)
616
+ assert_equal(770, sd.len)
617
+ #assert_equal('sample40-2.fst', sd.filename)
618
+ assert_equal('sample40-2.fst (genome4)', sd.filename)
619
+ end
620
+
621
+ def test_target_def
622
+ assert_equal('genome4', @hit.target_def)
623
+ end
624
+
625
+ def test_target_id
626
+ assert_equal('genome4', @hit.target_id)
627
+ end
628
+
629
+ def test_target_len
630
+ assert_equal(770, @hit.target_len)
631
+ end
632
+ end #class TestSim4ReportHit4
633
+
634
+ class TestSim4ReportSegmentPair4_exon < TestSim4ReportSegmentPair_exon
635
+ def setup
636
+ @exon = TestDataForSim4Report.report4.hits[0].exons[1]
637
+ end
638
+
639
+ def test_align_len
640
+ assert_equal(70, @exon.align_len)
641
+ end
642
+
643
+ def test_direction
644
+ assert_equal("==", @exon.direction)
645
+ end
646
+
647
+ def test_hit_from
648
+ assert_equal(563, @exon.hit_from)
649
+ end
650
+
651
+ def test_hit_to
652
+ assert_equal(630, @exon.hit_to)
653
+ end
654
+
655
+ def test_hseq
656
+ hseq = "ATATGTACTTAGC GGCAACCGAGATTTACTTTCGAAGGACTGTGATGAACCCGCG CCCTTTGAGCGCT"
657
+ assert_equal(hseq, @exon.hseq)
658
+ end
659
+
660
+ def test_midline
661
+ midline = "|||||||||||||-|||||||||||||||||||||||| |||||||||||||||||-|||||||||||||"
662
+ assert_equal(midline, @exon.midline)
663
+ end
664
+
665
+ def test_percent_identity
666
+ #assert_equal(95, @exon.percent_identity)
667
+ assert_equal("95", @exon.percent_identity)
668
+ end
669
+
670
+ def test_qseq
671
+ qseq = "ATATGTACTTAGCTGGCAACCGAGATTTACTTTCGAAGCACTGTGATGAACCCGCGGCCCTTTGAGCGCT"
672
+ assert_equal(qseq, @exon.qseq)
673
+ end
674
+
675
+ def test_query_from
676
+ assert_equal(73, @exon.query_from)
677
+ end
678
+
679
+ def test_query_to
680
+ assert_equal(142, @exon.query_to)
681
+ end
682
+
683
+ def exec_test_seq1_from_to(seg)
684
+ assert_equal(73, seg.from)
685
+ assert_equal(142, seg.to)
686
+ end
687
+ private :exec_test_seq1_from_to
688
+
689
+ def test_seq1
690
+ assert_instance_of(Bio::Sim4::Report::Segment, @exon.seq1)
691
+ assert_equal("ATATGTACTTAGCTGGCAACCGAGATTTACTTTCGAAGCACTGTGATGAACCCGCGGCCCTTTGAGCGCT",
692
+ @exon.seq1.seq)
693
+ exec_test_seq1_from_to(@exon.seq1)
694
+ end
695
+
696
+ def test_seq2
697
+ assert_instance_of(Bio::Sim4::Report::Segment, @exon.seq2)
698
+ assert_equal(563, @exon.seq2.from)
699
+ assert_equal(630, @exon.seq2.to)
700
+ assert_equal("ATATGTACTTAGC GGCAACCGAGATTTACTTTCGAAGGACTGTGATGAACCCGCG CCCTTTGAGCGCT",
701
+ @exon.seq2.seq)
702
+ end
703
+ end #class TestSim4ReportSegmentPair4_exon
704
+
705
+
706
+ class TestSim4ReportSegmentPair4_intron < TestSim4ReportSegmentPair_intron
707
+ def setup
708
+ @intron = TestDataForSim4Report.report4.hits[0].introns[0]
709
+ end
710
+
711
+ def test_hit_from
712
+ assert_equal(425, @intron.hit_from)
713
+ end
714
+
715
+ def test_hit_to
716
+ assert_equal(562, @intron.hit_to)
717
+ end
718
+
719
+ def test_hseq
720
+ hseq = "GTT...GAT"
721
+ assert_equal(hseq, @intron.hseq)
722
+ end
723
+
724
+ def test_midline
725
+ midline = ">>>...>>>"
726
+ assert_equal(midline, @intron.midline)
727
+ end
728
+
729
+ def test_seq2
730
+ assert_instance_of(Bio::Sim4::Report::Segment, @intron.seq2)
731
+ assert_equal(425, @intron.seq2.from)
732
+ assert_equal(562, @intron.seq2.to)
733
+ assert_equal("GTT...GAT", @intron.seq2.seq)
734
+ end
735
+ end #class TestSim4ReportSegmentPair4_intron
736
+
737
+
738
+ class TestSim4ReportSegmentPair4_intron1 < Test::Unit::TestCase
739
+ def setup
740
+ @intron = TestDataForSim4Report.report4.hits[0].introns[1]
741
+ end
742
+
743
+ def test_align_len
744
+ assert_equal(0, @intron.align_len)
745
+ end
746
+
747
+ def test_direction
748
+ assert_equal(nil, @intron.direction)
749
+ end
750
+
751
+ def test_hit_from
752
+ assert_equal(631, @intron.hit_from)
753
+ end
754
+
755
+ def test_hit_to
756
+ assert_equal(699, @intron.hit_to)
757
+ end
758
+
759
+ def test_hseq
760
+ assert_equal("", @intron.hseq)
761
+ end
762
+
763
+ def test_midline
764
+ assert_equal("", @intron.midline)
765
+ end
766
+
767
+ def test_percent_identity
768
+ assert_equal(nil, @intron.percent_identity)
769
+ end
770
+
771
+ def test_qseq
772
+ assert_equal("", @intron.qseq)
773
+ end
774
+
775
+ def test_query_from
776
+ assert_equal(143, @intron.query_from)
777
+ end
778
+
779
+ def test_query_to
780
+ assert_equal(212, @intron.query_to)
781
+ end
782
+
783
+ def test_seq1
784
+ assert_instance_of(Bio::Sim4::Report::Segment, @intron.seq1)
785
+ assert_equal(143, @intron.seq1.from)
786
+ assert_equal(212, @intron.seq1.to)
787
+ assert_equal("", @intron.seq1.seq)
788
+ end
789
+
790
+ def test_seq2
791
+ assert_instance_of(Bio::Sim4::Report::Segment, @intron.seq2)
792
+ assert_equal(631, @intron.seq2.from)
793
+ assert_equal(699, @intron.seq2.to)
794
+ assert_equal("", @intron.seq2.seq)
795
+ end
796
+ end #class TestSim4ReportSegmentPair4_intron1
797
+
798
+
799
+ class TestSim4ReportSeqDesc < Test::Unit::TestCase
800
+ def setup
801
+ @str1 = 'seq1 = c_NC_000011.5_101050001-101075000.fst, 25000 bp'
802
+ @str2 = '>ref|NC_000011.5|NC_000011:c101075000-101050001 Homo sapiens chromosome 11, complete sequence'
803
+
804
+ @seqdesc = Bio::Sim4::Report::SeqDesc.parse(@str1, @str2)
805
+ end
806
+
807
+ def test_entry_id
808
+ assert_equal('ref|NC_000011.5|NC_000011:c101075000-101050001',
809
+ @seqdesc.entry_id)
810
+ end
811
+
812
+ def test_definition
813
+ assert_equal("ref|NC_000011.5|NC_000011:c101075000-101050001 Homo sapiens chromosome 11, complete sequence",
814
+ @seqdesc.definition)
815
+ end
816
+
817
+ def test_len
818
+ assert_equal(25000, @seqdesc.len)
819
+ end
820
+
821
+ def test_filename
822
+ assert_equal('c_NC_000011.5_101050001-101075000.fst', @seqdesc.filename)
823
+ end
824
+
825
+ def test_self_parse
826
+ assert_instance_of(Bio::Sim4::Report::SeqDesc,
827
+ Bio::Sim4::Report::SeqDesc.parse(@str1, @str2))
828
+
829
+ assert_instance_of(Bio::Sim4::Report::SeqDesc,
830
+ Bio::Sim4::Report::SeqDesc.parse(@str1))
831
+ end
832
+
833
+ def test_self_new
834
+ assert_instance_of(Bio::Sim4::Report::SeqDesc,
835
+ Bio::Sim4::Report::SeqDesc.new('SEQID',
836
+ 'SEQDEF',
837
+ 123,
838
+ 'file.sim4'))
839
+ end
840
+ end #class TestSim4ReportSeqDesc
841
+
842
+
843
+ class TestSim4ReportSegment < Test::Unit::TestCase
844
+ def setup
845
+ @seq = "TCTACACATCACTAGCGTGGGTGGGCGGAAAGAGCAGCTCGCCACT CAAGCTAA".freeze
846
+ @segment = Bio::Sim4::Report::Segment.new("123", "176", @seq.dup)
847
+ end
848
+
849
+ def test_from
850
+ assert_equal(123, @segment.from)
851
+ end
852
+
853
+ def test_to
854
+ assert_equal(176, @segment.to)
855
+ end
856
+
857
+ def test_seq
858
+ assert_equal(@seq, @segment.seq)
859
+ end
860
+
861
+ def test_self_new
862
+ assert_instance_of(Bio::Sim4::Report::Segment,
863
+ Bio::Sim4::Report::Segment.new(1,9))
864
+ assert_instance_of(Bio::Sim4::Report::Segment,
865
+ Bio::Sim4::Report::Segment.new(2,4, "ATG"))
866
+ end
867
+ end #class TestSim4ReportSegment
868
+
869
+ end #module Bio