unipept 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/ci.yml +6 -27
  4. data/.rakeTasks +2 -2
  5. data/.rubocop.yml +2 -0
  6. data/.ruby-version +1 -1
  7. data/CITATION.cff +30 -0
  8. data/Gemfile +2 -2
  9. data/Gemfile.lock +60 -41
  10. data/README.md +2 -2
  11. data/Rakefile +4 -4
  12. data/VERSION +1 -1
  13. data/lib/commands/prot2pept.rb +1 -2
  14. data/lib/commands/unipept/api_runner.rb +8 -12
  15. data/lib/commands/unipept/config.rb +1 -1
  16. data/lib/commands/unipept/pept2taxa.rb +1 -5
  17. data/lib/commands/unipept/taxa2tree.rb +3 -3
  18. data/lib/commands/uniprot.rb +4 -5
  19. data/lib/configuration.rb +6 -7
  20. data/lib/formatters.rb +7 -7
  21. data/lib/server_message.rb +3 -5
  22. data/test/commands/unipept/test_api_runner.rb +9 -8
  23. data/test/commands/unipept/test_config.rb +1 -1
  24. data/test/commands/unipept/test_pept2ec.rb +2 -2
  25. data/test/commands/unipept/test_pept2funct.rb +2 -2
  26. data/test/commands/unipept/test_pept2go.rb +2 -2
  27. data/test/commands/unipept/test_pept2interpro.rb +2 -2
  28. data/test/commands/unipept/test_pept2lca.rb +2 -2
  29. data/test/commands/unipept/test_pept2prot.rb +2 -2
  30. data/test/commands/unipept/test_pept2taxa.rb +2 -4
  31. data/test/commands/unipept/test_peptinfo.rb +2 -2
  32. data/test/commands/unipept/test_taxa2lca.rb +2 -2
  33. data/test/commands/unipept/test_taxa2tree.rb +2 -2
  34. data/test/commands/unipept/test_taxonomy.rb +2 -2
  35. data/test/support/api_stub.rb +4 -4
  36. data/test/test_configuration.rb +1 -1
  37. data/test/test_formatters.rb +5 -5
  38. data/test/test_output_writer.rb +1 -1
  39. data/test/test_server_message.rb +3 -3
  40. data/unipept.gemspec +17 -21
  41. metadata +11 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae8f504a45da4b1347a4dae8c3989d56051ece08b84b77ed5a7b07bd8fd7e389
4
- data.tar.gz: b718c39e60d721878b539b4b1e80edfa9df66ed1b1f841b0c45a78946a9a2df5
3
+ metadata.gz: 1dfd4f81d97870e20ecaeea0cc3e047667a70e556d0ea3c1d39b729dcd6dd7b2
4
+ data.tar.gz: f2227172f0b5cfb7ec80d2ae00181749d7e00667ec88332fb43775be42e3c6fa
5
5
  SHA512:
6
- metadata.gz: 852005f9d3c107a5dfef6eec2dbb2ec0a9800e48857eed1e043492efe7d8ac0532424eed809fc599b5b11d35b6972291bb4b6d3af06414edd36572bafb5b330e
7
- data.tar.gz: 16a34b6be468f68572bb0c9cc09eb23142570ec01549df41fdd5d4b5413d65c77978717ea0db3af6701eb81e80a73c60c6d5760261b3831266b32dbef7e631e3
6
+ metadata.gz: 07f29c4d733ebe355d922ab199eaf092ad63b010cfe9aa079167f83384fc4c20255e7ca3caad619c8dabff5a4646a4aa742084eb6df25bb90b591435160a6473
7
+ data.tar.gz: 7f166594e85b531205ed3044125f2dc6782fdd461404feac059ea616ebc08a80887f991bbb39310aa75de248494c493454b937099558a2234fec666e9afba462
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: monthly
7
+ time: "13:00"
8
+ timezone: Europe/Brussels
9
+ open-pull-requests-limit: 99
@@ -7,27 +7,16 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: ["2.4", "2.5", "2.6"]
10
+ ruby: ["2.7", "3.0", "3.1"]
11
11
  fail-fast: false
12
12
  name: Test Ruby ${{ matrix.ruby }}
13
13
  steps:
14
14
  - uses: actions/checkout@v1
15
15
  - name: Setup Ruby
16
- uses: actions/setup-ruby@v1
16
+ uses: ruby/setup-ruby@v1
17
17
  with:
18
18
  ruby-version: ${{ matrix.ruby }}
19
- - name: Cache Ruby dependencies
20
- uses: actions/cache@v1
21
- with:
22
- path: vendor/bundle
23
- key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
24
- restore-keys: |
25
- ${{ runner.os }}-${{ matrix.ruby }}-gem-
26
- - name: Install dependencies
27
- run: |
28
- gem install bundler:1.17.2
29
- bundle config path vendor/bundle
30
- bundle install --jobs 4 --retry 3
19
+ bundler-cache: true
31
20
  - name: Test
32
21
  run: |
33
22
  bundle exec rake test
@@ -37,19 +26,9 @@ jobs:
37
26
  steps:
38
27
  - uses: actions/checkout@v1
39
28
  - name: Setup Ruby
40
- uses: actions/setup-ruby@v1
41
- - name: Cache Ruby dependencies
42
- uses: actions/cache@v1
29
+ uses: ruby/setup-ruby@v1
43
30
  with:
44
- path: vendor/bundle
45
- key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
46
- restore-keys: |
47
- ${{ runner.os }}-${{ matrix.ruby }}-gem-
48
- - name: Install dependencies
49
- run: |
50
- gem install bundler:1.17.2
51
- bundle config path vendor/bundle
52
- bundle install --jobs 4 --retry 3
31
+ bundler-cache: true
53
32
  - name: Test
54
33
  run: |
55
- bundle exec rake test_style
34
+ bundle exec rake test_style
data/.rakeTasks CHANGED
@@ -1,7 +1,7 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Settings><!--This file was automatically generated by Ruby plugin.
3
3
  You are allowed to:
4
4
  1. Remove rake task
5
5
  2. Add existing rake tasks
6
6
  To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gem into pkg/" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Start IRB with all runtime dependencies loaded" fullCmd="console[script]" taksId="console[script]" /><RakeGroup description="" fullCmd="" taksId="gemcutter"><RakeTask description="Release gem to Gemcutter" fullCmd="gemcutter:release" taksId="release" /></RakeGroup><RakeTask description="Generate and validate gemspec" fullCmd="gemspec" taksId="gemspec" /><RakeGroup description="" fullCmd="" taksId="gemspec"><RakeTask description="Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)" fullCmd="gemspec:debug" taksId="debug" /><RakeTask description="Regenerate the gemspec on the filesystem" fullCmd="gemspec:generate" taksId="generate" /><RakeTask description="Regenerate and validate gemspec, and then commits and pushes to git" fullCmd="gemspec:release" taksId="release" /><RakeTask description="Validates the gemspec on the filesystem" fullCmd="gemspec:validate" taksId="validate" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Tag and push release to git" fullCmd="git:release" taksId="release" /></RakeGroup><RakeTask description="Build and install gem using `gem install`" fullCmd="install" taksId="install" /><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Release gem" fullCmd="release" taksId="release" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run RuboCop" fullCmd="test_style" taksId="test_style" /><RakeGroup description="" fullCmd="" taksId="test_style"><RakeTask description="Auto-correct RuboCop offenses" fullCmd="test_style:auto_correct" taksId="auto_correct" /></RakeGroup><RakeTask description="Displays the current version" fullCmd="version" taksId="version" /><RakeGroup description="" fullCmd="" taksId="version"><RakeGroup description="" fullCmd="" taksId="bump"><RakeTask description="Bump the major version by 1" fullCmd="version:bump:major" taksId="major" /><RakeTask description="Bump the a minor version by 1" fullCmd="version:bump:minor" taksId="minor" /><RakeTask description="Bump the patch version by 1" fullCmd="version:bump:patch" taksId="patch" /></RakeGroup><RakeTask description="Writes out an explicit version" fullCmd="version:write" taksId="write" /></RakeGroup><RakeTask description="" fullCmd="console" taksId="console" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="gemspec_required" taksId="gemspec_required" /><RakeTask description="" fullCmd="rdoc/created.rid" taksId="rdoc/created.rid" /><RakeTask description="" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="test_unit" taksId="test_unit" /><RakeTask description="" fullCmd="version_required" taksId="version_required" /></RakeGroup></Settings>
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gem into pkg/" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Start IRB with all runtime dependencies loaded" fullCmd="console[script]" taksId="console[script]" /><RakeGroup description="" fullCmd="" taksId="gemcutter"><RakeTask description="Release gem to Gemcutter" fullCmd="gemcutter:release" taksId="release" /></RakeGroup><RakeTask description="Generate and validate gemspec" fullCmd="gemspec" taksId="gemspec" /><RakeGroup description="" fullCmd="" taksId="gemspec"><RakeTask description="Display the gemspec for debugging purposes, as juwelier knows it (not from the filesystem)" fullCmd="gemspec:debug" taksId="debug" /><RakeTask description="Regenerate the gemspec on the filesystem" fullCmd="gemspec:generate" taksId="generate" /><RakeTask description="Regenerate and validate gemspec, and then commits and pushes to git" fullCmd="gemspec:release" taksId="release" /><RakeTask description="Validates the gemspec on the filesystem" fullCmd="gemspec:validate" taksId="validate" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Tag and push release to git" fullCmd="git:release" taksId="release" /></RakeGroup><RakeTask description="Build and install gem using `gem install`" fullCmd="install" taksId="install" /><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Release gem" fullCmd="release" taksId="release" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run RuboCop" fullCmd="test_style" taksId="test_style" /><RakeGroup description="" fullCmd="" taksId="test_style"><RakeTask description="Auto-correct RuboCop offenses" fullCmd="test_style:auto_correct" taksId="auto_correct" /></RakeGroup><RakeTask description="Displays the current version" fullCmd="version" taksId="version" /><RakeGroup description="" fullCmd="" taksId="version"><RakeGroup description="" fullCmd="" taksId="bump"><RakeTask description="Bump the major version by 1" fullCmd="version:bump:major" taksId="major" /><RakeTask description="Bump the a minor version by 1" fullCmd="version:bump:minor" taksId="minor" /><RakeTask description="Bump the patch version by 1" fullCmd="version:bump:patch" taksId="patch" /></RakeGroup><RakeTask description="Writes out an explicit version" fullCmd="version:write" taksId="write" /></RakeGroup><RakeTask description="" fullCmd="console" taksId="console" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="gemspec_required" taksId="gemspec_required" /><RakeTask description="" fullCmd="rdoc/created.rid" taksId="rdoc/created.rid" /><RakeTask description="" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="test_unit" taksId="test_unit" /><RakeTask description="" fullCmd="version_required" taksId="version_required" /></RakeGroup></Settings>
data/.rubocop.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.7
3
+ NewCops: enable
2
4
  Exclude:
3
5
  - 'unipept.gemspec'
4
6
  - 'vendor/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.0.0
data/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ preferred-citation:
4
+ type: article
5
+ authors:
6
+ - family-names: "Verschaffelt"
7
+ given-names: "Pieter"
8
+ - family-names: "Van Thienen"
9
+ given-names: "Philippe"
10
+ - family-names: "Van Den Bossche"
11
+ given-names: "Tim"
12
+ - family-names: "Van der Jeugt"
13
+ given-names: "Felix"
14
+ - family-names: "De Tender"
15
+ given-names: "Caroline"
16
+ - family-names: "Martens"
17
+ given-names: "Lennart"
18
+ - family-names: "Dawyndt"
19
+ given-names: "Peter"
20
+ - family-names: "Mesuere"
21
+ given-names: "Bart"
22
+ orcid: "https://orcid.org/0000-0003-0610-3441"
23
+ doi: "10.1093/bioinformatics/btaa553"
24
+ journal: "Bioinformatics"
25
+ start: 4220
26
+ end: 4221
27
+ title: "Unipept CLI 2.0: adding support for visualizations and functional annotations"
28
+ issue: 14
29
+ volume: 36
30
+ year: 2020
data/Gemfile CHANGED
@@ -7,9 +7,9 @@ gem 'typhoeus', '~> 1.3.1'
7
7
  group :development do
8
8
  gem 'minitest', '~> 5.14'
9
9
  gem 'rake', '~> 13.0.1'
10
- gem 'rubocop', '~>0.79.0'
10
+ gem 'rubocop', '~>1.11'
11
11
  end
12
12
 
13
13
  group :release do
14
- gem 'jeweler'
14
+ gem 'juwelier'
15
15
  end
data/Gemfile.lock CHANGED
@@ -1,85 +1,104 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.4.0)
5
- ast (2.4.0)
4
+ addressable (2.8.0)
5
+ public_suffix (>= 2.0.2, < 5.0)
6
+ ast (2.4.2)
6
7
  builder (3.2.4)
7
- cri (2.15.10)
8
+ cri (2.15.11)
8
9
  descendants_tracker (0.0.4)
9
10
  thread_safe (~> 0.3, >= 0.3.1)
10
11
  ethon (0.12.0)
11
12
  ffi (>= 1.3.0)
12
- faraday (0.9.2)
13
+ faraday (1.3.0)
14
+ faraday-net_http (~> 1.0)
13
15
  multipart-post (>= 1.2, < 3)
16
+ ruby2_keywords
17
+ faraday-net_http (1.0.1)
14
18
  ffi (1.12.1)
15
- git (1.5.0)
16
- github_api (0.16.0)
17
- addressable (~> 2.4.0)
19
+ git (1.8.1)
20
+ rchardet (~> 1.8)
21
+ github_api (0.19.0)
22
+ addressable (~> 2.4)
18
23
  descendants_tracker (~> 0.0.4)
19
- faraday (~> 0.8, < 0.10)
20
- hashie (>= 3.4)
21
- mime-types (>= 1.16, < 3.0)
24
+ faraday (>= 0.8, < 2)
25
+ hashie (~> 3.5, >= 3.5.2)
22
26
  oauth2 (~> 1.0)
23
- hashie (4.0.0)
27
+ hashie (3.6.0)
24
28
  highline (2.0.3)
25
- jaro_winkler (1.5.4)
26
- jeweler (2.3.9)
29
+ juwelier (2.4.9)
27
30
  builder
28
31
  bundler
29
- git (>= 1.2.5)
30
- github_api (~> 0.16.0)
31
- highline (>= 1.6.15)
32
- nokogiri (>= 1.5.10)
32
+ git
33
+ github_api
34
+ highline
35
+ kamelcase (~> 0)
36
+ nokogiri
33
37
  psych
34
38
  rake
35
39
  rdoc
36
40
  semver2
37
- jwt (2.2.1)
38
- mime-types (2.99.3)
39
- mini_portile2 (2.4.0)
40
- minitest (5.14.0)
41
- multi_json (1.14.1)
41
+ jwt (2.2.2)
42
+ kamelcase (0.0.2)
43
+ semver2 (~> 3)
44
+ mini_portile2 (2.8.0)
45
+ minitest (5.15.0)
46
+ multi_json (1.15.0)
42
47
  multi_xml (0.6.0)
43
48
  multipart-post (2.1.1)
44
- nokogiri (1.10.7)
45
- mini_portile2 (~> 2.4.0)
46
- oauth2 (1.4.2)
49
+ nokogiri (1.13.4)
50
+ mini_portile2 (~> 2.8.0)
51
+ racc (~> 1.4)
52
+ oauth2 (1.4.4)
47
53
  faraday (>= 0.8, < 2.0)
48
54
  jwt (>= 1.0, < 3.0)
49
55
  multi_json (~> 1.3)
50
56
  multi_xml (~> 0.5)
51
57
  rack (>= 1.2, < 3)
52
- parallel (1.19.1)
53
- parser (2.7.0.2)
54
- ast (~> 2.4.0)
55
- psych (3.1.0)
56
- rack (2.1.1)
57
- rainbow (3.0.0)
58
- rake (13.0.1)
59
- rdoc (6.2.1)
60
- rubocop (0.79.0)
61
- jaro_winkler (~> 1.5.1)
58
+ parallel (1.22.1)
59
+ parser (3.1.1.0)
60
+ ast (~> 2.4.1)
61
+ psych (4.0.3)
62
+ stringio
63
+ public_suffix (4.0.6)
64
+ racc (1.6.0)
65
+ rack (2.2.3)
66
+ rainbow (3.1.1)
67
+ rake (13.0.6)
68
+ rchardet (1.8.0)
69
+ rdoc (6.4.0)
70
+ psych (>= 4.0.0)
71
+ regexp_parser (2.3.0)
72
+ rexml (3.2.5)
73
+ rubocop (1.27.0)
62
74
  parallel (~> 1.10)
63
- parser (>= 2.7.0.1)
75
+ parser (>= 3.1.0.0)
64
76
  rainbow (>= 2.2.2, < 4.0)
77
+ regexp_parser (>= 1.8, < 3.0)
78
+ rexml
79
+ rubocop-ast (>= 1.16.0, < 2.0)
65
80
  ruby-progressbar (~> 1.7)
66
- unicode-display_width (>= 1.4.0, < 1.7)
67
- ruby-progressbar (1.10.1)
81
+ unicode-display_width (>= 1.4.0, < 3.0)
82
+ rubocop-ast (1.17.0)
83
+ parser (>= 3.1.1.0)
84
+ ruby-progressbar (1.11.0)
85
+ ruby2_keywords (0.0.4)
68
86
  semver2 (3.4.2)
87
+ stringio (3.0.1)
69
88
  thread_safe (0.3.6)
70
89
  typhoeus (1.3.1)
71
90
  ethon (>= 0.9.0)
72
- unicode-display_width (1.6.1)
91
+ unicode-display_width (2.1.0)
73
92
 
74
93
  PLATFORMS
75
94
  ruby
76
95
 
77
96
  DEPENDENCIES
78
97
  cri (~> 2.15.10)
79
- jeweler
98
+ juwelier
80
99
  minitest (~> 5.14)
81
100
  rake (~> 13.0.1)
82
- rubocop (~> 0.79.0)
101
+ rubocop (~> 1.11)
83
102
  typhoeus (~> 1.3.1)
84
103
 
85
104
  BUNDLED WITH
data/README.md CHANGED
@@ -7,11 +7,11 @@ Documentation about the web service can be found at [http://unipept.ugent.be/api
7
7
 
8
8
  ## Installation
9
9
 
10
- To use the Unipept CLI, Ruby version 1.9.3 or higher needs to be installed. You can check this by running `ruby -v` on the commandline:
10
+ To use the Unipept CLI, Ruby version 2.6 or higher needs to be installed. You can check this by running `ruby -v` on the commandline:
11
11
 
12
12
  ```
13
13
  $ ruby -v
14
- ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
14
+ ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin21]
15
15
  ```
16
16
 
17
17
  More information on installing Ruby can be found at https://www.ruby-lang.org/en/installation/
data/Rakefile CHANGED
@@ -11,8 +11,8 @@ require 'rake'
11
11
  require 'rake/testtask'
12
12
  require 'rubocop/rake_task'
13
13
  begin
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
14
+ require 'juwelier'
15
+ Juwelier::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
17
  gem.name = 'unipept'
18
18
  gem.executables = %w[unipept prot2pept peptfilter uniprot]
@@ -26,9 +26,9 @@ begin
26
26
  EOS
27
27
  gem.email = 'unipept@ugent.be'
28
28
  gem.authors = ['Bart Mesuere', 'Pieter Verschaffelt', 'Toon Willems', 'Tom Naessens']
29
- gem.required_ruby_version = '>= 2.0.0'
29
+ gem.required_ruby_version = '>= 2.6.0'
30
30
  end
31
- Jeweler::RubygemsDotOrgTasks.new
31
+ Juwelier::RubygemsDotOrgTasks.new
32
32
  rescue LoadError
33
33
  # do nothing
34
34
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 3.0.0
@@ -1,7 +1,6 @@
1
1
  module Unipept::Commands
2
2
  class Prot2pept
3
- attr_reader :root_command
4
- attr_reader :valid_formats
3
+ attr_reader :root_command, :valid_formats
5
4
 
6
5
  @root_command = Cri::Command.define do
7
6
  name 'prot2pept'
@@ -2,19 +2,15 @@ require_relative '../../retryable_typhoeus'
2
2
 
3
3
  module Unipept
4
4
  class Commands::ApiRunner < Cri::CommandRunner
5
- attr_reader :configuration
6
-
7
- attr_reader :url
8
-
9
- attr_reader :user_agent
5
+ attr_reader :configuration, :url, :user_agent
10
6
 
11
7
  def initialize(args, opts, cmd)
12
8
  super
13
9
  @configuration = Unipept::Configuration.new
14
10
 
15
11
  @host = host
16
- @user_agent = 'Unipept CLI - unipept ' + Unipept::VERSION
17
- @url = "#{@host}/api/v1/#{cmd.name}.json"
12
+ @user_agent = "Unipept CLI - unipept #{Unipept::VERSION}"
13
+ @url = "#{@host}/api/v2/#{cmd.name}.json"
18
14
  @fasta = false
19
15
  end
20
16
 
@@ -39,7 +35,7 @@ module Unipept
39
35
  # - if none of the previous are given, uses stdin
40
36
  def input_iterator
41
37
  return arguments.each unless arguments.empty?
42
- return IO.foreach(options[:input]) if options[:input]
38
+ return File.foreach(options[:input]) if options[:input]
43
39
 
44
40
  $stdin.each_line
45
41
  end
@@ -148,7 +144,7 @@ module Unipept
148
144
  def save_error(message)
149
145
  path = error_file_path
150
146
  FileUtils.mkdir_p File.dirname(path)
151
- File.open(path, 'w') { |f| f.write message }
147
+ File.write(path, message)
152
148
  warn "API request failed! log can be found in #{path}"
153
149
  end
154
150
 
@@ -173,7 +169,7 @@ module Unipept
173
169
 
174
170
  lambda do
175
171
  unless result.empty?
176
- output_writer.write_line formatter.header(result, fasta_mapper) if batch_id.zero? && !options[:"no-header"]
172
+ output_writer.write_line formatter.header(result, fasta_mapper) if batch_id.zero? && !options[:'no-header']
177
173
  output_writer.write_line formatter.format(result, fasta_mapper, batch_id.zero?)
178
174
  end
179
175
  end
@@ -183,7 +179,7 @@ module Unipept
183
179
  if response.timed_out?
184
180
  -> { save_error('request timed out, continuing anyway, but results might be incomplete') }
185
181
  elsif response.code.zero?
186
- -> { save_error('could not get an http response, continuing anyway, but results might be incomplete' + response.return_message) }
182
+ -> { save_error("could not get an http response, continuing anyway, but results might be incomplete#{response.return_message}") }
187
183
  else
188
184
  -> { save_error("Got #{response.code}: #{response.response_body}\nRequest headers: #{response.request.options}\nRequest body:\n#{response.request.encoded_body}\n\n") }
189
185
  end
@@ -212,7 +208,7 @@ module Unipept
212
208
  if %w[ec go ipr].include? k
213
209
  v.each do |item|
214
210
  item.each do |field_name, field_value|
215
- new_field_name = %w[ec_number go_term ipr_code].include?(field_name) ? field_name : k + '_' + field_name
211
+ new_field_name = %w[ec_number go_term ipr_code].include?(field_name) ? field_name : "#{k}_#{field_name}"
216
212
  output_row[new_field_name] = [] unless output_row.key? new_field_name
217
213
  output_row[new_field_name] << field_value
218
214
  end
@@ -7,7 +7,7 @@ module Unipept
7
7
 
8
8
  if arguments.size == 2
9
9
  set_config(key, value)
10
- puts key + ' was set to ' + value
10
+ puts "#{key} was set to #{value}"
11
11
  else
12
12
  puts get_config(key)
13
13
  end
@@ -6,11 +6,7 @@ module Unipept::Commands
6
6
  end
7
7
 
8
8
  def default_batch_size
9
- if options[:all]
10
- 5
11
- else
12
- 10
13
- end
9
+ 5
14
10
  end
15
11
  end
16
12
  end
@@ -14,7 +14,7 @@ module Unipept::Commands
14
14
 
15
15
  if options[:format] == 'html'
16
16
  # Overwrite the URL for this command, since it's possible that it uses HTML generated by the server.
17
- @url = "#{@host}/api/v1/#{cmd.name}.html"
17
+ @url = "#{@host}/api/v2/#{cmd.name}.html"
18
18
  elsif args[:format] == 'url'
19
19
  @link = true
20
20
  end
@@ -34,7 +34,7 @@ module Unipept::Commands
34
34
 
35
35
  def input_iterator
36
36
  return arguments.each unless arguments.empty?
37
- return IO.foreach(options[:input]) if options[:input]
37
+ return File.foreach(options[:input]) if options[:input]
38
38
 
39
39
  @stdin_contents.each
40
40
  end
@@ -57,7 +57,7 @@ module Unipept::Commands
57
57
  splitted[1] = splitted[1].to_i
58
58
  splitted
59
59
  end
60
- data = Hash[data]
60
+ data = data.to_h
61
61
  else
62
62
  data = Hash.new 0
63
63
  input.each do |i|
@@ -2,8 +2,7 @@ require 'typhoeus'
2
2
 
3
3
  module Unipept::Commands
4
4
  class Uniprot
5
- attr_reader :root_command
6
- attr_reader :valid_formats
5
+ attr_reader :root_command, :valid_formats
7
6
 
8
7
  valid_formats = Set.new %w[fasta txt xml rdf gff sequence]
9
8
  @root_command = Cri::Command.define do
@@ -21,7 +20,7 @@ module Unipept::Commands
21
20
 
22
21
  The uniprot command yields just the protein sequences as a default, but can return several formats.
23
22
  EOS
24
- required :f, :format, 'specify output format (available: ' + valid_formats.to_a.join(', ') + ') (default: sequence)'
23
+ required :f, :format, "specify output format (available: #{valid_formats.to_a.join(', ')}) (default: sequence)"
25
24
  flag :h, :help, 'show help for this command' do |_value, cmd|
26
25
  puts cmd.help
27
26
  exit 0
@@ -29,7 +28,7 @@ module Unipept::Commands
29
28
  run do |opts, args, _cmd|
30
29
  format = opts.fetch(:format, 'sequence')
31
30
  unless valid_formats.include? format
32
- warn format + ' is not a valid output format. Available formats are: ' + valid_formats.to_a.join(', ')
31
+ warn "#{format} is not a valid output format. Available formats are: #{valid_formats.to_a.join(', ')}"
33
32
  exit 1
34
33
  end
35
34
  iterator = args.empty? ? $stdin.each_line : args
@@ -58,7 +57,7 @@ module Unipept::Commands
58
57
  # @return [String] The requested UniProt entry in the requested format
59
58
  def self.get_uniprot_entry(accession, format)
60
59
  if format == 'sequence'
61
- get_uniprot_entry(accession, 'fasta').lines.map(&:chomp)[1..-1].join('')
60
+ get_uniprot_entry(accession, 'fasta').lines.map(&:chomp)[1..].join
62
61
  else
63
62
  # other format has been specified, just download and output
64
63
  resp = Typhoeus.get("https://www.uniprot.org/uniprot/#{accession}.#{format}")
data/lib/configuration.rb CHANGED
@@ -2,8 +2,7 @@ require 'yaml'
2
2
 
3
3
  module Unipept
4
4
  class Configuration
5
- attr_reader :config
6
- attr_reader :file_name
5
+ attr_reader :config, :file_name
7
6
 
8
7
  # Creates a new config object, based on a given YAML file. If no filename
9
8
  # given, '.unipeptrc' in the home dir of the user will be used.
@@ -14,17 +13,17 @@ module Unipept
14
13
  # config from
15
14
  def initialize(file = nil)
16
15
  @file_name = file || File.join(Dir.home, '.unipeptrc')
17
- @config = if !File.exist? file_name
18
- {}
16
+ @config = if File.exist? file_name
17
+ YAML.load_file file_name, permitted_classes: [Time]
19
18
  else
20
- YAML.load_file file_name
19
+ {}
21
20
  end
22
21
  end
23
22
 
24
23
  # Saves the config to disk. If the file doesn't exist yet, a new one will be
25
24
  # created
26
25
  def save
27
- File.open(file_name, 'w') { |f| f.write config.to_yaml }
26
+ File.write(file_name, config.to_yaml)
28
27
  end
29
28
 
30
29
  # Deletes a key
@@ -39,7 +38,7 @@ module Unipept
39
38
 
40
39
  # forwards =[] to the internal config hash
41
40
  def []=(*args)
42
- config.[]=(*args)
41
+ config.[]=(*args) # rubocop:disable Layout/SpaceBeforeBrackets
43
42
  end
44
43
  end
45
44
  end
data/lib/formatters.rb CHANGED
@@ -156,7 +156,7 @@ module Unipept
156
156
  # @return [String] The converted input data in the JSON format
157
157
  def convert(data, first)
158
158
  output = data.map(&:to_json).join(',')
159
- first ? output : ',' + output
159
+ first ? output : ",#{output}"
160
160
  end
161
161
  end
162
162
 
@@ -178,7 +178,7 @@ module Unipept
178
178
 
179
179
  # First we look for items for both ec numbers, go terms and ipr codes that are fully filled in.
180
180
  data.each do |row|
181
- non_empty_items.keys.each do |annotation_type|
181
+ non_empty_items.each_key do |annotation_type|
182
182
  non_empty_items[annotation_type] = row if row[annotation_type] && !row[annotation_type].empty?
183
183
  end
184
184
  end
@@ -195,7 +195,7 @@ module Unipept
195
195
 
196
196
  idx = keys.index(annotation_type)
197
197
  keys.delete_at(idx)
198
- keys.insert(idx, *non_empty_item[annotation_type].first.keys.map { |el| %w[ec_number go_term ipr_code].include?(el) ? el : annotation_type + '_' + el })
198
+ keys.insert(idx, *non_empty_item[annotation_type].first.keys.map { |el| %w[ec_number go_term ipr_code].include?(el) ? el : "#{annotation_type}_#{el}" })
199
199
  $keys_length = *non_empty_item[annotation_type].first.keys.length # rubocop:disable Style/GlobalVars
200
200
  end
201
201
 
@@ -243,8 +243,8 @@ module Unipept
243
243
  o.each do |k, v|
244
244
  if %w[ec go ipr].include? k
245
245
  if v && !v.empty?
246
- v.first.keys.each do |key|
247
- row[key == 'protein_count' ? k + '_protein_count' : key] = (v.map { |el| el[key] }).join(' ').strip
246
+ v.first.each_key do |key|
247
+ row[key == 'protein_count' ? "#{k}_protein_count" : key] = (v.map { |el| el[key] }).join(' ').strip
248
248
  end
249
249
  else
250
250
  row[k] = row.concat(Array.new($keys_length[0], nil)) # rubocop:disable Style/GlobalVars
@@ -304,7 +304,7 @@ module Unipept
304
304
  #
305
305
  # @return [String] The converted input data in the XML format
306
306
  def convert(data, _first)
307
- data.map { |row| '<result>' + row.to_xml + '</result>' }.join('')
307
+ data.map { |row| "<result>#{row.to_xml}</result>" }.join
308
308
  end
309
309
  end
310
310
 
@@ -405,7 +405,7 @@ module Unipept
405
405
  #
406
406
  # @return [String] The converted input data in the Blast format
407
407
  def convert(data, _first)
408
- data[0]['gist'].sub!('https://gist.github.com/', 'https://bl.ocks.org/') + "\n"
408
+ "#{data[0]['gist'].sub!('https://gist.github.com/', 'https://bl.ocks.org/')}\n"
409
409
  end
410
410
  end
411
411
  end
@@ -4,12 +4,10 @@ require_relative 'configuration'
4
4
 
5
5
  module Unipept
6
6
  class ServerMessage
7
- attr_reader :message_url
8
-
9
- attr_reader :configuration
7
+ attr_reader :message_url, :configuration
10
8
 
11
9
  def initialize(host)
12
- @message_url = "#{host}/api/v1/messages.json"
10
+ @message_url = "#{host}/api/v2/messages.json"
13
11
  @configuration = Unipept::Configuration.new
14
12
  end
15
13
 
@@ -34,7 +32,7 @@ module Unipept
34
32
  # ago.
35
33
  def recently_fetched?
36
34
  last_fetched = @configuration['last_fetch_date']
37
- !last_fetched.nil? && (last_fetched + 60 * 60 * 24) > Time.now
35
+ !last_fetched.nil? && (last_fetched + (60 * 60 * 24)) > Time.now
38
36
  end
39
37
 
40
38
  # Updates the last checked timestamp
@@ -13,7 +13,7 @@ module Unipept
13
13
  assert_equal('test_host', runner.options[:host])
14
14
  assert_equal(%w[a b c], runner.arguments)
15
15
  assert(!runner.configuration.nil?)
16
- assert_equal('http://test_host/api/v1/test.json', runner.url)
16
+ assert_equal('http://test_host/api/v2/test.json', runner.url)
17
17
  assert(/Unipept CLI - unipept [0-9]*\.[0-9]*\.[0-9]*/.match runner.user_agent)
18
18
  end
19
19
 
@@ -67,8 +67,8 @@ module Unipept
67
67
  end
68
68
 
69
69
  def test_input_iterator_file
70
- File.open('input_file', 'w') { |file| file.write(%w[a b c].join("\n")) }
71
- runner = new_runner('test', host: 'https://param_host', input: 'input_file')
70
+ File.write('input_file', %w[a b c].join("\n"))
71
+ runner = new_runner('test', host: 'https://param_host', input: 'input_file')
72
72
  output = []
73
73
  runner.input_iterator.each { |el| output << el.chomp }
74
74
  assert_equal(%w[a b c], output)
@@ -84,7 +84,7 @@ module Unipept
84
84
  end
85
85
 
86
86
  def test_input_iterator_arguments_priority
87
- File.open('input_file', 'w') { |file| file.write(%w[1 2 3].join("\n")) }
87
+ File.write('input_file', %w[1 2 3].join("\n"))
88
88
  runner = new_runner('test', { host: 'https://param_host', input: 'input_file' }, %w[a b c])
89
89
  output = []
90
90
  _out, _err = capture_io_with_input(%w[1 2 3]) do
@@ -94,8 +94,8 @@ module Unipept
94
94
  end
95
95
 
96
96
  def test_input_iterator_file_priority
97
- File.open('input_file', 'w') { |file| file.write(%w[a b c].join("\n")) }
98
- runner = new_runner('test', host: 'https://param_host', input: 'input_file')
97
+ File.write('input_file', %w[a b c].join("\n"))
98
+ runner = new_runner('test', host: 'https://param_host', input: 'input_file')
99
99
  output = []
100
100
  _out, _err = capture_io_with_input(%w[1 2 3]) do
101
101
  runner.input_iterator.each { |el| output << el.chomp }
@@ -280,7 +280,7 @@ module Unipept
280
280
  runner.save_error('error message')
281
281
  end
282
282
  assert(err.start_with?('API request failed! log can be found in'))
283
- assert_equal('error message', IO.foreach('errordir/error.log').next.chomp)
283
+ assert_equal('error message', File.foreach('errordir/error.log').next.chomp)
284
284
  end
285
285
  end
286
286
 
@@ -319,7 +319,7 @@ module Unipept
319
319
  end
320
320
 
321
321
  def test_success_no_header_option_handle_response
322
- runner = new_runner('test', Hash[:host, 'test', :'no-header', true])
322
+ runner = new_runner('test', { host: 'test', 'no-header': true })
323
323
  response = new_response(success: true, response_body: '[{"key1":"value1","key2":"value1"},{"key1":"value2","key2":"value2"}]')
324
324
  lambda = runner.handle_response(response, 0, nil)
325
325
  assert(lambda.lambda?)
@@ -409,6 +409,7 @@ module Unipept
409
409
  def new_response(values)
410
410
  response = Class.new do
411
411
  def initialize(values)
412
+ super()
412
413
  @values = values
413
414
  end
414
415
 
@@ -44,7 +44,7 @@ module Unipept
44
44
  out, _err = capture_io_while do
45
45
  Commands::Unipept.run(['config', 'test', value])
46
46
  end
47
- assert_equal('test was set to ' + value, out.chomp)
47
+ assert_equal("test was set to #{value}", out.chomp)
48
48
  assert_equal(value, Unipept::Configuration.new['test'])
49
49
  end
50
50
 
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -88,7 +88,7 @@ module Unipept
88
88
  end
89
89
  lines = out.each_line
90
90
  assert_equal('', err)
91
- output = lines.to_a.join('').chomp
91
+ output = lines.to_a.join.chomp
92
92
  assert(output.start_with?('['))
93
93
  assert(output.end_with?(']'))
94
94
  assert(!output.include?('}{'))
@@ -101,7 +101,7 @@ module Unipept
101
101
  end
102
102
  lines = out.each_line
103
103
  assert_equal('', err)
104
- output = lines.to_a.join('').chomp
104
+ output = lines.to_a.join.chomp
105
105
  assert(output.start_with?('<results>'))
106
106
  assert(output.end_with?('</results>'))
107
107
  assert(output.include?('<fasta_header>'))
@@ -5,8 +5,6 @@ module Unipept
5
5
  def test_default_batch_size
6
6
  command = Cri::Command.define { name 'pept2taxa' }
7
7
  pept2taxa = Commands::Pept2taxa.new({ host: 'http://api.unipept.ugent.be' }, [], command)
8
- assert_equal(10, pept2taxa.default_batch_size)
9
- pept2taxa.options[:all] = true
10
8
  assert_equal(5, pept2taxa.default_batch_size)
11
9
  end
12
10
 
@@ -72,7 +70,7 @@ module Unipept
72
70
  end
73
71
  lines = out.each_line
74
72
  assert_equal('', err)
75
- output = lines.to_a.join('').chomp
73
+ output = lines.to_a.join.chomp
76
74
  assert(output.start_with?('['))
77
75
  assert(output.end_with?(']'))
78
76
  assert(!output.include?('}{'))
@@ -85,7 +83,7 @@ module Unipept
85
83
  end
86
84
  lines = out.each_line
87
85
  assert_equal('', err)
88
- output = lines.to_a.join('').chomp
86
+ output = lines.to_a.join.chomp
89
87
  assert(output.start_with?('<results>'))
90
88
  assert(output.end_with?('</results>'))
91
89
  assert(output.include?('<fasta_header>'))
@@ -87,7 +87,7 @@ module Unipept
87
87
  end
88
88
  lines = out.each_line
89
89
  assert_equal('', err)
90
- output = lines.to_a.join('').chomp
90
+ output = lines.to_a.join.chomp
91
91
  assert(output.start_with?('['))
92
92
  assert(output.end_with?(']'))
93
93
  assert(!output.include?('}{'))
@@ -100,7 +100,7 @@ module Unipept
100
100
  end
101
101
  lines = out.each_line
102
102
  assert_equal('', err)
103
- output = lines.to_a.join('').chomp
103
+ output = lines.to_a.join.chomp
104
104
  assert(output.start_with?('<results>'))
105
105
  assert(output.end_with?('</results>'))
106
106
  assert(output.include?('<fasta_header>'))
@@ -47,7 +47,7 @@ module Unipept
47
47
  Commands::Unipept.run(%w[taxa2lca --host http://api.unipept.ugent.be --format xml 216816 1680])
48
48
  end
49
49
  lines = out.each_line
50
- output = lines.to_a.join('').chomp
50
+ output = lines.to_a.join.chomp
51
51
  assert_equal('', err)
52
52
  assert(output.start_with?('<results>'))
53
53
  assert(output.end_with?('</results>'))
@@ -58,7 +58,7 @@ module Unipept
58
58
  Commands::Unipept.run(%w[taxa2lca --host http://api.unipept.ugent.be --format json 216816 1680])
59
59
  end
60
60
  lines = out.each_line
61
- output = lines.to_a.join('').chomp
61
+ output = lines.to_a.join.chomp
62
62
  assert_equal('', err)
63
63
  assert(output.start_with?('['))
64
64
  assert(output.end_with?(']'))
@@ -36,7 +36,7 @@ module Unipept
36
36
  Commands::Unipept.run(%w[taxa2tree --host http://api.unipept.ugent.be 78 57 89 28 67])
37
37
  end
38
38
  lines = out.each_line
39
- output = lines.to_a.join('').chomp
39
+ output = lines.to_a.join.chomp
40
40
  assert_equal('', err)
41
41
 
42
42
  assert(output.start_with?('{'))
@@ -60,7 +60,7 @@ module Unipept
60
60
  end
61
61
  lines = out.each_line
62
62
  assert_equal('', err)
63
- output = lines.to_a.join('').chomp
63
+ output = lines.to_a.join.chomp
64
64
  assert(output.start_with?('<!DOCTYPE html>'))
65
65
  assert(output.end_with?('</html>'))
66
66
  assert(output.include?('</body>'))
@@ -70,7 +70,7 @@ module Unipept
70
70
  end
71
71
  lines = out.each_line
72
72
  assert_equal('', err)
73
- output = lines.to_a.join('').chomp
73
+ output = lines.to_a.join.chomp
74
74
  assert(output.start_with?('['))
75
75
  assert(output.end_with?(']'))
76
76
  assert(!output.include?('}{'))
@@ -83,7 +83,7 @@ module Unipept
83
83
  end
84
84
  lines = out.each_line
85
85
  assert_equal('', err)
86
- output = lines.to_a.join('').chomp
86
+ output = lines.to_a.join.chomp
87
87
  assert(output.start_with?('<results>'))
88
88
  assert(output.end_with?('</results>'))
89
89
  assert(output.include?('<fasta_header>'))
@@ -15,7 +15,7 @@ class ApiStub
15
15
 
16
16
  def setup_endpoint(name)
17
17
  items = JSON.parse(File.read(File.join(File.dirname(__FILE__), "resources/#{name}.json")))
18
- Typhoeus.stub("http://api.unipept.ugent.be/api/v1/#{name}.json").and_return do |req|
18
+ Typhoeus.stub("http://api.unipept.ugent.be/api/v2/#{name}.json").and_return do |req|
19
19
  peptides = req.options[:body][:input]
20
20
 
21
21
  filtered = items.select { |item| peptides.include? item['peptide'] }
@@ -25,7 +25,7 @@ class ApiStub
25
25
  end
26
26
 
27
27
  def setup_taxa2lca
28
- Typhoeus.stub('http://api.unipept.ugent.be/api/v1/taxa2lca.json').and_return(
28
+ Typhoeus.stub('http://api.unipept.ugent.be/api/v2/taxa2lca.json').and_return(
29
29
  Typhoeus::Response.new(code: 200, body: '{
30
30
  "taxon_id": 1678,
31
31
  "taxon_name": "Bifidobacterium",
@@ -36,7 +36,7 @@ class ApiStub
36
36
 
37
37
  def setup_taxonomy
38
38
  items = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'resources/taxonomy.json')))
39
- Typhoeus.stub('http://api.unipept.ugent.be/api/v1/taxonomy.json').and_return do |req|
39
+ Typhoeus.stub('http://api.unipept.ugent.be/api/v2/taxonomy.json').and_return do |req|
40
40
  taxa = req.options[:body][:input].map(&:to_i)
41
41
 
42
42
  filtered = items.select { |item| taxa.include? item['taxon_id'] }
@@ -47,7 +47,7 @@ class ApiStub
47
47
 
48
48
  # Expects to be called with taxa "78", "57", "89", "28" and "67"
49
49
  def setup_taxa2tree
50
- Typhoeus.stub('http://api.unipept.ugent.be/api/v1/taxa2tree.json').and_return do |_|
50
+ Typhoeus.stub('http://api.unipept.ugent.be/api/v2/taxa2tree.json').and_return do |_|
51
51
  link = req.options[:body][:link] == 'true'
52
52
  if link
53
53
  Typhoeus::Response.new(code: 200, body: JSON.dump(gist: 'https://gist.github.com/8837824df7ef9831a9b4216f3fb547ee'))
@@ -9,7 +9,7 @@ module Unipept
9
9
 
10
10
  def test_load_with_file
11
11
  hash = { 'key' => 'value' }
12
- File.open('new_file', 'w') { |f| f.write hash.to_yaml }
12
+ File.write('new_file', hash.to_yaml)
13
13
  config = Configuration.new('new_file')
14
14
  assert_equal(hash, config.config)
15
15
  end
@@ -114,7 +114,7 @@ module Unipept
114
114
 
115
115
  def test_convert
116
116
  assert_equal(TestObject.as_json, formatter.convert([TestObject.test_object], true))
117
- assert_equal(',' + TestObject.as_json, formatter.convert([TestObject.test_object], false))
117
+ assert_equal(",#{TestObject.as_json}", formatter.convert([TestObject.test_object], false))
118
118
  end
119
119
 
120
120
  def test_format_with_fasta
@@ -159,7 +159,7 @@ module Unipept
159
159
  fasta = [['peptide', '>test']]
160
160
  object = [TestObject.test_object, TestObject.test_object]
161
161
  assert_equal(TestObject.as_csv_header, formatter.header(object))
162
- assert_equal('fasta_header,' + TestObject.as_csv_header, formatter.header(object, fasta))
162
+ assert_equal("fasta_header,#{TestObject.as_csv_header}", formatter.header(object, fasta))
163
163
  end
164
164
 
165
165
  def test_footer
@@ -180,7 +180,7 @@ module Unipept
180
180
  def test_format_with_fasta
181
181
  fasta = [['>test', '5']]
182
182
  object = [TestObject.test_object, TestObject.test_object]
183
- csv = ['>test,' + TestObject.as_csv, '>test,' + TestObject.as_csv, ''].join("\n")
183
+ csv = [">test,#{TestObject.as_csv}", ">test,#{TestObject.as_csv}", ''].join("\n")
184
184
  assert_equal(csv, formatter.format(object, fasta, false))
185
185
  end
186
186
  end
@@ -203,7 +203,7 @@ module Unipept
203
203
  end
204
204
 
205
205
  def test_convert
206
- xml = '<result>' + TestObject.as_xml + '</result>'
206
+ xml = "<result>#{TestObject.as_xml}</result>"
207
207
  assert_equal(xml, formatter.convert([TestObject.test_object], true))
208
208
  assert_equal(xml, formatter.convert([TestObject.test_object], false))
209
209
  end
@@ -211,7 +211,7 @@ module Unipept
211
211
  def test_format_with_fasta
212
212
  fasta = [['>test', '5']]
213
213
  output = formatter.format([TestObject.test_object], fasta, false)
214
- xml = '<result><fasta_header>>test</fasta_header>' + TestObject.as_xml + '</result>'
214
+ xml = "<result><fasta_header>>test</fasta_header>#{TestObject.as_xml}</result>"
215
215
  assert_equal(xml, output)
216
216
  end
217
217
  end
@@ -23,7 +23,7 @@ module Unipept
23
23
  writer.output.flush
24
24
  end
25
25
  assert_equal('', out)
26
- assert_equal('hello world', IO.foreach('output_file').next.chomp)
26
+ assert_equal('hello world', File.foreach('output_file').next.chomp)
27
27
  end
28
28
  end
29
29
  end
@@ -3,7 +3,7 @@ require_relative '../lib/server_message'
3
3
  module Unipept
4
4
  class ServerMessageTestCase < Unipept::TestCase
5
5
  def test_init
6
- assert_equal('http://test_host/api/v1/messages.json', ServerMessage.new('http://test_host').message_url)
6
+ assert_equal('http://test_host/api/v2/messages.json', ServerMessage.new('http://test_host').message_url)
7
7
  end
8
8
 
9
9
  def test_fetch_server_message
@@ -79,13 +79,13 @@ module Unipept
79
79
 
80
80
  def test_old_recently_fetched
81
81
  server = ServerMessage.new('http://api.unipept.ugent.be')
82
- server.configuration['last_fetch_date'] = Time.now - 60 * 60 * 25
82
+ server.configuration['last_fetch_date'] = Time.now - (60 * 60 * 25)
83
83
  assert(!server.recently_fetched?)
84
84
  end
85
85
 
86
86
  def test_recently_recently_fetched
87
87
  server = ServerMessage.new('http://api.unipept.ugent.be')
88
- server.configuration['last_fetch_date'] = Time.now - 60 * 60 * 1
88
+ server.configuration['last_fetch_date'] = Time.now - (60 * 60 * 1)
89
89
  assert(server.recently_fetched?)
90
90
  end
91
91
  end
data/unipept.gemspec CHANGED
@@ -1,17 +1,17 @@
1
- # Generated by jeweler
1
+ # Generated by juwelier
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: unipept 2.2.0 ruby lib
5
+ # stub: unipept 3.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "unipept".freeze
9
- s.version = "2.2.0"
9
+ s.version = "3.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Bart Mesuere".freeze, "Pieter Verschaffelt".freeze, "Toon Willems".freeze, "Tom Naessens".freeze]
14
- s.date = "2020-04-27"
14
+ s.date = "2022-04-14"
15
15
  s.description = " Command line interface to the Unipept (http://unipept.ugent.be) web services\n (pept2lca, taxa2lca, pept2taxa, pept2prot and taxonomy) and some utility\n commands for handling proteins using the command line.\n".freeze
16
16
  s.email = "unipept@ugent.be".freeze
17
17
  s.executables = ["unipept".freeze, "prot2pept".freeze, "peptfilter".freeze, "uniprot".freeze]
@@ -21,10 +21,12 @@ Gem::Specification.new do |s|
21
21
  ]
22
22
  s.files = [
23
23
  ".document",
24
+ ".github/dependabot.yml",
24
25
  ".github/workflows/ci.yml",
25
26
  ".rakeTasks",
26
27
  ".rubocop.yml",
27
28
  ".ruby-version",
29
+ "CITATION.cff",
28
30
  "Gemfile",
29
31
  "Gemfile.lock",
30
32
  "LICENSE.txt",
@@ -102,32 +104,26 @@ Gem::Specification.new do |s|
102
104
  ]
103
105
  s.homepage = "http://unipept.ugent.be".freeze
104
106
  s.licenses = ["MIT".freeze]
105
- s.required_ruby_version = Gem::Requirement.new(">= 2.0.0".freeze)
106
- s.rubygems_version = "3.0.3".freeze
107
+ s.required_ruby_version = Gem::Requirement.new(">= 2.6.0".freeze)
108
+ s.rubygems_version = "3.1.4".freeze
107
109
  s.summary = "Command line interface to Unipept web services.".freeze
108
110
 
109
111
  if s.respond_to? :specification_version then
110
112
  s.specification_version = 4
113
+ end
111
114
 
112
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
113
- s.add_runtime_dependency(%q<cri>.freeze, ["~> 2.15.10"])
114
- s.add_runtime_dependency(%q<typhoeus>.freeze, ["~> 1.3.1"])
115
- s.add_development_dependency(%q<minitest>.freeze, ["~> 5.14"])
116
- s.add_development_dependency(%q<rake>.freeze, ["~> 13.0.1"])
117
- s.add_development_dependency(%q<rubocop>.freeze, ["~> 0.79.0"])
118
- else
119
- s.add_dependency(%q<cri>.freeze, ["~> 2.15.10"])
120
- s.add_dependency(%q<typhoeus>.freeze, ["~> 1.3.1"])
121
- s.add_dependency(%q<minitest>.freeze, ["~> 5.14"])
122
- s.add_dependency(%q<rake>.freeze, ["~> 13.0.1"])
123
- s.add_dependency(%q<rubocop>.freeze, ["~> 0.79.0"])
124
- end
115
+ if s.respond_to? :add_runtime_dependency then
116
+ s.add_runtime_dependency(%q<cri>.freeze, ["~> 2.15.10"])
117
+ s.add_runtime_dependency(%q<typhoeus>.freeze, ["~> 1.3.1"])
118
+ s.add_development_dependency(%q<minitest>.freeze, ["~> 5.14"])
119
+ s.add_development_dependency(%q<rake>.freeze, ["~> 13.0.1"])
120
+ s.add_development_dependency(%q<rubocop>.freeze, ["~> 1.11"])
125
121
  else
126
122
  s.add_dependency(%q<cri>.freeze, ["~> 2.15.10"])
127
123
  s.add_dependency(%q<typhoeus>.freeze, ["~> 1.3.1"])
128
124
  s.add_dependency(%q<minitest>.freeze, ["~> 5.14"])
129
125
  s.add_dependency(%q<rake>.freeze, ["~> 13.0.1"])
130
- s.add_dependency(%q<rubocop>.freeze, ["~> 0.79.0"])
126
+ s.add_dependency(%q<rubocop>.freeze, ["~> 1.11"])
131
127
  end
132
128
  end
133
129
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unipept
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Mesuere
8
8
  - Pieter Verschaffelt
9
9
  - Toon Willems
10
10
  - Tom Naessens
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-04-27 00:00:00.000000000 Z
14
+ date: 2022-04-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cri
@@ -75,14 +75,14 @@ dependencies:
75
75
  requirements:
76
76
  - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: 0.79.0
78
+ version: '1.11'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: 0.79.0
85
+ version: '1.11'
86
86
  description: |2
87
87
  Command line interface to the Unipept (http://unipept.ugent.be) web services
88
88
  (pept2lca, taxa2lca, pept2taxa, pept2prot and taxonomy) and some utility
@@ -99,10 +99,12 @@ extra_rdoc_files:
99
99
  - README.md
100
100
  files:
101
101
  - ".document"
102
+ - ".github/dependabot.yml"
102
103
  - ".github/workflows/ci.yml"
103
104
  - ".rakeTasks"
104
105
  - ".rubocop.yml"
105
106
  - ".ruby-version"
107
+ - CITATION.cff
106
108
  - Gemfile
107
109
  - Gemfile.lock
108
110
  - LICENSE.txt
@@ -181,7 +183,7 @@ homepage: http://unipept.ugent.be
181
183
  licenses:
182
184
  - MIT
183
185
  metadata: {}
184
- post_install_message:
186
+ post_install_message:
185
187
  rdoc_options: []
186
188
  require_paths:
187
189
  - lib
@@ -189,15 +191,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
191
  requirements:
190
192
  - - ">="
191
193
  - !ruby/object:Gem::Version
192
- version: 2.0.0
194
+ version: 2.6.0
193
195
  required_rubygems_version: !ruby/object:Gem::Requirement
194
196
  requirements:
195
197
  - - ">="
196
198
  - !ruby/object:Gem::Version
197
199
  version: '0'
198
200
  requirements: []
199
- rubygems_version: 3.0.3
200
- signing_key:
201
+ rubygems_version: 3.1.4
202
+ signing_key:
201
203
  specification_version: 4
202
204
  summary: Command line interface to Unipept web services.
203
205
  test_files: []