unipept 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1754c5a267fc5f4693eac69a39829976faf9ef2
4
- data.tar.gz: 51466d18f6e9938285c3a6f9c0ff792744a37f67
3
+ metadata.gz: 17fb4ae25816764349c1961d48289be0841b3e6a
4
+ data.tar.gz: b484dc7db887da7172d408c75611083914d34049
5
5
  SHA512:
6
- metadata.gz: df489439d29c756b4694d400ab23770fef551e5368023c2cd626e3c0eceaef377c1d46b4bfe912a157efc1d88f92fb8a3bef3938c3726176a57dc6933fcab1f9
7
- data.tar.gz: 3cf20e18248e59b2f1f777b69ca022da8b83b2964fa9ea06301e77ca6946507a53043472156e44cce5e8a6e861b292b3e1558e65b7a9a17265adff407f500a38
6
+ metadata.gz: b4066aae51893a28a45fcaccb77f847c41ab39d8fa997e7445a16683904a9270a9b663e01e99860c0d65c5dd08cf941ce8d938081e252d677d6c9512d0ecd2b7
7
+ data.tar.gz: ef1144113dc60261e27b23d90c351f59410bdb7701203b81309e37d2e72aa21f1c7e8c663ef3488d019d9cab763f14b7da437a8a49a2cb034b271490728d084c
@@ -8,6 +8,8 @@ AllCops:
8
8
  Style/ClassAndModuleChildren:
9
9
  EnforcedStyle: compact
10
10
  Enabled: false
11
+ Style/FrozenStringLiteralComment:
12
+ Enabled: false
11
13
 
12
14
  # disable for now
13
15
  Lint/NestedMethodDefinition:
@@ -26,3 +28,5 @@ Metrics/LineLength:
26
28
  Enabled: false
27
29
  Metrics/MethodLength:
28
30
  Enabled: false
31
+ Metrics/BlockLength:
32
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.4.0
@@ -1,9 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.4.0
3
4
  - 2.3.3
4
- - 2.2.5
5
+ - 2.2.6
5
6
  - 2.1.9
6
7
  - 2.0.0
7
8
 
9
+ install:
10
+ - bundle install --without release
11
+
8
12
  notifications:
9
13
  slack: zeuswpi:yBidVPnaP2JuP2zfa36Ew0E1
data/Gemfile CHANGED
@@ -2,14 +2,16 @@ source 'http://rubygems.org'
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
-
6
5
  gem 'cri', '~> 2.7'
7
- gem 'typhoeus', '0.7.2'
6
+ gem 'typhoeus', '~> 1.1'
8
7
 
9
8
  group :development do
10
9
  gem 'rake', '~> 10.4'
11
10
  gem 'minitest', '~> 5.7'
12
11
  gem 'rubocop', '~>0.32'
13
- gem 'jeweler', '~> 2.0'
14
12
  gem 'coveralls', '~> 0', require: false
15
13
  end
14
+
15
+ group :release do
16
+ gem 'jeweler'
17
+ end
@@ -1,103 +1,94 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.8)
5
- ast (2.0.0)
6
- astrolabe (1.3.0)
7
- parser (>= 2.2.0.pre.3, < 3.0)
8
- builder (3.2.2)
4
+ addressable (2.5.0)
5
+ public_suffix (~> 2.0, >= 2.0.2)
6
+ ast (2.3.0)
7
+ builder (3.2.3)
9
8
  colored (1.2)
10
- coveralls (0.8.2)
11
- json (~> 1.8)
12
- rest-client (>= 1.6.8, < 2)
13
- simplecov (~> 0.10.0)
9
+ coveralls (0.8.18)
10
+ json (>= 1.8, < 3)
11
+ simplecov (~> 0.12.0)
14
12
  term-ansicolor (~> 1.3)
15
13
  thor (~> 0.19.1)
16
- cri (2.7.0)
14
+ tins (~> 1.6)
15
+ cri (2.7.1)
17
16
  colored (~> 1.2)
18
17
  descendants_tracker (0.0.4)
19
18
  thread_safe (~> 0.3, >= 0.3.1)
20
19
  docile (1.1.5)
21
- domain_name (0.5.24)
22
- unf (>= 0.0.5, < 1.0.0)
23
- ethon (0.7.4)
20
+ ethon (0.10.1)
24
21
  ffi (>= 1.3.0)
25
- faraday (0.9.1)
22
+ faraday (0.9.2)
26
23
  multipart-post (>= 1.2, < 3)
27
- ffi (1.9.10)
28
- git (1.2.9.1)
29
- github_api (0.12.3)
24
+ ffi (1.9.17)
25
+ git (1.3.0)
26
+ github_api (0.11.3)
30
27
  addressable (~> 2.3)
31
- descendants_tracker (~> 0.0.4)
28
+ descendants_tracker (~> 0.0.1)
32
29
  faraday (~> 0.8, < 0.10)
33
- hashie (>= 3.3)
30
+ hashie (>= 1.2)
34
31
  multi_json (>= 1.7.5, < 2.0)
35
- nokogiri (~> 1.6.3)
32
+ nokogiri (~> 1.6.0)
36
33
  oauth2
37
- hashie (3.4.2)
38
- highline (1.7.2)
39
- http-cookie (1.0.2)
40
- domain_name (~> 0.5)
41
- jeweler (2.0.1)
34
+ hashie (3.4.6)
35
+ highline (1.7.8)
36
+ jeweler (2.3.2)
42
37
  builder
43
38
  bundler (>= 1.0)
44
39
  git (>= 1.2.5)
45
- github_api
40
+ github_api (~> 0.11.0)
46
41
  highline (>= 1.6.15)
47
42
  nokogiri (>= 1.5.10)
43
+ psych (~> 2.2)
48
44
  rake
49
45
  rdoc
50
- json (1.8.3)
51
- jwt (1.5.1)
52
- mime-types (2.6.1)
53
- mini_portile (0.6.2)
54
- minitest (5.7.0)
55
- multi_json (1.11.1)
56
- multi_xml (0.5.5)
46
+ semver2
47
+ json (2.0.3)
48
+ jwt (1.5.6)
49
+ mini_portile2 (2.1.0)
50
+ minitest (5.10.1)
51
+ multi_json (1.12.1)
52
+ multi_xml (0.6.0)
57
53
  multipart-post (2.0.0)
58
- netrc (0.10.3)
59
- nokogiri (1.6.6.2)
60
- mini_portile (~> 0.6.0)
61
- oauth2 (1.0.0)
62
- faraday (>= 0.8, < 0.10)
54
+ nokogiri (1.6.8.1)
55
+ mini_portile2 (~> 2.1.0)
56
+ oauth2 (1.3.0)
57
+ faraday (>= 0.8, < 0.11)
63
58
  jwt (~> 1.0)
64
59
  multi_json (~> 1.3)
65
60
  multi_xml (~> 0.5)
66
- rack (~> 1.2)
67
- parser (2.3.0.pre.2)
68
- ast (>= 1.1, < 3.0)
61
+ rack (>= 1.2, < 3)
62
+ parser (2.3.3.1)
63
+ ast (~> 2.2)
69
64
  powerpack (0.1.1)
70
- rack (1.6.4)
71
- rainbow (2.0.0)
72
- rake (10.4.2)
73
- rdoc (4.2.0)
74
- json (~> 1.4)
75
- rest-client (1.8.0)
76
- http-cookie (>= 1.0.2, < 2.0)
77
- mime-types (>= 1.16, < 3.0)
78
- netrc (~> 0.7)
79
- rubocop (0.32.1)
80
- astrolabe (~> 1.3)
81
- parser (>= 2.2.2.5, < 3.0)
65
+ psych (2.2.2)
66
+ public_suffix (2.0.5)
67
+ rack (2.0.1)
68
+ rainbow (2.2.1)
69
+ rake (10.5.0)
70
+ rdoc (5.0.0)
71
+ rubocop (0.47.0)
72
+ parser (>= 2.3.3.1, < 3.0)
82
73
  powerpack (~> 0.1)
83
74
  rainbow (>= 1.99.1, < 3.0)
84
- ruby-progressbar (~> 1.4)
85
- ruby-progressbar (1.7.5)
86
- simplecov (0.10.0)
75
+ ruby-progressbar (~> 1.7)
76
+ unicode-display_width (~> 1.0, >= 1.0.1)
77
+ ruby-progressbar (1.8.1)
78
+ semver2 (3.4.2)
79
+ simplecov (0.12.0)
87
80
  docile (~> 1.1.0)
88
- json (~> 1.8)
81
+ json (>= 1.8, < 3)
89
82
  simplecov-html (~> 0.10.0)
90
83
  simplecov-html (0.10.0)
91
- term-ansicolor (1.3.2)
84
+ term-ansicolor (1.4.0)
92
85
  tins (~> 1.0)
93
- thor (0.19.1)
86
+ thor (0.19.4)
94
87
  thread_safe (0.3.5)
95
- tins (1.5.4)
96
- typhoeus (0.7.2)
97
- ethon (>= 0.7.4)
98
- unf (0.1.4)
99
- unf_ext
100
- unf_ext (0.0.7.1)
88
+ tins (1.13.0)
89
+ typhoeus (1.1.2)
90
+ ethon (>= 0.9.0)
91
+ unicode-display_width (1.1.3)
101
92
 
102
93
  PLATFORMS
103
94
  ruby
@@ -105,11 +96,11 @@ PLATFORMS
105
96
  DEPENDENCIES
106
97
  coveralls (~> 0)
107
98
  cri (~> 2.7)
108
- jeweler (~> 2.0)
99
+ jeweler
109
100
  minitest (~> 5.7)
110
101
  rake (~> 10.4)
111
102
  rubocop (~> 0.32)
112
- typhoeus (= 0.7.2)
103
+ typhoeus (~> 1.1)
113
104
 
114
105
  BUNDLED WITH
115
- 1.10.3
106
+ 1.13.7
data/Rakefile CHANGED
@@ -12,25 +12,28 @@ end
12
12
  require 'rake'
13
13
  require 'rake/testtask'
14
14
  require 'rubocop/rake_task'
15
-
16
- require 'jeweler'
17
- Jeweler::Tasks.new do |gem|
18
- # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
19
- gem.name = 'unipept'
20
- gem.executables = %w(unipept prot2pept peptfilter uniprot)
21
- gem.homepage = 'http://unipept.ugent.be'
22
- gem.license = 'MIT'
23
- gem.summary = 'Command line interface to Unipept web services.'
24
- gem.description = <<-EOS
25
- Command line interface to the Unipept (http://unipept.ugent.be) web services
26
- (pept2lca, taxa2lca, pept2taxa, pept2prot and taxonomy) and some utility
27
- commands for handling proteins using the command line.
28
- EOS
29
- gem.email = 'unipept@ugent.be'
30
- gem.authors = ['Toon Willems', 'Bart Mesuere', 'Tom Naessens']
31
- gem.required_ruby_version = '>= 2.0.0'
15
+ begin
16
+ require 'jeweler'
17
+ Jeweler::Tasks.new do |gem|
18
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
19
+ gem.name = 'unipept'
20
+ gem.executables = %w(unipept prot2pept peptfilter uniprot)
21
+ gem.homepage = 'http://unipept.ugent.be'
22
+ gem.license = 'MIT'
23
+ gem.summary = 'Command line interface to Unipept web services.'
24
+ gem.description = <<-EOS
25
+ Command line interface to the Unipept (http://unipept.ugent.be) web services
26
+ (pept2lca, taxa2lca, pept2taxa, pept2prot and taxonomy) and some utility
27
+ commands for handling proteins using the command line.
28
+ EOS
29
+ gem.email = 'unipept@ugent.be'
30
+ gem.authors = ['Toon Willems', 'Bart Mesuere', 'Tom Naessens']
31
+ gem.required_ruby_version = '>= 2.0.0'
32
+ end
33
+ Jeweler::RubygemsDotOrgTasks.new
34
+ rescue LoadError
35
+ # do nothing
32
36
  end
33
- Jeweler::RubygemsDotOrgTasks.new
34
37
 
35
38
  task :test_unit do
36
39
  require './test/helper.rb'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -39,7 +39,7 @@ module Unipept
39
39
  # Splits the input lines in fasta format into slices, based on the
40
40
  # batch_size of the current command. Executes the given block for each of
41
41
  # the batches.
42
- def fasta_iterator(first_line, next_lines, &block)
42
+ def fasta_iterator(first_line, next_lines)
43
43
  current_fasta_header = first_line.chomp
44
44
  next_lines.each_slice(batch_size).with_index do |slice, i|
45
45
  fasta_mapper = []
@@ -55,7 +55,7 @@ module Unipept
55
55
  end
56
56
  end
57
57
 
58
- block.call(input_set.to_a, i, fasta_mapper)
58
+ yield(input_set.to_a, i, fasta_mapper)
59
59
  end
60
60
  end
61
61
 
@@ -98,7 +98,7 @@ module Unipept::Commands
98
98
  #
99
99
  # @return [Boolean] true if the peptide satisfies all requirements
100
100
  def self.filter_lacks(peptide, lacks)
101
- (peptide.chars.to_a & lacks).size == 0
101
+ (peptide.chars.to_a & lacks).empty?
102
102
  end
103
103
 
104
104
  # Checks if a peptide satisfies the contains requirement.
@@ -25,7 +25,7 @@ module Unipept
25
25
  host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?
26
26
 
27
27
  # add http:// if needed
28
- if host.start_with?('http://') || host.start_with?('https://')
28
+ if host.start_with?('http://', 'https://')
29
29
  host
30
30
  else
31
31
  "http://#{host}"
@@ -48,7 +48,7 @@ module Unipept
48
48
 
49
49
  # Returns the default default_batch_size of a command.
50
50
  def default_batch_size
51
- fail NotImplementedError, 'This must be implemented in a subclass.'
51
+ raise NotImplementedError, 'This must be implemented in a subclass.'
52
52
  end
53
53
 
54
54
  # returns the effective batch_size of a command
@@ -102,8 +102,7 @@ module Unipept
102
102
  { input: input,
103
103
  equate_il: options[:equate] == true,
104
104
  extra: options[:all] == true,
105
- names: options[:all] == true && names
106
- }
105
+ names: options[:all] == true && names }
107
106
  end
108
107
 
109
108
  # Runs the command
@@ -114,7 +113,7 @@ module Unipept
114
113
  last_id = 0
115
114
 
116
115
  batch_iterator.iterate(input_iterator) do |input_slice, batch_id, fasta_mapper|
117
- last_id = batch_id
116
+ last_id = batch_id
118
117
  request = ::RetryableTyphoeus::Request.new(
119
118
  @url,
120
119
  method: :post,
@@ -129,7 +128,7 @@ module Unipept
129
128
  end
130
129
 
131
130
  hydra.queue request
132
- hydra.run if batch_id % queue_size == 0
131
+ hydra.run if (batch_id % queue_size).zero?
133
132
  end
134
133
 
135
134
  hydra.run
@@ -166,8 +165,8 @@ module Unipept
166
165
 
167
166
  lambda do
168
167
  unless result.empty?
169
- output_writer.write_line formatter.header(result, fasta_mapper) if batch_id == 0
170
- output_writer.write_line formatter.format(result, fasta_mapper, batch_id == 0)
168
+ output_writer.write_line formatter.header(result, fasta_mapper) if batch_id.zero?
169
+ output_writer.write_line formatter.format(result, fasta_mapper, batch_id.zero?)
171
170
  end
172
171
  end
173
172
  end
@@ -175,7 +174,7 @@ module Unipept
175
174
  def handle_failed_response(response)
176
175
  if response.timed_out?
177
176
  -> { save_error('request timed out, continuing anyway, but results might be incomplete') }
178
- elsif response.code == 0
177
+ elsif response.code.zero?
179
178
  -> { save_error('could not get an http response, continuing anyway, but results might be incomplete' + response.return_message) }
180
179
  else
181
180
  -> { save_error("Got #{response.code}: #{response.response_body}\nRequest headers: #{response.request.options}\nRequest body:\n#{response.request.encoded_body}\n\n") }
@@ -1,7 +1,7 @@
1
1
  module Unipept
2
2
  class Commands::Config < Cri::CommandRunner
3
3
  def run
4
- abort command.help if arguments.size == 0 || arguments.size > 2
4
+ abort command.help if arguments.empty? || arguments.size > 2
5
5
 
6
6
  key, value = *arguments
7
7
 
@@ -6,13 +6,13 @@ module Unipept::Commands
6
6
  end
7
7
 
8
8
  def default_batch_size
9
- fail 'NOT NEEDED FOR TAXA2LCA'
9
+ raise 'NOT NEEDED FOR TAXA2LCA'
10
10
  end
11
11
  end
12
12
 
13
13
  class SimpleBatchIterator
14
- def iterate(input, &block)
15
- block.call(input.to_a, 0)
14
+ def iterate(input)
15
+ yield(input.to_a, 0)
16
16
  end
17
17
  end
18
18
  end
@@ -14,11 +14,11 @@ module Unipept
14
14
  # config from
15
15
  def initialize(file = nil)
16
16
  @file_name = file ? file : File.join(Dir.home, '.unipeptrc')
17
- if !File.exist? file_name
18
- @config = {}
19
- else
20
- @config = YAML.load_file file_name
21
- end
17
+ @config = if !File.exist? file_name
18
+ {}
19
+ else
20
+ YAML.load_file file_name
21
+ end
22
22
  end
23
23
 
24
24
  # Saves the config to disk. If the file doesn't exist yet, a new one will be
@@ -42,7 +42,7 @@ module Unipept
42
42
 
43
43
  # @return [String] The type of the current formatter
44
44
  def type
45
- fail NotImplementedError, 'This must be implemented in a subclass.'
45
+ raise NotImplementedError, 'This must be implemented in a subclass.'
46
46
  end
47
47
 
48
48
  # Returns the header row for the given sample_data and fasta_mapper. This
@@ -58,7 +58,7 @@ module Unipept
58
58
  #
59
59
  # @return [String] The header row
60
60
  def header(_sample_data, _fasta_mapper = nil)
61
- fail NotImplementedError, 'This must be implemented in a subclass.'
61
+ raise NotImplementedError, 'This must be implemented in a subclass.'
62
62
  end
63
63
 
64
64
  # Returns the footer row. This row is output only once at the end of the
@@ -66,7 +66,7 @@ module Unipept
66
66
  #
67
67
  # @return [String] The footer row
68
68
  def footer
69
- fail NotImplementedError, 'This must be implemented in a subclass.'
69
+ raise NotImplementedError, 'This must be implemented in a subclass.'
70
70
  end
71
71
 
72
72
  # Converts the given input data and corresponding fasta headers to another
@@ -82,7 +82,7 @@ module Unipept
82
82
  # @param [Boolean] Is this the first output batch?
83
83
  #
84
84
  # @return [String] The converted input data
85
- def format(data, fasta_mapper = nil, first)
85
+ def format(data, fasta_mapper, first)
86
86
  data = integrate_fasta_headers(data, fasta_mapper) if fasta_mapper
87
87
  convert(data, first)
88
88
  end
@@ -95,7 +95,7 @@ module Unipept
95
95
  #
96
96
  # @return [String] The converted input data
97
97
  def convert(_data, _first)
98
- fail NotImplementedError, 'This must be implemented in a subclass.'
98
+ raise NotImplementedError, 'This must be implemented in a subclass.'
99
99
  end
100
100
 
101
101
  # Integrates the fasta headers into the data object