bio 1.4.3.0001 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +39 -33
  3. data/BSDL +22 -0
  4. data/COPYING +2 -2
  5. data/COPYING.ja +36 -36
  6. data/ChangeLog +2404 -1025
  7. data/KNOWN_ISSUES.rdoc +15 -55
  8. data/README.rdoc +17 -23
  9. data/RELEASE_NOTES.rdoc +246 -183
  10. data/Rakefile +3 -2
  11. data/bin/br_biofetch.rb +29 -5
  12. data/bioruby.gemspec +15 -32
  13. data/bioruby.gemspec.erb +10 -20
  14. data/doc/ChangeLog-1.4.3 +1478 -0
  15. data/doc/RELEASE_NOTES-1.4.3.rdoc +204 -0
  16. data/doc/Tutorial.rd +0 -6
  17. data/doc/Tutorial.rd.html +7 -12
  18. data/doc/Tutorial.rd.ja +960 -1064
  19. data/doc/Tutorial.rd.ja.html +977 -1067
  20. data/gemfiles/Gemfile.travis-jruby1.8 +2 -1
  21. data/gemfiles/Gemfile.travis-jruby1.9 +2 -4
  22. data/gemfiles/Gemfile.travis-rbx +13 -0
  23. data/gemfiles/Gemfile.travis-ruby1.8 +2 -1
  24. data/gemfiles/Gemfile.travis-ruby1.9 +2 -4
  25. data/gemfiles/Gemfile.travis-ruby2.2 +9 -0
  26. data/lib/bio.rb +10 -43
  27. data/lib/bio/alignment.rb +8 -14
  28. data/lib/bio/appl/blast.rb +1 -2
  29. data/lib/bio/appl/blast/format0.rb +18 -7
  30. data/lib/bio/appl/blast/remote.rb +0 -9
  31. data/lib/bio/appl/blast/report.rb +1 -1
  32. data/lib/bio/appl/clustalw/report.rb +3 -1
  33. data/lib/bio/appl/genscan/report.rb +1 -2
  34. data/lib/bio/appl/iprscan/report.rb +1 -2
  35. data/lib/bio/appl/meme/mast.rb +4 -4
  36. data/lib/bio/appl/meme/mast/report.rb +1 -1
  37. data/lib/bio/appl/paml/codeml.rb +2 -2
  38. data/lib/bio/appl/paml/codeml/report.rb +1 -0
  39. data/lib/bio/appl/paml/common.rb +1 -1
  40. data/lib/bio/appl/sosui/report.rb +1 -2
  41. data/lib/bio/command.rb +62 -2
  42. data/lib/bio/data/aa.rb +13 -31
  43. data/lib/bio/data/codontable.rb +1 -2
  44. data/lib/bio/db/biosql/biosql_to_biosequence.rb +1 -0
  45. data/lib/bio/db/biosql/sequence.rb +1 -1
  46. data/lib/bio/db/embl/common.rb +1 -1
  47. data/lib/bio/db/embl/embl.rb +5 -4
  48. data/lib/bio/db/embl/format_embl.rb +3 -3
  49. data/lib/bio/db/embl/sptr.rb +9 -1444
  50. data/lib/bio/db/embl/swissprot.rb +12 -29
  51. data/lib/bio/db/embl/trembl.rb +13 -30
  52. data/lib/bio/db/embl/uniprot.rb +12 -29
  53. data/lib/bio/db/embl/uniprotkb.rb +1455 -0
  54. data/lib/bio/db/fasta.rb +17 -0
  55. data/lib/bio/db/fasta/defline.rb +1 -3
  56. data/lib/bio/db/fastq.rb +1 -1
  57. data/lib/bio/db/genbank/ddbj.rb +9 -5
  58. data/lib/bio/db/genbank/refseq.rb +11 -3
  59. data/lib/bio/db/gff.rb +3 -4
  60. data/lib/bio/db/go.rb +5 -6
  61. data/lib/bio/db/kegg/module.rb +4 -5
  62. data/lib/bio/db/kegg/pathway.rb +4 -5
  63. data/lib/bio/db/kegg/reaction.rb +1 -1
  64. data/lib/bio/db/nexus.rb +3 -2
  65. data/lib/bio/db/pdb/pdb.rb +2 -2
  66. data/lib/bio/db/phyloxml/phyloxml_elements.rb +82 -59
  67. data/lib/bio/db/phyloxml/phyloxml_parser.rb +2 -2
  68. data/lib/bio/db/phyloxml/phyloxml_writer.rb +1 -2
  69. data/lib/bio/db/sanger_chromatogram/chromatogram.rb +1 -2
  70. data/lib/bio/db/transfac.rb +1 -1
  71. data/lib/bio/io/das.rb +40 -41
  72. data/lib/bio/io/fastacmd.rb +0 -16
  73. data/lib/bio/io/fetch.rb +111 -55
  74. data/lib/bio/io/flatfile/buffer.rb +4 -5
  75. data/lib/bio/io/hinv.rb +2 -3
  76. data/lib/bio/io/ncbirest.rb +43 -6
  77. data/lib/bio/io/pubmed.rb +76 -81
  78. data/lib/bio/io/togows.rb +33 -10
  79. data/lib/bio/map.rb +1 -1
  80. data/lib/bio/pathway.rb +1 -1
  81. data/lib/bio/sequence/compat.rb +1 -1
  82. data/lib/bio/sequence/na.rb +63 -12
  83. data/lib/bio/shell.rb +0 -2
  84. data/lib/bio/shell/core.rb +5 -6
  85. data/lib/bio/shell/interface.rb +3 -4
  86. data/lib/bio/shell/irb.rb +1 -2
  87. data/lib/bio/shell/plugin/entry.rb +2 -3
  88. data/lib/bio/shell/plugin/seq.rb +7 -6
  89. data/lib/bio/shell/setup.rb +1 -2
  90. data/lib/bio/tree.rb +2 -2
  91. data/lib/bio/util/contingency_table.rb +0 -2
  92. data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +2 -2
  93. data/lib/bio/util/sirna.rb +76 -16
  94. data/lib/bio/version.rb +8 -9
  95. data/sample/benchmark_clustalw_report.rb +47 -0
  96. data/sample/biofetch.rb +248 -151
  97. data/setup.rb +6 -7
  98. data/test/data/clustalw/example1-seqnos.aln +58 -0
  99. data/test/network/bio/appl/blast/test_remote.rb +1 -15
  100. data/test/network/bio/appl/test_blast.rb +0 -12
  101. data/test/network/bio/io/test_pubmed.rb +49 -0
  102. data/test/network/bio/io/test_togows.rb +0 -1
  103. data/test/network/bio/test_command.rb +65 -2
  104. data/test/unit/bio/appl/bl2seq/test_report.rb +0 -1
  105. data/test/unit/bio/appl/blast/test_report.rb +110 -48
  106. data/test/unit/bio/appl/clustalw/test_report.rb +67 -51
  107. data/test/unit/bio/appl/sim4/test_report.rb +46 -17
  108. data/test/unit/bio/appl/test_blast.rb +2 -2
  109. data/test/unit/bio/db/embl/test_embl.rb +0 -1
  110. data/test/unit/bio/db/embl/test_embl_rel89.rb +0 -1
  111. data/test/unit/bio/db/embl/{test_sptr.rb → test_uniprotkb.rb} +111 -115
  112. data/test/unit/bio/db/embl/{test_uniprot_new_part.rb → test_uniprotkb_new_part.rb} +11 -11
  113. data/test/unit/bio/db/genbank/test_genbank.rb +10 -4
  114. data/test/unit/bio/db/pdb/test_pdb.rb +14 -8
  115. data/test/unit/bio/db/test_fasta.rb +41 -1
  116. data/test/unit/bio/db/test_fastq.rb +14 -4
  117. data/test/unit/bio/db/test_gff.rb +2 -2
  118. data/test/unit/bio/db/test_phyloxml.rb +30 -30
  119. data/test/unit/bio/db/test_phyloxml_writer.rb +2 -2
  120. data/test/unit/bio/io/flatfile/test_autodetection.rb +1 -2
  121. data/test/unit/bio/io/flatfile/test_buffer.rb +7 -1
  122. data/test/unit/bio/io/flatfile/test_splitter.rb +1 -1
  123. data/test/unit/bio/io/test_togows.rb +3 -2
  124. data/test/unit/bio/sequence/test_dblink.rb +1 -1
  125. data/test/unit/bio/sequence/test_na.rb +3 -1
  126. data/test/unit/bio/test_alignment.rb +1 -2
  127. data/test/unit/bio/test_command.rb +5 -4
  128. data/test/unit/bio/test_db.rb +4 -2
  129. data/test/unit/bio/test_pathway.rb +25 -10
  130. data/test/unit/bio/util/test_sirna.rb +22 -22
  131. metadata +656 -1430
  132. data/doc/KEGG_API.rd +0 -1843
  133. data/doc/KEGG_API.rd.ja +0 -1834
  134. data/extconf.rb +0 -2
  135. data/lib/bio/appl/blast/ddbj.rb +0 -131
  136. data/lib/bio/db/kegg/taxonomy.rb +0 -280
  137. data/lib/bio/io/dbget.rb +0 -194
  138. data/lib/bio/io/ddbjrest.rb +0 -344
  139. data/lib/bio/io/ddbjxml.rb +0 -458
  140. data/lib/bio/io/ebisoap.rb +0 -158
  141. data/lib/bio/io/ensembl.rb +0 -229
  142. data/lib/bio/io/higet.rb +0 -73
  143. data/lib/bio/io/keggapi.rb +0 -363
  144. data/lib/bio/io/ncbisoap.rb +0 -156
  145. data/lib/bio/io/soapwsdl.rb +0 -119
  146. data/lib/bio/shell/plugin/keggapi.rb +0 -181
  147. data/lib/bio/shell/plugin/soap.rb +0 -87
  148. data/sample/dbget +0 -37
  149. data/sample/demo_ddbjxml.rb +0 -212
  150. data/sample/demo_kegg_taxonomy.rb +0 -92
  151. data/sample/demo_keggapi.rb +0 -502
  152. data/sample/psortplot_html.rb +0 -214
  153. data/test/network/bio/io/test_ddbjrest.rb +0 -47
  154. data/test/network/bio/io/test_ensembl.rb +0 -230
  155. data/test/network/bio/io/test_soapwsdl.rb +0 -53
  156. data/test/unit/bio/io/test_ddbjxml.rb +0 -81
  157. data/test/unit/bio/io/test_ensembl.rb +0 -111
  158. data/test/unit/bio/io/test_soapwsdl.rb +0 -33
@@ -1,5 +1,5 @@
1
1
  #
2
- # test/unit/bio/db/embl/test_uniprot_new_part.rb - Unit test for Bio::UniProt for new file formats using part of psudo entries
2
+ # test/unit/bio/db/embl/test_uniprotkb_new_part.rb - Unit test for Bio::UniProtKB for new file formats using part of psudo entries
3
3
  #
4
4
  # Copyright:: Copyright (C) 2011 Naohisa Goto <ng@bioruby.org>
5
5
  # License:: The Ruby License
@@ -12,14 +12,14 @@ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
12
12
 
13
13
  # libraries needed for the tests
14
14
  require 'test/unit'
15
- require 'bio/db/embl/uniprot'
15
+ require 'bio/db/embl/uniprotkb'
16
16
 
17
17
  module Bio
18
- class TestUniProt_ID_since_rel9_0 < Test::Unit::TestCase
18
+ class TestUniProtKB_ID_since_rel9_0 < Test::Unit::TestCase
19
19
 
20
20
  def setup
21
21
  text = "ID ABC_DEFGH Reviewed; 256 AA.\n"
22
- @obj = Bio::UniProt.new(text)
22
+ @obj = Bio::UniProtKB.new(text)
23
23
  end
24
24
 
25
25
  def test_id_line
@@ -55,9 +55,9 @@ module Bio
55
55
  def test_molecule
56
56
  assert_nil(@obj.molecule)
57
57
  end
58
- end #class TestUniProt_ID_since_rel9_0
58
+ end #class TestUniProtKB_ID_since_rel9_0
59
59
 
60
- class TestUniProt_DE_since_rel14_0 < Test::Unit::TestCase
60
+ class TestUniProtKB_DE_since_rel14_0 < Test::Unit::TestCase
61
61
 
62
62
  def setup
63
63
  text = <<the_end_of_the_text
@@ -87,7 +87,7 @@ DE Short=CPAC;
87
87
  DE Flags: Precursor; Fragment;
88
88
  the_end_of_the_text
89
89
 
90
- @obj = Bio::UniProt.new(text)
90
+ @obj = Bio::UniProtKB.new(text)
91
91
  end
92
92
 
93
93
  def test_private_parse_DE_line_rel14
@@ -165,9 +165,9 @@ the_end_of_the_text
165
165
  assert_equal(expected, @obj.synonyms)
166
166
  end
167
167
 
168
- end #class TestUniProt_DE_since_rel14_0
168
+ end #class TestUniProtKB_DE_since_rel14_0
169
169
 
170
- class TestUniProt_CC_WEB_RESOURCE_since_rel12_2 < Test::Unit::TestCase
170
+ class TestUniProtKB_CC_WEB_RESOURCE_since_rel12_2 < Test::Unit::TestCase
171
171
 
172
172
  def setup
173
173
  text = <<the_end_of_the_text
@@ -182,7 +182,7 @@ CC -!- WEB RESOURCE: Name=BioRuby Wiki site;
182
182
  CC URL="http://bioruby.open-bio.org/wiki/";
183
183
  the_end_of_the_text
184
184
 
185
- @obj = Bio::UniProt.new(text)
185
+ @obj = Bio::UniProtKB.new(text)
186
186
  end
187
187
 
188
188
  def test_cc_web_resource
@@ -203,6 +203,6 @@ the_end_of_the_text
203
203
 
204
204
  assert_equal(expected, @obj.cc('WEB RESOURCE'))
205
205
  end
206
- end #class TestUniProt_CC_WEB_RESOURCE_since_rel12_2
206
+ end #class TestUniProtKB_CC_WEB_RESOURCE_since_rel12_2
207
207
 
208
208
  end #module Bio
@@ -202,7 +202,7 @@ module Bio
202
202
  "Saccharomycetaceae",
203
203
  "Saccharomyces"]
204
204
  assert_equal(expected, @obj.classification)
205
- end
205
+ end
206
206
 
207
207
  def test_strandedness
208
208
  assert_equal(nil, @obj.strandedness)
@@ -222,10 +222,10 @@ module Bio
222
222
  expected_topology = "linear"
223
223
  expected_strandedness = nil
224
224
  expected_keywords = []
225
- expected_sequence_version = "1"
226
- expected_date_modified = "2010-03-23"
225
+ expected_sequence_version = 1
226
+ expected_date_modified = Date.parse("2010-03-23")
227
227
  expected_definition = "Saccharomyces cerevisiae TCP1-beta gene, partial cds; and Axl2p (AXL2) and Rev7p (REV7) genes, complete cds."
228
- expected_species = []
228
+ expected_species = 'Saccharomyces cerevisiae'
229
229
  expected_classification= ["Eukaryota", "Fungi", "Dikarya", "Ascomycota", "Saccharomyceta", "Saccharomycotina", "Saccharomycetes", "Saccharomycetales", "Saccharomycetaceae", "Saccharomyces"]
230
230
  expected_comments = ""
231
231
  expected_references = [{
@@ -353,9 +353,15 @@ module Bio
353
353
  seqids = seq.other_seqids.first
354
354
  actual_other_seqids = [seqids.id, seqids.database, seqids.secondary_ids]
355
355
  assert_equal(expected_other_seqids, actual_other_seqids)
356
+ assert_equal(expected_molecule_type, seq.molecule_type)
356
357
  assert_equal(expected_division, seq.division)
358
+ assert_equal(expected_topology, seq.topology)
357
359
  assert_equal(expected_strandedness, seq.strandedness)
358
360
  assert_equal(expected_keywords, seq.keywords)
361
+ assert_equal(expected_sequence_version, seq.sequence_version)
362
+ assert_equal(expected_date_modified, seq.date_modified)
363
+ assert_equal(expected_definition, seq.definition)
364
+ assert_equal(expected_species, seq.species)
359
365
  assert_equal(expected_classification, seq.classification)
360
366
  assert_equal(expected_comments, seq.comments)
361
367
  refs = seq.references
@@ -6,7 +6,6 @@
6
6
  #
7
7
  # License:: The Ruby License
8
8
  #
9
- # $Id:$
10
9
  #
11
10
 
12
11
  # loading helper routine for testing bioruby
@@ -2517,7 +2516,8 @@ EOS
2517
2516
  # test of Bio::PDB::Record::ATOM
2518
2517
  class TestResidue < Test::Unit::TestCase
2519
2518
  def setup
2520
- @res = Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = "", chain = nil)
2519
+ # resName="ALA",resSeq = 7, iCode = "", chain = nil
2520
+ @res = Bio::PDB::Residue.new("ALA", 7, "", nil)
2521
2521
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N"))
2522
2522
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"))
2523
2523
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C"))
@@ -2615,14 +2615,16 @@ expected = [{:serial=>1, :name=>"N", :altLoc=>" ", :resName=>"ALA", :chainID=>"A
2615
2615
  assert_equal(expected,actual)
2616
2616
  end
2617
2617
  def test_update_resudue_id
2618
- res = Bio::PDB::Residue.new(resName="ALA", resSeq = nil, iCode = nil, chain = nil)
2618
+ # resName="ALA", resSeq = nil, iCode = nil, chain = nil
2619
+ res = Bio::PDB::Residue.new("ALA", nil, nil, nil)
2619
2620
  assert_equal(nil, res.residue_id)
2620
2621
  end
2621
2622
  end
2622
2623
 
2623
2624
  class TestHeterogen < Test::Unit::TestCase
2624
2625
  def setup
2625
- @res = Bio::PDB::Heterogen.new(resName="EDO",resSeq = 701, iCode = "", chain = nil)
2626
+ # resName="EDO",resSeq = 701, iCode = "", chain = nil
2627
+ @res = Bio::PDB::Heterogen.new("EDO", 701, "", nil)
2626
2628
  @res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30583 O1 EDO A 701 -1.516 -26.859 49.587 1.00 35.20 O"))
2627
2629
  @res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30584 C2 EDO A 701 -0.275 -28.124 51.219 1.00 34.49 C"))
2628
2630
  @res.addAtom(Bio::PDB::Record::HETATM.new.initialize_from_string("HETATM30585 O2 EDO A 701 -1.442 -28.941 51.167 1.00 33.95 O"))
@@ -2716,7 +2718,8 @@ expected = [{:z=>49.587, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy
2716
2718
  assert_equal(expected,actual)
2717
2719
  end
2718
2720
  def test_update_resudue_id
2719
- res = Bio::PDB::Heterogen.new(resName="EDD", resSeq = nil, iCode = nil, chain = nil)
2721
+ # resName="EDD", resSeq = nil, iCode = nil, chain = nil
2722
+ res = Bio::PDB::Heterogen.new("EDD", nil, nil, nil)
2720
2723
  assert_equal(nil, res.residue_id)
2721
2724
  end
2722
2725
  end
@@ -2770,13 +2773,15 @@ expected = [{:z=>49.587, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy
2770
2773
  assert_equal(expected, actual)
2771
2774
  end
2772
2775
  def test_addResidue
2773
- assert_nothing_raised{ @chain.addResidue(Bio::PDB::Residue.new(resName="ALA",resSeq = 9, iCode = 1, chain = @chain))}
2776
+ # resName="ALA",resSeq = 9, iCode = 1, chain = @chain
2777
+ assert_nothing_raised{ @chain.addResidue(Bio::PDB::Residue.new("ALA", 9, 1, @chain))}
2774
2778
  end
2775
2779
  def test_aaseq
2776
2780
  assert_equal("AAA", @chain.aaseq)
2777
2781
  end
2778
2782
  def test_addLigand
2779
- assert_nothing_raised{ @chain.addLigand(Bio::PDB::Heterogen.new(resName="EDD",resSeq = 10, iCode = 2, chain = @chain)) }
2783
+ # resName="EDD",resSeq = 10, iCode = 2, chain = @chain
2784
+ assert_nothing_raised{ @chain.addLigand(Bio::PDB::Heterogen.new("EDD", 10, 2, @chain)) }
2780
2785
  end
2781
2786
  def test_atom_seq
2782
2787
  assert_equal("AAA", @chain.atom_seq)
@@ -2940,7 +2945,8 @@ expected = [{:z=>49.587, :resName=>"EDO", :altLoc=>" ", :resSeq=>701, :occupancy
2940
2945
  #this class tests Bio::PDB::Utils with Bio::PDB::Residue class witch is generated directly
2941
2946
  class TestUtils < Test::Unit::TestCase
2942
2947
  def setup
2943
- @res = Bio::PDB::Residue.new(resName="ALA",resSeq = 7, iCode = "", chain = nil)
2948
+ # resName="ALA",resSeq = 7, iCode = "", chain = nil
2949
+ @res = Bio::PDB::Residue.new("ALA", 7, "", nil)
2944
2950
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 1 N ALA A 7 23.484 -35.866 44.510 1.00 28.52 N"))
2945
2951
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 2 CA ALA A 7 23.849 -34.509 44.904 1.00 27.89 C"))
2946
2952
  @res.addAtom(Bio::PDB::Record::ATOM.new.initialize_from_string("ATOM 3 C ALA A 7 23.102 -34.082 46.159 1.00 26.68 C"))
@@ -95,7 +95,7 @@ END
95
95
  def test_entry_id
96
96
  assert_equal('sce:YBR160W', @obj.entry_id)
97
97
  end
98
-
98
+
99
99
  def test_acc_version
100
100
  assert_equal(nil, @obj.acc_version)
101
101
  end
@@ -109,6 +109,10 @@ END
109
109
  data = "sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]"
110
110
  assert_equal(data, @obj.definition)
111
111
  end
112
+
113
+ def test_first_name
114
+ assert_equal('sce:YBR160W', @obj.first_name)
115
+ end
112
116
 
113
117
  def test_data
114
118
  data = "\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n"
@@ -225,7 +229,43 @@ END
225
229
  def test_acc_version
226
230
  assert_equal('AAV50056.1', @obj.acc_version)
227
231
  end
232
+
233
+ def test_first_name
234
+ assert_equal('gi|55416189|gb|AAV50056.1|', @obj.first_name)
235
+ end
228
236
 
229
237
  end # class TestFastaFormat
230
238
 
239
+
240
+ class TestFastaFirstName < Test::Unit::TestCase
241
+ def test_first_name1
242
+ data = ">abc def\nATGC"
243
+ assert_equal 'abc', Bio::FastaFormat.new(data).first_name
244
+ end
245
+
246
+ def test_first_name_multi_identifier
247
+ data = ">gi|398365175|ref|NP_009718.3| Cdc28p [Saccharomyces cerevisiae S288c] #=> 'gi|398365175|ref|NP_009718.3|\nATGCTG"
248
+ assert_equal 'gi|398365175|ref|NP_009718.3|', Bio::FastaFormat.new(data).first_name
249
+ end
250
+
251
+ def test_first_name_single_worded_defintion
252
+ data = ">abc\nATGC"
253
+ assert_equal 'abc', Bio::FastaFormat.new(data).first_name
254
+ end
255
+
256
+ def test_no_definition
257
+ data = ">\nATGC"
258
+ assert_equal '', Bio::FastaFormat.new(data).first_name
259
+ end
260
+
261
+ def test_tabbed_defintion
262
+ data = ">gabc\tdef\nATGC"
263
+ assert_equal 'gabc', Bio::FastaFormat.new(data).first_name
264
+ end
265
+
266
+ def test_space_before_first_name
267
+ data = "> gabcds\tdef\nATGC"
268
+ assert_equal 'gabcds', Bio::FastaFormat.new(data).first_name
269
+ end
270
+ end
231
271
  end
@@ -795,7 +795,7 @@ _9_
795
795
  ERRORS = [ Bio::Fastq::Error::Long_qual.new ]
796
796
  end #class TestFastq_error_short_qual
797
797
 
798
- class TestFastq_error_spaces < Test::Unit::TestCase
798
+ module TemplateTestFastq_error_spaces
799
799
  include TestFastq_error
800
800
 
801
801
  FILENAME = 'error_spaces.fastq'
@@ -821,22 +821,32 @@ _9_
821
821
  end
822
822
  end
823
823
  end
824
+ end #module TemplateTestFastq_error_spaces
825
+
826
+ class TestFastq_error_spaces < Test::Unit::TestCase
827
+ include TemplateTestFastq_error_spaces
824
828
  end #class TestFastq_error_spaces
825
829
 
826
- class TestFastq_error_tabs < TestFastq_error_spaces
830
+ class TestFastq_error_tabs < Test::Unit::TestCase
831
+ include TemplateTestFastq_error_spaces
827
832
  FILENAME = 'error_tabs.fastq'
828
833
  end #class TestFastq_error_tabs
829
834
 
830
- class TestFastq_error_trunc_at_plus < Test::Unit::TestCase
835
+ module TemplateTestFastq_error_trunc_at_plus
831
836
  include TestFastq_error
832
837
 
833
838
  FILENAME = 'error_trunc_at_plus.fastq'
834
839
  PRE_SKIP = 4
835
840
  POST_SKIP = 0
836
841
  ERRORS = [ Bio::Fastq::Error::No_qual.new ]
842
+ end #module TemplateTestFastq_error_trunc_at_plus
843
+
844
+ class TestFastq_error_trunc_at_plus < Test::Unit::TestCase
845
+ include TemplateTestFastq_error_trunc_at_plus
837
846
  end #class TestFastq_error_trunc_at_plus
838
847
 
839
- class TestFastq_error_trunc_at_qual < TestFastq_error_trunc_at_plus
848
+ class TestFastq_error_trunc_at_qual < Test::Unit::TestCase
849
+ include TemplateTestFastq_error_trunc_at_plus
840
850
  FILENAME = 'error_trunc_at_qual.fastq'
841
851
  end #class TestFastq_error_trunc_at_qual
842
852
 
@@ -268,7 +268,7 @@ END_OF_DATA
268
268
  assert_equal(val_Target, @obj.attribute('Target'))
269
269
  assert_equal('0.0003', @obj.attribute('E_value'))
270
270
  val_Align0 = Bio::GFF::GFF2::Record::Value.new(['101', '11'])
271
- val_Align1 = Bio::GFF::GFF2::Record::Value.new(['179', '36'])
271
+ #val_Align1 = Bio::GFF::GFF2::Record::Value.new(['179', '36'])
272
272
  assert_equal(val_Align0, @obj.attribute('Align'))
273
273
  val_Comment = Bio::GFF::GFF2::Record::Value.new(["Please ignore this \"Comment\" attribute; Escape \x1a\037 and \\\t\r\n\f\b\a\e\v; This is test.", "123", "4.56e-34", "Test for freetext"])
274
274
  assert_equal(val_Comment, @obj.attribute('Comment'))
@@ -285,7 +285,7 @@ END_OF_DATA
285
285
  assert_equal(val_Target, @obj.get_attribute('Target'))
286
286
  assert_equal('0.0003', @obj.get_attribute('E_value'))
287
287
  val_Align0 = Bio::GFF::GFF2::Record::Value.new(['101', '11'])
288
- val_Align1 = Bio::GFF::GFF2::Record::Value.new(['179', '36'])
288
+ #val_Align1 = Bio::GFF::GFF2::Record::Value.new(['179', '36'])
289
289
  assert_equal(val_Align0, @obj.get_attribute('Align'))
290
290
  val_Comment = Bio::GFF::GFF2::Record::Value.new(["Please ignore this \"Comment\" attribute; Escape \x1a\037 and \\\t\r\n\f\b\a\e\v; This is test.", "123", "4.56e-34", "Test for freetext"])
291
291
  assert_equal(val_Comment, @obj.get_attribute('Comment'))
@@ -36,43 +36,43 @@ module Bio
36
36
 
37
37
  module TestPhyloXMLData
38
38
 
39
- PHYLOXML_TEST_DATA = Pathname.new(File.join(BioRubyTestDataPath, 'phyloxml')).cleanpath.to_s
39
+ PHYLOXML_TEST_DATA = Pathname.new(File.join(BioRubyTestDataPath, 'phyloxml')).cleanpath.to_s
40
40
 
41
- def self.example_xml
42
- File.join PHYLOXML_TEST_DATA, 'phyloxml_examples.xml'
43
- #If you want to test the output of writer, then do this:
44
- #File.join PHYLOXML_TEST_DATA, 'phyloxml_examples_test.xml'
45
- # But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
46
- end
41
+ def self.example_xml
42
+ File.join PHYLOXML_TEST_DATA, 'phyloxml_examples.xml'
43
+ #If you want to test the output of writer, then do this:
44
+ #File.join PHYLOXML_TEST_DATA, 'phyloxml_examples_test.xml'
45
+ # But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
46
+ end
47
47
 
48
- def self.made_up_xml
49
- File.join PHYLOXML_TEST_DATA, 'made_up.xml'
50
- #If you want to test the output of writer, then do this:
51
- #File.join PHYLOXML_TEST_DATA, 'made_up_test.xml'
52
- # But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
53
- end
48
+ def self.made_up_xml
49
+ File.join PHYLOXML_TEST_DATA, 'made_up.xml'
50
+ #If you want to test the output of writer, then do this:
51
+ #File.join PHYLOXML_TEST_DATA, 'made_up_test.xml'
52
+ # But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
53
+ end
54
54
 
55
- def self.metazoa_xml
56
- File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_metazoa.xml'
57
- end
55
+ def self.metazoa_xml
56
+ File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_metazoa.xml'
57
+ end
58
58
 
59
- def self.mollusca_xml
60
- File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca.xml'
61
- end
59
+ def self.mollusca_xml
60
+ File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca.xml'
61
+ end
62
62
 
63
- def self.life_xml
64
- File.join PHYLOXML_TEST_DATA, 'tol_life_on_earth_1.xml'
65
- end
63
+ def self.life_xml
64
+ File.join PHYLOXML_TEST_DATA, 'tol_life_on_earth_1.xml'
65
+ end
66
66
 
67
- def self.dollo_xml
68
- File.join PHYLOXML_TEST_DATA, 'o_tol_332_d_dollo.xml'
69
- end
67
+ def self.dollo_xml
68
+ File.join PHYLOXML_TEST_DATA, 'o_tol_332_d_dollo.xml'
69
+ end
70
70
 
71
- def self.mollusca_short_xml
72
- File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca_short.xml'
73
- end
71
+ def self.mollusca_short_xml
72
+ File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca_short.xml'
73
+ end
74
74
 
75
- end #end module TestPhyloXMLData
75
+ end #end module TestPhyloXMLData
76
76
 
77
77
 
78
78
 
@@ -100,7 +100,7 @@ end #end module TestPhyloXMLData
100
100
  end
101
101
 
102
102
  def test_new
103
- str = File.read(TestPhyloXMLData.example_xml)
103
+ str = File.open(TestPhyloXMLData.example_xml, "rb") { |f| f.read }
104
104
  assert_instance_of(Bio::PhyloXML::Parser,
105
105
  phyloxml = Bio::PhyloXML::Parser.new(str))
106
106
  common_test_next_tree(phyloxml)
@@ -172,7 +172,7 @@ module Bio
172
172
  writer.write(tree)
173
173
 
174
174
  assert_nothing_thrown do
175
- tree2 = Bio::PhyloXML::Parser.open(filename) { |px| true }
175
+ Bio::PhyloXML::Parser.open(filename) { |px| true }
176
176
  end
177
177
 
178
178
  #File.delete(filename)
@@ -192,7 +192,7 @@ module Bio
192
192
  writer.write(@tree)
193
193
 
194
194
  assert_nothing_thrown do
195
- tree2 = Bio::PhyloXML::Parser.open(filename) { |px| true }
195
+ Bio::PhyloXML::Parser.open(filename) { |px| true }
196
196
  end
197
197
 
198
198
  #File.delete(filename)
@@ -5,7 +5,6 @@
5
5
  #
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id:$
9
8
  #
10
9
 
11
10
  # loading helper routine for testing bioruby
@@ -349,7 +348,7 @@ __END_OF_TEXT__
349
348
 
350
349
  def test_fastq
351
350
  fn = File.join(TestDataPath, 'fastq', 'longreads_original_sanger.fastq')
352
- text = File.read(fn, length=300)
351
+ text = File.read(fn, 300)
353
352
  assert_equal(Bio::Fastq, @ad.autodetect(text))
354
353
  end
355
354
 
@@ -184,7 +184,13 @@ module Bio::TestFlatFileBufferedInputStream
184
184
  assert_equal(TestDataFastaFormat01, obj.path)
185
185
  obj2 = obj
186
186
  end
187
- assert_raise(IOError) { obj2.close }
187
+ # Since Ruby 2.3.0, calling IO#close to closed IO object is allowed
188
+ # without error.
189
+ if RUBY_VERSION >= "2.3.0"
190
+ assert_nothing_raised { obj2.close }
191
+ else
192
+ assert_raise(IOError) { obj2.close }
193
+ end
188
194
  end
189
195
  end #class TestBufferedInputStreamClassMethod
190
196
 
@@ -251,7 +251,7 @@ __END_OF_DATA__
251
251
  flag_header = add_header_line(line)
252
252
  end
253
253
  unless flag_header then
254
- r = add_line(line)
254
+ add_line(line)
255
255
  end
256
256
  end
257
257
  end