bio 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,29 @@
1
+ = BioRuby 1.5.1 RELEASE NOTES
2
+
3
+ Few changes have been made to the BioRuby 1.5.1 after the version 1.5.0 is
4
+ released.
5
+
6
+ == NEWS
7
+
8
+ === HTTPS is used to access NCBI web services
9
+
10
+ As you may know, NCBI announced that all HTTP resources will be switched
11
+ to HTTPS on September 30, 2016. To follow the transition, all URLs for
12
+ accessing NCBI E-utilities in BioRuby are changed to use HTTPS.
13
+
14
+ In BioRuby, the following classes/modules are affected.
15
+
16
+ * Bio::NCBI::REST and descending classes
17
+ * Bio::PubMed
18
+
19
+ In some rare cases (especially when building Ruby and/or OpenSSL by yourself
20
+ from source code), Ruby does not include SSL/TLS support, or Ruby fails to
21
+ detect SSL root certificates. In such cases, you may need to reinstall or
22
+ upgrade Ruby, OpenSSL (or alternatives), and/or SSL root certificates with
23
+ appropriate configuration options. Alternatively, installing binary packages
24
+ is generally a good idea.
25
+
26
+
1
27
  = BioRuby 1.5.0 RELEASE NOTES
2
28
 
3
29
  A lot of changes have been made to the BioRuby 1.5.0 after the version 1.4.3
@@ -21,7 +47,7 @@ This release is the final BioRuby version that can be run on Ruby 1.8.
21
47
 
22
48
  BioRuby is distributed under the same license as Ruby's. In October 2011,
23
49
  Ruby's License was changed from a dual license with GPLv2 to a dual license
24
- with 2-clause BSDL.available. Since BioRuby 1.5.0, we have updated to the
50
+ with 2-clause BSDL. Since BioRuby 1.5.0, we have updated to the
25
51
  new version of Ruby's License. For details about the license, see COPYING
26
52
  or COPYING.ja and BSDL. In addition, please do not forget to see LEGAL for
27
53
  exception files that are subjected to different licenses.
@@ -29,7 +55,7 @@ exception files that are subjected to different licenses.
29
55
  === Semantic Versioning will be introduced
30
56
 
31
57
  We will adopt the Semantic Versioning since the next release version, which
32
- will be BioRuby 1.5.1. This means that BioRuby 1.5.0 are NOT subject to the
58
+ will be BioRuby 1.5.1. This means that BioRuby 1.5.0 is NOT subject to the
33
59
  Semantic Versioning.
34
60
 
35
61
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'bio'
6
- s.version = "1.5.0"
6
+ s.version = "1.5.1"
7
7
 
8
8
  s.author = "BioRuby project"
9
9
  s.email = "staff@bioruby.org"
@@ -13,6 +13,7 @@ require 'uri'
13
13
  require 'open-uri'
14
14
  require 'cgi'
15
15
  require 'net/http'
16
+ require 'net/https'
16
17
  require 'tmpdir'
17
18
  require 'fileutils'
18
19
 
@@ -706,6 +707,43 @@ module Command
706
707
  OpenURI.open_uri(uri).read
707
708
  end
708
709
 
710
+ # Same as:
711
+ # Net::HTTP.start(uri.address, uri.port)
712
+ # and
713
+ # it uses proxy if an environment variable (same as OpenURI.open_uri)
714
+ # is set.
715
+ # It supports https.
716
+ #
717
+ # Note: This method ignores uri.path.
718
+ # It only uses uri.address and uri.port.
719
+ #
720
+ # ---
721
+ # *Arguments*:
722
+ # * (required) _uri_: URI object or String containing URI
723
+ # *Returns*:: (same as Net::HTTP::start except for proxy and https support)
724
+ def start_http_uri(uri, &block)
725
+ unless uri.is_a?(URI)
726
+ uri = URI.parse(uri)
727
+ end
728
+
729
+ # Note: URI#find_proxy is an unofficial method defined in open-uri.rb.
730
+ # If the spec of open-uri.rb would be changed, we should change below.
731
+ if proxyuri = uri.find_proxy then
732
+ raise 'Non-HTTP proxy' if proxyuri.class != URI::HTTP
733
+ klass = Net::HTTP.Proxy(proxyuri.host, proxyuri.port)
734
+ else
735
+ klass = Net::HTTP
736
+ end
737
+
738
+ http = klass.new(uri.host, uri.port)
739
+ case uri.scheme
740
+ when 'https'
741
+ http.use_ssl = true
742
+ end
743
+
744
+ http.start(&block)
745
+ end
746
+
709
747
  # Same as:
710
748
  # Net::HTTP.start(address, port)
711
749
  # and
@@ -813,7 +851,7 @@ module Command
813
851
  }
814
852
  hash.update(header)
815
853
 
816
- start_http(uri.host, uri.port) do |http|
854
+ start_http_uri(uri) do |http|
817
855
  http.post(uri.path, data, hash)
818
856
  end
819
857
  end
@@ -937,7 +975,7 @@ module Command
937
975
  }
938
976
  hash.update(header)
939
977
 
940
- start_http(uri.host, uri.port) do |http|
978
+ start_http_uri(uri) do |http|
941
979
  http.post(uri.path, data, hash)
942
980
  end
943
981
  end
@@ -20,13 +20,13 @@ class NCBI
20
20
  # They may also be used for other NCBI services.
21
21
  ENTREZ_DEFAULT_PARAMETERS = {
22
22
  # Cited from
23
- # http://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.Release_Notes
23
+ # https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.Release_Notes
24
24
  # tool:
25
25
  # Name of application making the E-utility call.
26
26
  # Value must be a string with no internal spaces.
27
27
  'tool' => "bioruby",
28
28
  # Cited from
29
- # http://www.ncbi.nlm.nih.gov/books/NBK25497/
29
+ # https://www.ncbi.nlm.nih.gov/books/NBK25497/
30
30
  # The value of email should be a complete and valid e-mail address
31
31
  # of the software developer and not that of a third-party end user.
32
32
  'email' => 'staff@bioruby.org',
@@ -54,7 +54,7 @@ class NCBI
54
54
  # Sets default email address used for Entrez (eUtils).
55
55
  # It may also be used for other NCBI services.
56
56
  #
57
- # In http://www.ncbi.nlm.nih.gov/books/NBK25497/
57
+ # In https://www.ncbi.nlm.nih.gov/books/NBK25497/
58
58
  # NCBI says:
59
59
  # "The value of email should be a complete and valid e-mail address of
60
60
  # the software developer and not that of a third-party end user."
@@ -89,7 +89,7 @@ class NCBI
89
89
  # Sets default tool name for Entrez (eUtils).
90
90
  # It may also be used for other NCBI services.
91
91
  #
92
- # In http://www.ncbi.nlm.nih.gov/books/NBK25497/
92
+ # In https://www.ncbi.nlm.nih.gov/books/NBK25497/
93
93
  # NCBI says:
94
94
  # "The value of tool should be a string with no internal spaces that
95
95
  # uniquely identifies the software producing the request."
@@ -111,9 +111,10 @@ class NCBI
111
111
  #
112
112
  # The Bio::NCBI::REST class provides REST client for the NCBI E-Utilities
113
113
  #
114
- # Entrez utilities index:
114
+ # Entrez Programming Utilities Help:
115
115
  #
116
- # * http://www.ncbi.nlm.nih.gov/entrez/utils/utils_index.html
116
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25501/
117
+ # * ( redirected from http://www.ncbi.nlm.nih.gov/entrez/utils/ )
117
118
  #
118
119
  class REST
119
120
 
@@ -197,7 +198,7 @@ class REST
197
198
 
198
199
  # List the NCBI database names E-Utils (einfo) service
199
200
  #
200
- # * http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi
201
+ # * https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi
201
202
  #
202
203
  # pubmed protein nucleotide nuccore nucgss nucest structure genome
203
204
  # books cancerchromosomes cdd gap domains gene genomeprj gensat geo
@@ -215,7 +216,7 @@ class REST
215
216
  # ---
216
217
  # *Returns*:: array of string (database names)
217
218
  def einfo
218
- serv = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi"
219
+ serv = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi"
219
220
  opts = default_parameters.merge({})
220
221
  response = ncbi_post_form(serv, opts)
221
222
  result = response.body
@@ -229,8 +230,9 @@ class REST
229
230
  #
230
231
  # For information on the possible arguments, see
231
232
  #
232
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html
233
- # * http://www.ncbi.nlm.nih.gov/books/bv.fcgi?rid=helppubmed.section.pubmedhelp.Search_Field_Descrip
233
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch
234
+ # * ( redirected from http://eutils.ncbi.nlm.nih.gov/books/n/helpeutils/chapter4/#chapter4.ESearch )
235
+ # * ( redirected from http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html )
234
236
  #
235
237
  # == Usage
236
238
  #
@@ -282,7 +284,7 @@ class REST
282
284
  # * _step_: maximum number of entries retrieved at a time
283
285
  # *Returns*:: array of entry IDs or a number of results
284
286
  def esearch(str, hash = {}, limit = nil, step = 10000)
285
- serv = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
287
+ serv = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
286
288
  opts = default_parameters.merge({ "term" => str })
287
289
  opts.update(hash)
288
290
 
@@ -313,7 +315,7 @@ class REST
313
315
  # *Arguments*:: same as esearch method
314
316
  # *Returns*:: array of entry IDs or a number of results
315
317
  def esearch_count(str, hash = {})
316
- serv = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
318
+ serv = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
317
319
  opts = default_parameters.merge({ "term" => str })
318
320
  opts.update(hash)
319
321
  opts.update("rettype" => "count")
@@ -328,7 +330,7 @@ class REST
328
330
  #
329
331
  # For information on the possible arguments, see
330
332
  #
331
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetch_help.html
333
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
332
334
  #
333
335
  # == Usage
334
336
  #
@@ -351,7 +353,7 @@ class REST
351
353
  # * _step_: maximum number of entries retrieved at a time
352
354
  # *Returns*:: String
353
355
  def efetch(ids, hash = {}, step = 100)
354
- serv = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi"
356
+ serv = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi"
355
357
  opts = default_parameters.merge({ "retmode" => "text" })
356
358
  opts.update(hash)
357
359
 
@@ -396,12 +398,12 @@ class REST
396
398
 
397
399
  # Search database entries by given keywords using E-Utils (esearch).
398
400
  #
399
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html
401
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch
400
402
  #
401
403
  # sequences = gene + genome + nucleotide + protein + popset + snp
402
404
  # nucleotide = nuccore + nucest + nucgss
403
405
  #
404
- # * http://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi
406
+ # * https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi
405
407
  #
406
408
  # pubmed protein nucleotide nuccore nucgss nucest structure genome
407
409
  # books cancerchromosomes cdd gap domains gene genomeprj gensat geo
@@ -517,7 +519,7 @@ class REST
517
519
 
518
520
  # Retrieve sequence entries by given IDs using E-Utils (efetch).
519
521
  #
520
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html
522
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
521
523
  #
522
524
  # sequences = gene + genome + nucleotide + protein + popset + snp
523
525
  # nucleotide = nuccore + nucest + nucgss
@@ -581,7 +583,7 @@ class REST
581
583
  # Retrieve nucleotide sequence entries by given IDs using E-Utils
582
584
  # (efetch).
583
585
  #
584
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html
586
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
585
587
  # nucleotide = nuccore + nucest + nucgss
586
588
  #
587
589
  # format (rettype):
@@ -643,7 +645,7 @@ class REST
643
645
  # Retrieve protein sequence entries by given IDs using E-Utils
644
646
  # (efetch).
645
647
  #
646
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html
648
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
647
649
  # protein
648
650
  #
649
651
  # format (rettype):
@@ -699,7 +701,7 @@ class REST
699
701
 
700
702
  # Retrieve PubMed entries by given IDs using E-Utils (efetch).
701
703
  #
702
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchlit_help.html
704
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
703
705
  #
704
706
  # == Usage
705
707
  #
@@ -741,7 +743,7 @@ class REST
741
743
 
742
744
  # Retrieve PubMed Central entries by given IDs using E-Utils (efetch).
743
745
  #
744
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchlit_help.html
746
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
745
747
  #
746
748
  # == Usage
747
749
  #
@@ -776,7 +778,7 @@ class REST
776
778
 
777
779
  # Retrieve journal entries by given IDs using E-Utils (efetch).
778
780
  #
779
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchlit_help.html
781
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
780
782
  #
781
783
  # == Usage
782
784
  #
@@ -811,7 +813,7 @@ class REST
811
813
 
812
814
  # Retrieve OMIM entries by given IDs using E-Utils (efetch).
813
815
  #
814
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchlit_help.html
816
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
815
817
  #
816
818
  # == Usage
817
819
  #
@@ -849,7 +851,7 @@ class REST
849
851
 
850
852
  # Retrieve taxonomy entries by given IDs using E-Utils (efetch).
851
853
  #
852
- # * http://eutils.ncbi.nlm.nih.gov/entrez/query/static/efetchtax_help.html
854
+ # * https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.EFetch
853
855
  #
854
856
  # == Usage
855
857
  #
@@ -10,7 +10,7 @@
10
10
  module Bio
11
11
 
12
12
  # BioRuby version (Array containing Integer)
13
- BIORUBY_VERSION = [1, 5, 0].extend(Comparable).freeze
13
+ BIORUBY_VERSION = [1, 5, 1].extend(Comparable).freeze
14
14
 
15
15
  # Extra version specifier (String or nil).
16
16
  # Existance of the value indicates development version.
@@ -22,7 +22,7 @@ module Bio
22
22
  # By default, if the third digit (teeny) of BIORUBY_VERSION is 0,
23
23
  # the version is regarded as a development version.
24
24
  BIORUBY_EXTRA_VERSION =
25
- nil #(BIORUBY_VERSION[2] == 0) ? "-dev" : nil
25
+ nil #"-dev" #(BIORUBY_VERSION[2] == 0) ? "-dev" : nil
26
26
 
27
27
  # Version identifier, including extra version string (String)
28
28
  # Unlike BIORUBY_VERSION, it is not comparable.
@@ -13,6 +13,7 @@ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 2,
13
13
 
14
14
  # libraries needed for the tests
15
15
  require 'test/unit'
16
+ require 'uri'
16
17
  require 'bio/command'
17
18
 
18
19
  module Bio
@@ -22,6 +23,7 @@ module Bio
22
23
  @port = 80
23
24
  @path = "/"
24
25
  @url = "http://bioruby.open-bio.org:80/"
26
+ @uri = URI.parse(@url)
25
27
  end
26
28
 
27
29
  def test_read_uri
@@ -32,6 +34,21 @@ module Bio
32
34
  assert(!str.to_s.empty?)
33
35
  end
34
36
 
37
+ def test_start_http_uri
38
+ ht = Bio::Command.start_http_uri(@uri)
39
+ assert_kind_of(Net::HTTP, ht)
40
+ res = ht.get(@path)
41
+ assert_kind_of(Net::HTTPResponse, res)
42
+ end
43
+
44
+ def test_start_http_uri_with_block
45
+ res = Bio::Command.start_http_uri(@uri) do |ht|
46
+ assert_kind_of(Net::HTTP, ht)
47
+ ht.get(@path)
48
+ end
49
+ assert_kind_of(Net::HTTPResponse, res)
50
+ end
51
+
35
52
  def test_start_http
36
53
  ht = Bio::Command.start_http(@host, @port)
37
54
  assert_kind_of(Net::HTTP, ht)
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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BioRuby project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2016-09-07 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
@@ -674,7 +674,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
674
674
  version: '0'
675
675
  requirements: []
676
676
  rubyforge_project:
677
- rubygems_version: 2.4.8
677
+ rubygems_version: 2.2.2
678
678
  signing_key:
679
679
  specification_version: 4
680
680
  summary: Bioinformatics library