unipept 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -2
- data/.travis.yml +4 -5
- data/Gemfile +3 -4
- data/Gemfile.lock +2 -2
- data/Rakefile +5 -7
- data/VERSION +1 -1
- data/lib/batch_order.rb +1 -0
- data/lib/commands/unipept/api_runner.rb +4 -2
- data/lib/commands/uniprot.rb +2 -2
- data/lib/configuration.rb +1 -1
- data/lib/formatters.rb +2 -2
- data/lib/server_message.rb +1 -0
- data/test/commands/test_peptfilter.rb +23 -23
- data/test/commands/test_prot2pept.rb +11 -11
- data/test/commands/test_unipept.rb +4 -4
- data/test/commands/test_uniprot.rb +25 -25
- data/test/commands/unipept/test_api_runner.rb +26 -26
- data/test/commands/unipept/test_config.rb +5 -5
- data/test/commands/unipept/test_pept2lca.rb +7 -7
- data/test/commands/unipept/test_pept2prot.rb +7 -7
- data/test/commands/unipept/test_pept2taxa.rb +7 -7
- data/test/commands/unipept/test_taxa2lca.rb +5 -5
- data/test/commands/unipept/test_taxonomy.rb +7 -7
- data/test/helper.rb +2 -2
- data/test/test_batch_iterator.rb +4 -4
- data/unipept.gemspec +12 -12
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 773e25ed2369843012700a657100181e84254c905365d534136d0c1a68606ab7
|
4
|
+
data.tar.gz: 78830dfab3cab145cf248b2bc41d65806a3a4274ab1d48b9be1d530c7f2eb865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55648c665eadd51c119e4091a3e8e110189df97ac70eeceee0a9a508e8b7112cd522dbec23ae55c1172e061b95b192cc383190640ec68dbd316273510640b598
|
7
|
+
data.tar.gz: fdcf5b35931caee76a3acfa6a8be7828f902570e9b6669f4d184b55321dcd0177d9bd363214f4d2b4766b13010eebe15e7e1beed549b4b864a95f71684a178ae
|
data/.rubocop.yml
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
AllCops:
|
2
|
-
Include:
|
3
|
-
- ''
|
4
2
|
Exclude:
|
5
3
|
- 'unipept.gemspec'
|
6
4
|
- 'vendor/**/*'
|
5
|
+
- 'Rakefile'
|
7
6
|
|
8
7
|
Style/ClassAndModuleChildren:
|
9
8
|
EnforcedStyle: compact
|
@@ -30,3 +29,7 @@ Metrics/MethodLength:
|
|
30
29
|
Enabled: false
|
31
30
|
Metrics/BlockLength:
|
32
31
|
Enabled: false
|
32
|
+
Naming/HeredocDelimiterNaming:
|
33
|
+
Enabled: false
|
34
|
+
Naming/UncommunicativeMethodParamName:
|
35
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,15 +3,14 @@ source 'http://rubygems.org'
|
|
3
3
|
# Example:
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
|
-
|
7
|
-
gem 'cri', '2.11'
|
6
|
+
gem 'cri', '~>2.15.3'
|
8
7
|
gem 'typhoeus', '~> 1.1'
|
9
8
|
|
10
9
|
group :development do
|
11
|
-
gem '
|
10
|
+
gem 'coveralls', '~> 0', require: false
|
12
11
|
gem 'minitest', '~> 5.7'
|
12
|
+
gem 'rake', '~> 10.4'
|
13
13
|
gem 'rubocop', '~>0.32'
|
14
|
-
gem 'coveralls', '~> 0', require: false
|
15
14
|
end
|
16
15
|
|
17
16
|
group :release do
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
term-ansicolor (~> 1.3)
|
12
12
|
thor (~> 0.19.4)
|
13
13
|
tins (~> 1.6)
|
14
|
-
cri (2.
|
14
|
+
cri (2.15.3)
|
15
15
|
colored (~> 1.2)
|
16
16
|
descendants_tracker (0.0.4)
|
17
17
|
thread_safe (~> 0.3, >= 0.3.1)
|
@@ -97,7 +97,7 @@ PLATFORMS
|
|
97
97
|
|
98
98
|
DEPENDENCIES
|
99
99
|
coveralls (~> 0)
|
100
|
-
cri (
|
100
|
+
cri (~> 2.15.3)
|
101
101
|
jeweler
|
102
102
|
minitest (~> 5.7)
|
103
103
|
rake (~> 10.4)
|
data/Rakefile
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
2
|
require 'bundler'
|
5
3
|
begin
|
6
4
|
Bundler.setup(:default, :development)
|
7
5
|
rescue Bundler::BundlerError => e
|
8
|
-
|
9
|
-
|
6
|
+
warn e.message
|
7
|
+
warn 'Run `bundle install` to install missing gems'
|
10
8
|
exit e.status_code
|
11
9
|
end
|
12
10
|
require 'rake'
|
@@ -17,7 +15,7 @@ begin
|
|
17
15
|
Jeweler::Tasks.new do |gem|
|
18
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
19
17
|
gem.name = 'unipept'
|
20
|
-
gem.executables = %w
|
18
|
+
gem.executables = %w[unipept prot2pept peptfilter uniprot]
|
21
19
|
gem.homepage = 'http://unipept.ugent.be'
|
22
20
|
gem.license = 'MIT'
|
23
21
|
gem.summary = 'Command line interface to Unipept web services.'
|
@@ -32,7 +30,7 @@ begin
|
|
32
30
|
end
|
33
31
|
Jeweler::RubygemsDotOrgTasks.new
|
34
32
|
rescue LoadError
|
35
|
-
# do nothing
|
33
|
+
# do nothing
|
36
34
|
end
|
37
35
|
|
38
36
|
task :test_unit do
|
@@ -45,7 +43,7 @@ end
|
|
45
43
|
|
46
44
|
RuboCop::RakeTask.new(:test_style)
|
47
45
|
|
48
|
-
task test: [
|
46
|
+
task test: %i[test_unit test_style]
|
49
47
|
|
50
48
|
task default: :test
|
51
49
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
data/lib/batch_order.rb
CHANGED
@@ -22,7 +22,7 @@ module Unipept
|
|
22
22
|
# file, the value of the option is used.
|
23
23
|
def host
|
24
24
|
# find host in opts first
|
25
|
-
host = options[:host]
|
25
|
+
host = options[:host] || @configuration['host']
|
26
26
|
host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?
|
27
27
|
|
28
28
|
# add http:// if needed
|
@@ -40,6 +40,7 @@ module Unipept
|
|
40
40
|
def input_iterator
|
41
41
|
return arguments.each unless arguments.empty?
|
42
42
|
return IO.foreach(options[:input]) if options[:input]
|
43
|
+
|
43
44
|
$stdin.each_line
|
44
45
|
end
|
45
46
|
|
@@ -86,6 +87,7 @@ module Unipept
|
|
86
87
|
# Returns an array of regular expressions containing all the selected fields
|
87
88
|
def selected_fields
|
88
89
|
return @selected_fields unless @selected_fields.nil?
|
90
|
+
|
89
91
|
fields = [*options[:select]].map { |f| f.split(',') }.flatten
|
90
92
|
fields.concat(required_fields) if @fasta && !fields.empty?
|
91
93
|
@selected_fields = fields.map { |f| glob_to_regex(f) }
|
@@ -143,7 +145,7 @@ module Unipept
|
|
143
145
|
path = error_file_path
|
144
146
|
FileUtils.mkdir_p File.dirname(path)
|
145
147
|
File.open(path, 'w') { |f| f.write message }
|
146
|
-
|
148
|
+
warn "API request failed! log can be found in #{path}"
|
147
149
|
end
|
148
150
|
|
149
151
|
private
|
data/lib/commands/uniprot.rb
CHANGED
@@ -5,7 +5,7 @@ module Unipept::Commands
|
|
5
5
|
attr_reader :root_command
|
6
6
|
attr_reader :valid_formats
|
7
7
|
|
8
|
-
valid_formats = Set.new %w
|
8
|
+
valid_formats = Set.new %w[fasta txt xml rdf gff sequence]
|
9
9
|
@root_command = Cri::Command.define do
|
10
10
|
name 'uniprot'
|
11
11
|
summary 'Command line interface to UniProt web services.'
|
@@ -29,7 +29,7 @@ module Unipept::Commands
|
|
29
29
|
run do |opts, args, _cmd|
|
30
30
|
format = opts.fetch(:format, 'sequence')
|
31
31
|
unless valid_formats.include? format
|
32
|
-
|
32
|
+
warn format + ' is not a valid output format. Available formats are: ' + valid_formats.to_a.join(', ')
|
33
33
|
exit 1
|
34
34
|
end
|
35
35
|
iterator = args.empty? ? $stdin.each_line : args
|
data/lib/configuration.rb
CHANGED
@@ -13,7 +13,7 @@ module Unipept
|
|
13
13
|
# @param [String] file An optional file name of the YAML file to create the
|
14
14
|
# config from
|
15
15
|
def initialize(file = nil)
|
16
|
-
@file_name = file
|
16
|
+
@file_name = file || File.join(Dir.home, '.unipeptrc')
|
17
17
|
@config = if !File.exist? file_name
|
18
18
|
{}
|
19
19
|
else
|
data/lib/formatters.rb
CHANGED
@@ -17,7 +17,7 @@ module Unipept
|
|
17
17
|
# @return [Formatter] The requested formatter
|
18
18
|
def self.new_for_format(format)
|
19
19
|
formatters[format].new
|
20
|
-
rescue
|
20
|
+
rescue StandardError
|
21
21
|
formatters[default].new
|
22
22
|
end
|
23
23
|
|
@@ -32,7 +32,7 @@ module Unipept
|
|
32
32
|
#
|
33
33
|
# @return [Array<String>] The list of available formatters
|
34
34
|
def self.available
|
35
|
-
formatters.
|
35
|
+
formatters.reject { |_key, value| value.hidden? }.keys
|
36
36
|
end
|
37
37
|
|
38
38
|
# @return [String] The type of the default formatter: csv
|
data/lib/server_message.rb
CHANGED
@@ -39,114 +39,114 @@ module Unipept
|
|
39
39
|
|
40
40
|
def test_default_min_length_argument
|
41
41
|
out, _err = capture_io_with_input('A' * 6) do
|
42
|
-
Commands::Peptfilter.run(%w
|
42
|
+
Commands::Peptfilter.run(%w[])
|
43
43
|
end
|
44
44
|
assert_equal('A' * 6, out.chomp)
|
45
45
|
|
46
46
|
out, _err = capture_io_with_input('A' * 5) do
|
47
|
-
Commands::Peptfilter.run(%w
|
47
|
+
Commands::Peptfilter.run(%w[])
|
48
48
|
end
|
49
49
|
assert_equal('A' * 5, out.chomp)
|
50
50
|
|
51
51
|
out, _err = capture_io_with_input('A' * 4) do
|
52
|
-
Commands::Peptfilter.run(%w
|
52
|
+
Commands::Peptfilter.run(%w[])
|
53
53
|
end
|
54
54
|
assert_equal('', out.chomp)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_default_max_length_argument
|
58
58
|
out, _err = capture_io_with_input('A' * 49) do
|
59
|
-
Commands::Peptfilter.run(%w
|
59
|
+
Commands::Peptfilter.run(%w[])
|
60
60
|
end
|
61
61
|
assert_equal('A' * 49, out.chomp)
|
62
62
|
|
63
63
|
out, _err = capture_io_with_input('A' * 50) do
|
64
|
-
Commands::Peptfilter.run(%w
|
64
|
+
Commands::Peptfilter.run(%w[])
|
65
65
|
end
|
66
66
|
assert_equal('A' * 50, out.chomp)
|
67
67
|
|
68
68
|
out, _err = capture_io_with_input('A' * 51) do
|
69
|
-
Commands::Peptfilter.run(%w
|
69
|
+
Commands::Peptfilter.run(%w[])
|
70
70
|
end
|
71
71
|
assert_equal('', out.chomp)
|
72
72
|
end
|
73
73
|
|
74
74
|
def test_with_min_argument
|
75
75
|
out, _err = capture_io_with_input('A' * 6) do
|
76
|
-
Commands::Peptfilter.run(%w
|
76
|
+
Commands::Peptfilter.run(%w[--minlen 7])
|
77
77
|
end
|
78
78
|
assert_equal('', out.chomp)
|
79
79
|
|
80
80
|
out, _err = capture_io_with_input('A' * 4) do
|
81
|
-
Commands::Peptfilter.run(%w
|
81
|
+
Commands::Peptfilter.run(%w[--minlen 3])
|
82
82
|
end
|
83
83
|
assert_equal('A' * 4, out.chomp)
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_with_max_argument
|
87
87
|
out, _err = capture_io_with_input('A' * 45) do
|
88
|
-
Commands::Peptfilter.run(%w
|
88
|
+
Commands::Peptfilter.run(%w[--maxlen 40])
|
89
89
|
end
|
90
90
|
assert_equal('', out.chomp)
|
91
91
|
|
92
92
|
out, _err = capture_io_with_input('A' * 55) do
|
93
|
-
Commands::Peptfilter.run(%w
|
93
|
+
Commands::Peptfilter.run(%w[--maxlen 60])
|
94
94
|
end
|
95
95
|
assert_equal('A' * 55, out.chomp)
|
96
96
|
end
|
97
97
|
|
98
98
|
def test_with_lacks_argument
|
99
99
|
out, _err = capture_io_with_input('A' * 10) do
|
100
|
-
Commands::Peptfilter.run(%w
|
100
|
+
Commands::Peptfilter.run(%w[--lacks B])
|
101
101
|
end
|
102
102
|
assert_equal('A' * 10, out.chomp)
|
103
103
|
|
104
104
|
out, _err = capture_io_with_input('A' * 10) do
|
105
|
-
Commands::Peptfilter.run(%w
|
105
|
+
Commands::Peptfilter.run(%w[-l B])
|
106
106
|
end
|
107
107
|
assert_equal('A' * 10, out.chomp)
|
108
108
|
|
109
109
|
out, _err = capture_io_with_input('A' * 10) do
|
110
|
-
Commands::Peptfilter.run(%w
|
110
|
+
Commands::Peptfilter.run(%w[--lacks A])
|
111
111
|
end
|
112
112
|
assert_equal('', out.chomp)
|
113
113
|
|
114
114
|
out, _err = capture_io_with_input('A' * 10) do
|
115
|
-
Commands::Peptfilter.run(%w
|
115
|
+
Commands::Peptfilter.run(%w[-l A])
|
116
116
|
end
|
117
117
|
assert_equal('', out.chomp)
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_with_contains_argument
|
121
121
|
out, _err = capture_io_with_input('A' * 10) do
|
122
|
-
Commands::Peptfilter.run(%w
|
122
|
+
Commands::Peptfilter.run(%w[--contains A])
|
123
123
|
end
|
124
124
|
assert_equal('A' * 10, out.chomp)
|
125
125
|
|
126
126
|
out, _err = capture_io_with_input('A' * 10) do
|
127
|
-
Commands::Peptfilter.run(%w
|
127
|
+
Commands::Peptfilter.run(%w[-c A])
|
128
128
|
end
|
129
129
|
assert_equal('A' * 10, out.chomp)
|
130
130
|
|
131
131
|
out, _err = capture_io_with_input('A' * 10) do
|
132
|
-
Commands::Peptfilter.run(%w
|
132
|
+
Commands::Peptfilter.run(%w[--contains B])
|
133
133
|
end
|
134
134
|
assert_equal('', out.chomp)
|
135
135
|
|
136
136
|
out, _err = capture_io_with_input('A' * 10) do
|
137
|
-
Commands::Peptfilter.run(%w
|
137
|
+
Commands::Peptfilter.run(%w[-c B])
|
138
138
|
end
|
139
139
|
assert_equal('', out.chomp)
|
140
140
|
end
|
141
141
|
|
142
142
|
def test_fasta_input
|
143
143
|
out, _err = capture_io_with_input('>') do
|
144
|
-
Commands::Peptfilter.run(%w
|
144
|
+
Commands::Peptfilter.run(%w[])
|
145
145
|
end
|
146
146
|
assert_equal('>', out.chomp)
|
147
147
|
|
148
148
|
out, _err = capture_io_with_input(['>', 'A', 'AALTER', '>']) do
|
149
|
-
Commands::Peptfilter.run(%w
|
149
|
+
Commands::Peptfilter.run(%w[])
|
150
150
|
end
|
151
151
|
assert_equal(">\nAALTER\n>", out.chomp)
|
152
152
|
end
|
@@ -154,7 +154,7 @@ module Unipept
|
|
154
154
|
def test_no_input
|
155
155
|
out, err = capture_io_while do
|
156
156
|
assert_raises SystemExit do
|
157
|
-
Commands::Peptfilter.run(%w
|
157
|
+
Commands::Peptfilter.run(%w[some argument])
|
158
158
|
end
|
159
159
|
end
|
160
160
|
assert_equal('', out.chomp)
|
@@ -163,7 +163,7 @@ module Unipept
|
|
163
163
|
|
164
164
|
def test_normal_input
|
165
165
|
out, _err = capture_io_with_input(['A', 'A' * 11, 'AAAAB', 'BBBBB', 'CCCCC', 'CCCCCA']) do
|
166
|
-
Commands::Peptfilter.run(%w
|
166
|
+
Commands::Peptfilter.run(%w[--minlen 4 --maxlen 10 --lacks B --contains A])
|
167
167
|
end
|
168
168
|
assert_equal('CCCCCA', out.chomp)
|
169
169
|
end
|
@@ -171,7 +171,7 @@ module Unipept
|
|
171
171
|
def test_help
|
172
172
|
out, _err = capture_io_while do
|
173
173
|
assert_raises SystemExit do
|
174
|
-
Commands::Peptfilter.run(%w
|
174
|
+
Commands::Peptfilter.run(%w[-h])
|
175
175
|
end
|
176
176
|
end
|
177
177
|
assert(out.include?('show help for this command'))
|
@@ -4,46 +4,46 @@ module Unipept
|
|
4
4
|
class Prot2peptTestCase < Unipept::TestCase
|
5
5
|
def test_normal_input
|
6
6
|
out, _err = capture_io_with_input('AALTERAALTERPAALTER') do
|
7
|
-
Commands::Prot2pept.run(%w
|
7
|
+
Commands::Prot2pept.run(%w[])
|
8
8
|
end
|
9
9
|
assert_equal("AALTER\nAALTERPAALTER", out.chomp)
|
10
10
|
|
11
11
|
out, _err = capture_io_with_input('AALTERAAL*TERPAALTER') do
|
12
|
-
Commands::Prot2pept.run(%w
|
12
|
+
Commands::Prot2pept.run(%w[])
|
13
13
|
end
|
14
14
|
assert_equal("AALTER\nAAL\nTERPAALTER", out.chomp)
|
15
15
|
|
16
16
|
out, _err = capture_io_with_input('KRKPR') do
|
17
|
-
Commands::Prot2pept.run(%w
|
17
|
+
Commands::Prot2pept.run(%w[])
|
18
18
|
end
|
19
19
|
assert_equal("K\nR\nKPR", out.chomp)
|
20
20
|
|
21
|
-
out, _err = capture_io_with_input(%w
|
22
|
-
Commands::Prot2pept.run(%w
|
21
|
+
out, _err = capture_io_with_input(%w[AALTERAALTERPAALTER AALTERAA]) do
|
22
|
+
Commands::Prot2pept.run(%w[])
|
23
23
|
end
|
24
24
|
assert_equal("AALTER\nAALTERPAALTER\nAALTER\nAA", out.chomp)
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_fasta_input
|
28
28
|
out, _err = capture_io_with_input(">AKA\nAALTERAALTERPAALTER") do
|
29
|
-
Commands::Prot2pept.run(%w
|
29
|
+
Commands::Prot2pept.run(%w[])
|
30
30
|
end
|
31
31
|
assert_equal(">AKA\nAALTER\nAALTERPAALTER", out.chomp)
|
32
32
|
|
33
33
|
out, _err = capture_io_with_input(">AKA\nAAL\nT\nERAALTER\nP\nAALTER") do
|
34
|
-
Commands::Prot2pept.run(%w
|
34
|
+
Commands::Prot2pept.run(%w[])
|
35
35
|
end
|
36
36
|
assert_equal(">AKA\nAALTER\nAALTERPAALTER", out.chomp)
|
37
37
|
|
38
38
|
out, _err = capture_io_with_input(">AKA\nAAL\nT\n>\nERAALTER\nP\nAALTER") do
|
39
|
-
Commands::Prot2pept.run(%w
|
39
|
+
Commands::Prot2pept.run(%w[])
|
40
40
|
end
|
41
41
|
assert_equal(">AKA\nAALT\n>\nER\nAALTERPAALTER", out.chomp)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_default_pattern
|
45
45
|
default_out, _err = capture_io_with_input('AALTERAALTERPAALTER') do
|
46
|
-
Commands::Prot2pept.run(%w
|
46
|
+
Commands::Prot2pept.run(%w[])
|
47
47
|
end
|
48
48
|
assert_equal("AALTER\nAALTERPAALTER", default_out.chomp)
|
49
49
|
|
@@ -60,7 +60,7 @@ module Unipept
|
|
60
60
|
|
61
61
|
def test_pattern
|
62
62
|
out, _err = capture_io_with_input('AALTERAALTERPAALTER') do
|
63
|
-
Commands::Prot2pept.run(%w
|
63
|
+
Commands::Prot2pept.run(%w[])
|
64
64
|
end
|
65
65
|
assert_equal("AALTER\nAALTERPAALTER", out.chomp)
|
66
66
|
|
@@ -78,7 +78,7 @@ module Unipept
|
|
78
78
|
def test_help
|
79
79
|
out, _err = capture_io_while do
|
80
80
|
assert_raises SystemExit do
|
81
|
-
Commands::Prot2pept.run(%w
|
81
|
+
Commands::Prot2pept.run(%w[-h])
|
82
82
|
end
|
83
83
|
end
|
84
84
|
assert(out.include?('show help for this command'))
|