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 +4 -4
- data/.rubocop.yml +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -1
- data/Gemfile +5 -3
- data/Gemfile.lock +59 -68
- data/Rakefile +21 -18
- data/VERSION +1 -1
- data/lib/batch_iterator.rb +2 -2
- data/lib/commands/peptfilter.rb +1 -1
- data/lib/commands/unipept/api_runner.rb +8 -9
- data/lib/commands/unipept/config.rb +1 -1
- data/lib/commands/unipept/taxa2lca.rb +3 -3
- data/lib/configuration.rb +5 -5
- data/lib/formatters.rb +5 -5
- data/test/commands/test_peptfilter.rb +1 -1
- data/test/commands/test_prot2pept.rb +1 -1
- data/test/commands/test_unipept.rb +3 -3
- data/test/commands/test_uniprot.rb +2 -2
- data/test/commands/unipept/test_api_runner.rb +26 -24
- data/test/commands/unipept/test_config.rb +4 -4
- data/test/commands/unipept/test_pept2lca.rb +18 -18
- data/test/commands/unipept/test_pept2prot.rb +12 -12
- data/test/commands/unipept/test_pept2taxa.rb +12 -12
- data/test/commands/unipept/test_taxa2lca.rb +8 -8
- data/test/commands/unipept/test_taxonomy.rb +12 -12
- data/test/helper.rb +4 -4
- data/test/test_batch_iterator.rb +1 -1
- data/test/test_formatters.rb +5 -4
- data/unipept.gemspec +33 -35
- metadata +10 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17fb4ae25816764349c1961d48289be0841b3e6a
|
4
|
+
data.tar.gz: b484dc7db887da7172d408c75611083914d34049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4066aae51893a28a45fcaccb77f847c41ab39d8fa997e7445a16683904a9270a9b663e01e99860c0d65c5dd08cf941ce8d938081e252d677d6c9512d0ecd2b7
|
7
|
+
data.tar.gz: ef1144113dc60261e27b23d90c351f59410bdb7701203b81309e37d2e72aa21f1c7e8c663ef3488d019d9cab763f14b7da437a8a49a2cb034b271490728d084c
|
data/.rubocop.yml
CHANGED
@@ -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
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.0
|
data/.travis.yml
CHANGED
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', '
|
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
|
data/Gemfile.lock
CHANGED
@@ -1,103 +1,94 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
5
|
-
|
6
|
-
|
7
|
-
|
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.
|
11
|
-
json (
|
12
|
-
|
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
|
-
|
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
|
-
|
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.
|
22
|
+
faraday (0.9.2)
|
26
23
|
multipart-post (>= 1.2, < 3)
|
27
|
-
ffi (1.9.
|
28
|
-
git (1.
|
29
|
-
github_api (0.
|
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.
|
28
|
+
descendants_tracker (~> 0.0.1)
|
32
29
|
faraday (~> 0.8, < 0.10)
|
33
|
-
hashie (>=
|
30
|
+
hashie (>= 1.2)
|
34
31
|
multi_json (>= 1.7.5, < 2.0)
|
35
|
-
nokogiri (~> 1.6.
|
32
|
+
nokogiri (~> 1.6.0)
|
36
33
|
oauth2
|
37
|
-
hashie (3.4.
|
38
|
-
highline (1.7.
|
39
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
minitest (5.
|
55
|
-
multi_json (1.
|
56
|
-
multi_xml (0.
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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 (
|
67
|
-
parser (2.3.
|
68
|
-
ast (
|
61
|
+
rack (>= 1.2, < 3)
|
62
|
+
parser (2.3.3.1)
|
63
|
+
ast (~> 2.2)
|
69
64
|
powerpack (0.1.1)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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.
|
85
|
-
|
86
|
-
|
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 (
|
81
|
+
json (>= 1.8, < 3)
|
89
82
|
simplecov-html (~> 0.10.0)
|
90
83
|
simplecov-html (0.10.0)
|
91
|
-
term-ansicolor (1.
|
84
|
+
term-ansicolor (1.4.0)
|
92
85
|
tins (~> 1.0)
|
93
|
-
thor (0.19.
|
86
|
+
thor (0.19.4)
|
94
87
|
thread_safe (0.3.5)
|
95
|
-
tins (1.
|
96
|
-
typhoeus (
|
97
|
-
ethon (>= 0.
|
98
|
-
|
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
|
99
|
+
jeweler
|
109
100
|
minitest (~> 5.7)
|
110
101
|
rake (~> 10.4)
|
111
102
|
rubocop (~> 0.32)
|
112
|
-
typhoeus (
|
103
|
+
typhoeus (~> 1.1)
|
113
104
|
|
114
105
|
BUNDLED WITH
|
115
|
-
1.
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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.
|
1
|
+
1.1.3
|
data/lib/batch_iterator.rb
CHANGED
@@ -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
|
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
|
-
|
58
|
+
yield(input_set.to_a, i, fasta_mapper)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
data/lib/commands/peptfilter.rb
CHANGED
@@ -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).
|
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://'
|
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
|
-
|
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 =
|
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
|
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
|
170
|
-
output_writer.write_line formatter.format(result, fasta_mapper, batch_id
|
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
|
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") }
|
@@ -6,13 +6,13 @@ module Unipept::Commands
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def default_batch_size
|
9
|
-
|
9
|
+
raise 'NOT NEEDED FOR TAXA2LCA'
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
class SimpleBatchIterator
|
14
|
-
def iterate(input
|
15
|
-
|
14
|
+
def iterate(input)
|
15
|
+
yield(input.to_a, 0)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/configuration.rb
CHANGED
@@ -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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
data/lib/formatters.rb
CHANGED
@@ -42,7 +42,7 @@ module Unipept
|
|
42
42
|
|
43
43
|
# @return [String] The type of the current formatter
|
44
44
|
def type
|
45
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|