bio 1.6.0.pre.20181210 → 2.0.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.
@@ -6,16 +6,24 @@ branches:
6
6
  clone_depth: 10
7
7
  install:
8
8
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
9
+ - SET BUNDLE_GEMFILE=gemfiles/Gemfile.windows
10
+ - bundle install
11
+ - bundle exec rake regemspec
12
+ - bundle exec rake gem
13
+ - bundle exec gem install pkg/bio-*.gem
14
+ - echo gem "bio" >> gemfiles\Gemfile.windows
15
+ build: off
16
+ before_test:
9
17
  - ruby --version
10
18
  - gem --version
11
- - gem build bioruby.gemspec
12
- - gem install *.gem
13
- build: off
19
+ - bundle --version
20
+ test_script:
21
+ - bundle exec rake gem-test
14
22
  environment:
15
23
  matrix:
16
- - ruby_version: "21"
17
- - ruby_version: "21-x64"
18
- - ruby_version: "22"
19
- - ruby_version: "22-x64"
20
24
  - ruby_version: "23"
21
25
  - ruby_version: "23-x64"
26
+ - ruby_version: "24"
27
+ - ruby_version: "24-x64"
28
+ - ruby_version: "25"
29
+ - ruby_version: "25-x64"
@@ -3,7 +3,7 @@
3
3
  #
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'bio'
6
- s.version = "1.6.0.pre.20181211"
6
+ s.version = "2.0.0"
7
7
 
8
8
  s.author = "BioRuby project"
9
9
  s.email = "staff@bioruby.org"
@@ -54,6 +54,7 @@ Gem::Specification.new do |s|
54
54
  "gemfiles/Gemfile.travis-rbx",
55
55
  "gemfiles/Gemfile.travis-ruby1.8",
56
56
  "gemfiles/Gemfile.travis-ruby1.9",
57
+ "gemfiles/Gemfile.windows",
57
58
  "gemfiles/modify-Gemfile.rb",
58
59
  "gemfiles/prepare-gemspec.rb",
59
60
  "lib/bio.rb",
@@ -69,7 +70,6 @@ Gem::Specification.new do |s|
69
70
  "lib/bio/appl/blast/rexml.rb",
70
71
  "lib/bio/appl/blast/rpsblast.rb",
71
72
  "lib/bio/appl/blast/wublast.rb",
72
- "lib/bio/appl/blast/xmlparser.rb",
73
73
  "lib/bio/appl/blat/report.rb",
74
74
  "lib/bio/appl/clustalw.rb",
75
75
  "lib/bio/appl/clustalw/report.rb",
@@ -316,7 +316,6 @@ Gem::Specification.new do |s|
316
316
  "sample/test_restriction_enzyme_long.rb",
317
317
  "sample/tfastx2tab.rb",
318
318
  "sample/vs-genes.rb",
319
- "setup.rb",
320
319
  "test/bioruby_test_helper.rb",
321
320
  "test/data/HMMER/hmmpfam.out",
322
321
  "test/data/HMMER/hmmsearch.out",
@@ -452,6 +451,7 @@ Gem::Specification.new do |s|
452
451
  "test/network/bio/appl/blast/test_remote.rb",
453
452
  "test/network/bio/appl/test_blast.rb",
454
453
  "test/network/bio/appl/test_pts1.rb",
454
+ "test/network/bio/db/kegg/test_genes_hsa7422.rb",
455
455
  "test/network/bio/io/test_pubmed.rb",
456
456
  "test/network/bio/io/test_togows.rb",
457
457
  "test/network/bio/test_command.rb",
@@ -3,8 +3,6 @@ source "https://rubygems.org"
3
3
  gem "rake"
4
4
  gem "rdoc"
5
5
 
6
- gem "xmlparser"
7
-
8
6
  platforms :rbx do
9
7
  gem 'racc'
10
8
  gem 'rubysl', '~> 2.0'
@@ -4,5 +4,3 @@ gem "rake", "~>10.4"
4
4
  # rdoc 4.3.0 requires Ruby >= 1.9.3
5
5
  gem "rdoc", "~>4.2.0"
6
6
 
7
- gem "xmlparser", "~>0.7.2"
8
-
@@ -3,5 +3,3 @@ source "https://rubygems.org"
3
3
  gem "rake"
4
4
  gem "rdoc"
5
5
 
6
- gem "xmlparser"
7
-
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rake"
4
+ gem "rdoc"
5
+ gem "test-unit"
6
+
@@ -43,18 +43,20 @@ class Report
43
43
  #--
44
44
  # require lines moved here to avoid circular require
45
45
  #++
46
- require 'bio/appl/blast/xmlparser'
47
46
  require 'bio/appl/blast/rexml'
48
47
  require 'bio/appl/blast/format8'
49
48
 
49
+ #--
50
+ # loading bio-blast-xmlparser plugin if available
51
+ #++
52
+ begin
53
+ require 'bio-blast-xmlparser'
54
+ rescue LoadError
55
+ end
56
+
50
57
  # for Bio::FlatFile support (only for XML data)
51
58
  DELIMITER = RS = "</BlastOutput>\n"
52
59
 
53
- # Specify to use XMLParser to parse XML (-m 7) output.
54
- def self.xmlparser(data)
55
- self.new(data, :xmlparser)
56
- end
57
-
58
60
  # Specify to use REXML to parse XML (-m 7) output.
59
61
  def self.rexml(data)
60
62
  self.new(data, :rexml)
@@ -67,7 +69,7 @@ class Report
67
69
 
68
70
  def auto_parse(data)
69
71
  if /<?xml/.match(data[/.*/])
70
- if defined?(XMLParser)
72
+ if defined? xmlparser_parse
71
73
  xmlparser_parse(data)
72
74
  @reports = blastxml_split_reports
73
75
  else
@@ -87,7 +89,11 @@ class Report
87
89
  @parameters = {}
88
90
  case parser
89
91
  when :xmlparser # format 7
90
- xmlparser_parse(data)
92
+ if defined? xmlparser_parse
93
+ xmlparser_parse(data)
94
+ else
95
+ raise NameError, "xmlparser_parse does not defined"
96
+ end
91
97
  @reports = blastxml_split_reports
92
98
  when :rexml # format 7
93
99
  rexml_parse(data)
@@ -383,6 +389,32 @@ class Report
383
389
  attr_reader :reports
384
390
 
385
391
  private
392
+ # set parameter of the key as val
393
+ def xml_set_parameter(key, val)
394
+ #labels = {
395
+ # 'matrix' => 'Parameters_matrix',
396
+ # 'expect' => 'Parameters_expect',
397
+ # 'include' => 'Parameters_include',
398
+ # 'sc-match' => 'Parameters_sc-match',
399
+ # 'sc-mismatch' => 'Parameters_sc-mismatch',
400
+ # 'gap-open' => 'Parameters_gap-open',
401
+ # 'gap-extend' => 'Parameters_gap-extend',
402
+ # 'filter' => 'Parameters_filter',
403
+ # 'pattern' => 'Parameters_pattern',
404
+ # 'entrez-query' => 'Parameters_entrez-query',
405
+ #}
406
+ k = key.sub(/\AParameters\_/, '')
407
+ @parameters[k] =
408
+ case k
409
+ when 'expect', 'include'
410
+ val.to_f
411
+ when /\Agap\-/, /\Asc\-/
412
+ val.to_i
413
+ else
414
+ val
415
+ end
416
+ end
417
+
386
418
  # (private method)
387
419
  # In new BLAST XML (blastall >= 2.2.14), results of multiple queries
388
420
  # are stored in <Iteration>. This method splits iterations into
@@ -210,6 +210,20 @@ class KEGG
210
210
  private :strings_as_hash
211
211
  end #module StringsAsHash
212
212
 
213
+ # This module provides diseases_as_hash method.
214
+ #
215
+ # Bio::KEGG::* internal use only.
216
+ module DiseasesAsHash
217
+ include StringsAsHash
218
+ # Returns a Hash of the disease ID and its definition
219
+ def diseases_as_hash
220
+ unless (defined? @diseases_as_hash) && @diseases_as_hash
221
+ @diseases_as_hash = strings_as_hash(diseases_as_strings)
222
+ end
223
+ @diseases_as_hash
224
+ end
225
+ end #module DiseasesAsHash
226
+
213
227
  end #module Common
214
228
  end #class KEGG
215
229
  end #module Bio
@@ -107,6 +107,11 @@ class GENES < KEGGDB
107
107
  def orthologs_as_hash; super; end if false #dummy for RDoc
108
108
  alias orthologs orthologs_as_hash
109
109
 
110
+ include Common::DiseasesAsHash
111
+ # Returns a Hash of the disease ID and its definition
112
+ def diseases_as_hash; super; end if false #dummy for RDoc
113
+ alias diseases diseases_as_hash
114
+
110
115
  # Creates a new Bio::KEGG::GENES object.
111
116
  # ---
112
117
  # *Arguments*:
@@ -238,6 +243,27 @@ class GENES < KEGGDB
238
243
  lines_fetch('PATHWAY')
239
244
  end
240
245
 
246
+ # Networks described in the NETWORK lines.
247
+ # ---
248
+ # *Returns*:: Array containing String
249
+ def networks_as_strings
250
+ lines_fetch('NETWORK')
251
+ end
252
+
253
+ # Diseases described in the DISEASE lines.
254
+ # ---
255
+ # *Returns*:: Array containing String
256
+ def diseases_as_strings
257
+ lines_fetch('DISEASE')
258
+ end
259
+
260
+ # Drug targets described in the DRUG_TARGET lines.
261
+ # ---
262
+ # *Returns*:: Array containing String
263
+ def drug_targets_as_strings
264
+ lines_fetch('DRUG_TARGET')
265
+ end
266
+
241
267
  # Returns CLASS field of the entry.
242
268
  def keggclass
243
269
  field_fetch('CLASS')
@@ -42,6 +42,11 @@ class PATHWAY < KEGGDB
42
42
  def orthologs_as_hash; super; end if false #dummy for RDoc
43
43
  alias orthologs orthologs_as_hash
44
44
 
45
+ include Common::DiseasesAsHash
46
+ # Returns a Hash of the disease ID and its definition
47
+ def diseases_as_hash; super; end if false #dummy for RDoc
48
+ alias diseases diseases_as_hash
49
+
45
50
  include Common::References
46
51
  # REFERENCE -- Returns contents of the REFERENCE records as an Array of
47
52
  # Bio::Reference objects.
@@ -122,17 +127,6 @@ class PATHWAY < KEGGDB
122
127
  lines_fetch('DISEASE')
123
128
  end
124
129
 
125
- # Diseases described in the DISEASE lines.
126
- # ---
127
- # *Returns*:: Hash of disease ID and its definition
128
- def diseases_as_hash
129
- unless (defined? @diseases_as_hash) && @diseases_as_hash
130
- @diseases_as_hash = strings_as_hash(diseases_as_strings)
131
- end
132
- @diseases_as_hash
133
- end
134
- alias diseases diseases_as_hash
135
-
136
130
  # Returns an Array of a database name and entry IDs in DBLINKS field.
137
131
  # ---
138
132
  # *Returns*:: Array containing String
@@ -10,7 +10,7 @@
10
10
  module Bio
11
11
 
12
12
  # BioRuby version (Array containing Integer)
13
- BIORUBY_VERSION = [1, 6, 0].extend(Comparable).freeze
13
+ BIORUBY_VERSION = [2, 0, 0].extend(Comparable).freeze
14
14
 
15
15
  # Extra version specifier (String or nil).
16
16
  # Existance of the value indicates development version.
@@ -19,8 +19,8 @@ module Bio
19
19
  # ".pre :: Pre-release version.
20
20
  #
21
21
  # References: https://guides.rubygems.org/patterns/#prerelease-gems
22
- BIORUBY_EXTRA_VERSION = #nil
23
- ".pre"
22
+ BIORUBY_EXTRA_VERSION = nil
23
+ #".pre"
24
24
 
25
25
  # Version identifier, including extra version string (String)
26
26
  # Unlike BIORUBY_VERSION, it is not comparable.
@@ -0,0 +1,91 @@
1
+ #
2
+ # test/network/bio/db/kegg/test_genes_hsa7422.rb - Unit test for Bio::KEGG::GENES
3
+ #
4
+ # Copyright:: Copyright (C) 2019 BioRuby Project <staff@bioruby.org>
5
+ # License:: The Ruby License
6
+ # Contributor:: kojix2 <2xijok@gmail.com>
7
+ #
8
+
9
+ # loading helper routine for testing bioruby
10
+ require 'pathname'
11
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
12
+ 'bioruby_test_helper.rb')).cleanpath.to_s
13
+
14
+ # libraries needed for the tests
15
+ require 'test/unit'
16
+ require 'bio/db/kegg/genes'
17
+ require 'bio/io/togows'
18
+
19
+ module Bio
20
+
21
+ # This test is moved from test/unit/bio/db/kegg/test_genes.rb
22
+ # and modified to get sample data from the internet
23
+ # because of KEGG data license issue.
24
+ #
25
+ # Note that this test may fail due to the data entry updates in KEGG.
26
+ class TestBioKEGGGENES_hsa7422 < Test::Unit::TestCase
27
+
28
+ str = Bio::TogoWS::REST.entry("kegg-genes", "hsa:7422")
29
+ DATA = str.freeze
30
+
31
+ def setup
32
+ #filename = File.join(BioRubyTestDataPath, 'KEGG/hsa7422.gene')
33
+ @obj = Bio::KEGG::GENES.new(DATA)
34
+ end
35
+
36
+ def test_diseases_as_strings
37
+ expected = ["H01456 Diabetic nephropathy",
38
+ "H01457 Diabetic retinopathy",
39
+ "H01459 Diabetic neuropathy",
40
+ "H01529 Avascular necrosis of femoral head",
41
+ "H01709 Glucocorticoid-induced osteonecrosis"]
42
+
43
+ assert_equal(expected, @obj.diseases_as_strings)
44
+ end
45
+
46
+ def test_diseases_as_hash
47
+ expected = {"H01456"=>"Diabetic nephropathy",
48
+ "H01457"=>"Diabetic retinopathy",
49
+ "H01459"=>"Diabetic neuropathy",
50
+ "H01529"=>"Avascular necrosis of femoral head",
51
+ "H01709"=>"Glucocorticoid-induced osteonecrosis"}
52
+ assert_equal(expected, @obj.diseases_as_hash)
53
+ end
54
+
55
+ def test_drug_targets_as_strings
56
+ expected = ["Abicipar pegol: D11517",
57
+ "Aflibercept: D09574",
58
+ "Aflibercept beta: D10819",
59
+ "Bevacizumab: D06409",
60
+ "Bevasiranib sodium: D08874",
61
+ "Brolucizumab: D11083",
62
+ "Faricimab: D11516",
63
+ "Navicixizumab: D11126",
64
+ "Pegaptanib: D05386",
65
+ "Ranibizumab: D05697",
66
+ "Vanucizumab: D11244"]
67
+ assert_equal(expected, @obj.drug_targets_as_strings)
68
+ end
69
+
70
+ def test_networks_as_strings
71
+ expected = ["nt06114 PI3K signaling (virus)",
72
+ "nt06124 Chemokine signaling (virus)",
73
+ "nt06164 Kaposi sarcoma-associated herpesvirus (KSHV)",
74
+ "nt06214 PI3K signaling",
75
+ "nt06219 JAK-STAT signaling",
76
+ "nt06224 CXCR signaling",
77
+ "nt06225 HIF-1 signaling",
78
+ "nt06262 Pancreatic cancer",
79
+ "nt06264 Renal cell carcinoma",
80
+ "N00079 HIF-1 signaling pathway",
81
+ "N00080 Loss of VHL to HIF-1 signaling pathway",
82
+ "N00081 Mutation-inactivated VHL to HIF-1 signaling pathway",
83
+ "N00095 ERBB2-overexpression to EGF-Jak-STAT signaling pathway",
84
+ "N00157 KSHV vGPCR to GNB/G-ERK signaling pathway",
85
+ "N00179 KSHV K1 to PI3K-NFKB signaling pathway"]
86
+ assert_equal(expected, @obj.networks_as_strings)
87
+ end
88
+
89
+ end #class TestBioKEGGGENES_hsa7422
90
+
91
+ end #module Bio
@@ -479,7 +479,7 @@ module Bio
479
479
  include TemplateTestBlastReportHsp
480
480
  end
481
481
 
482
- if defined? XMLParser then
482
+ if Bio::Blast::Report.private_method_defined? :xmlparser_parse then
483
483
 
484
484
  class TestBlastReportXMLParser < Test::Unit::TestCase
485
485
  include TemplateTestBlastReport
@@ -497,7 +497,7 @@ module Bio
497
497
  include TemplateTestBlastReportHsp
498
498
  end
499
499
 
500
- end #if defined? XMLParser
500
+ end #if
501
501
 
502
502
  class TestBlastReportDefault < Test::Unit::TestCase
503
503
  include TemplateTestBlastReport
@@ -1294,7 +1294,7 @@ module Bio
1294
1294
  end
1295
1295
 
1296
1296
  # Tests for XMLParser version
1297
- if defined? XMLParser then
1297
+ if Bio::Blast::Report.private_method_defined? :xmlparser_parse then
1298
1298
 
1299
1299
  class TestBlastReportMultiXMLParser < Test::Unit::TestCase
1300
1300
  include TemplateTestBlastReportMulti
@@ -1312,6 +1312,6 @@ module Bio
1312
1312
  include TemplateTestBlastReportHspMulti
1313
1313
  end
1314
1314
 
1315
- end #if defined? XMLParser
1315
+ end #if
1316
1316
 
1317
1317
  end # module Bio
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0.pre.20181210
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BioRuby project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-11 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BioRuby is a library for bioinformatics (biology + information science).
14
14
  email: staff@bioruby.org
@@ -65,6 +65,7 @@ files:
65
65
  - gemfiles/Gemfile.travis-rbx
66
66
  - gemfiles/Gemfile.travis-ruby1.8
67
67
  - gemfiles/Gemfile.travis-ruby1.9
68
+ - gemfiles/Gemfile.windows
68
69
  - gemfiles/modify-Gemfile.rb
69
70
  - gemfiles/prepare-gemspec.rb
70
71
  - lib/bio.rb
@@ -80,7 +81,6 @@ files:
80
81
  - lib/bio/appl/blast/rexml.rb
81
82
  - lib/bio/appl/blast/rpsblast.rb
82
83
  - lib/bio/appl/blast/wublast.rb
83
- - lib/bio/appl/blast/xmlparser.rb
84
84
  - lib/bio/appl/blat/report.rb
85
85
  - lib/bio/appl/clustalw.rb
86
86
  - lib/bio/appl/clustalw/report.rb
@@ -327,7 +327,6 @@ files:
327
327
  - sample/test_restriction_enzyme_long.rb
328
328
  - sample/tfastx2tab.rb
329
329
  - sample/vs-genes.rb
330
- - setup.rb
331
330
  - test/bioruby_test_helper.rb
332
331
  - test/data/HMMER/hmmpfam.out
333
332
  - test/data/HMMER/hmmsearch.out
@@ -463,6 +462,7 @@ files:
463
462
  - test/network/bio/appl/blast/test_remote.rb
464
463
  - test/network/bio/appl/test_blast.rb
465
464
  - test/network/bio/appl/test_pts1.rb
465
+ - test/network/bio/db/kegg/test_genes_hsa7422.rb
466
466
  - test/network/bio/io/test_pubmed.rb
467
467
  - test/network/bio/io/test_togows.rb
468
468
  - test/network/bio/test_command.rb
@@ -603,12 +603,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
603
603
  version: '0'
604
604
  required_rubygems_version: !ruby/object:Gem::Requirement
605
605
  requirements:
606
- - - ">"
606
+ - - ">="
607
607
  - !ruby/object:Gem::Version
608
- version: 1.3.1
608
+ version: '0'
609
609
  requirements: []
610
610
  rubyforge_project:
611
- rubygems_version: 2.7.6
611
+ rubygems_version: 2.7.6.2
612
612
  signing_key:
613
613
  specification_version: 4
614
614
  summary: Bioinformatics library