unipept 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +26 -0
- data/.travis.yml +7 -0
- data/Gemfile +8 -10
- data/Gemfile.lock +35 -21
- data/README.md +6 -4
- data/Rakefile +11 -10
- data/VERSION +1 -1
- data/bin/peptfilter +2 -44
- data/bin/prot2pept +4 -49
- data/bin/unipept +2 -197
- data/bin/uniprot +4 -53
- data/lib/batch_iterator.rb +73 -0
- data/lib/batch_order.rb +20 -0
- data/lib/commands/peptfilter.rb +118 -0
- data/lib/commands/prot2pept.rb +61 -0
- data/lib/commands/unipept/api_runner.rb +199 -0
- data/lib/commands/unipept/config.rb +29 -0
- data/lib/commands/unipept/pept2lca.rb +12 -0
- data/lib/commands/unipept/pept2prot.rb +13 -0
- data/lib/{unipept/commands → commands/unipept}/pept2taxa.rb +7 -0
- data/lib/commands/unipept/taxa2lca.rb +18 -0
- data/lib/{unipept/commands → commands/unipept}/taxonomy.rb +3 -0
- data/lib/commands/unipept.rb +226 -0
- data/lib/commands/uniprot.rb +69 -0
- data/lib/commands.rb +10 -0
- data/lib/configuration.rb +45 -0
- data/lib/formatters.rb +252 -0
- data/lib/version.rb +3 -0
- data/test/commands/test_peptfilter.rb +170 -0
- data/test/commands/test_prot2pept.rb +82 -0
- data/test/commands/test_unipept.rb +37 -0
- data/test/commands/test_uniprot.rb +136 -0
- data/test/commands/unipept/test_api_runner.rb +486 -0
- data/test/commands/unipept/test_config.rb +64 -0
- data/test/commands/unipept/test_pept2lca.rb +40 -0
- data/test/commands/unipept/test_pept2prot.rb +39 -0
- data/test/commands/unipept/test_pept2taxa.rb +39 -0
- data/test/commands/unipept/test_taxa2lca.rb +39 -0
- data/test/commands/unipept/test_taxonomy.rb +37 -0
- data/test/helper.rb +69 -23
- data/test/test_bach_order.rb +57 -0
- data/test/test_base.rb +6 -0
- data/test/test_batch_iterator.rb +87 -0
- data/test/test_configuration.rb +43 -0
- data/test/test_formatters.rb +140 -0
- data/unipept.gemspec +55 -33
- metadata +62 -40
- data/lib/unipept/batch_order.rb +0 -28
- data/lib/unipept/commands/api_runner.rb +0 -239
- data/lib/unipept/commands/pept2lca.rb +0 -6
- data/lib/unipept/commands/pept2prot.rb +0 -20
- data/lib/unipept/commands/taxa2lca.rb +0 -12
- data/lib/unipept/commands.rb +0 -7
- data/lib/unipept/configuration.rb +0 -29
- data/lib/unipept/formatters.rb +0 -135
- data/lib/unipept/version.rb +0 -3
- data/lib/unipept.rb +0 -8
- data/test/test_unipept.rb +0 -7
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '../../../lib/commands'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class UnipeptTaxa2lcaTestCase < Unipept::TestCase
|
5
|
+
def test_batch_size
|
6
|
+
command = Cri::Command.define { name 'taxa2lca' }
|
7
|
+
taxa2lca = Commands::Taxa2lca.new({ host: 'http://api.unipept.ugent.be' }, [], command)
|
8
|
+
assert_raises RuntimeError do
|
9
|
+
taxa2lca.batch_size
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_help
|
14
|
+
out, _err = capture_io_while do
|
15
|
+
assert_raises SystemExit do
|
16
|
+
Commands::Unipept.run(%w(taxa2lca -h))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
assert(out.include? 'show help for this command')
|
20
|
+
|
21
|
+
out, _err = capture_io_while do
|
22
|
+
assert_raises SystemExit do
|
23
|
+
Commands::Unipept.run(%w(taxa2lca --help))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
assert(out.include? 'show help for this command')
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_run
|
30
|
+
out, err = capture_io_while do
|
31
|
+
Commands::Unipept.run(%w(taxa2lca --host http://api.unipept.ugent.be 216816 1680))
|
32
|
+
end
|
33
|
+
lines = out.each_line
|
34
|
+
assert_equal('', err)
|
35
|
+
assert(lines.next.start_with? 'taxon_id,taxon_name,taxon_rank')
|
36
|
+
assert(lines.next.start_with? '1678,Bifidobacterium,genus')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../../../lib/commands'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class UnipeptTaxonomyTestCase < Unipept::TestCase
|
5
|
+
def test_batch_size
|
6
|
+
command = Cri::Command.define { name 'taxonomy' }
|
7
|
+
taxonomy = Commands::Taxonomy.new({ host: 'http://api.unipept.ugent.be' }, [], command)
|
8
|
+
assert_equal(100, taxonomy.batch_size)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_help
|
12
|
+
out, _err = capture_io_while do
|
13
|
+
assert_raises SystemExit do
|
14
|
+
Commands::Unipept.run(%w(taxonomy -h))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
assert(out.include? 'show help for this command')
|
18
|
+
|
19
|
+
out, _err = capture_io_while do
|
20
|
+
assert_raises SystemExit do
|
21
|
+
Commands::Unipept.run(%w(taxonomy --help))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
assert(out.include? 'show help for this command')
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_run
|
28
|
+
out, err = capture_io_while do
|
29
|
+
Commands::Unipept.run(%w(taxonomy --host http://api.unipept.ugent.be 1))
|
30
|
+
end
|
31
|
+
lines = out.each_line
|
32
|
+
assert_equal('', err)
|
33
|
+
assert(lines.next.start_with? 'taxon_id,taxon_name,taxon_rank')
|
34
|
+
assert(lines.next.start_with? '1,root,no rank')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,34 +1,80 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
|
-
module SimpleCov::Configuration
|
4
|
-
def clean_filters
|
5
|
-
@filters = []
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
SimpleCov.configure do
|
10
|
-
clean_filters
|
11
|
-
load_adapter 'test_frameworks'
|
12
|
-
end
|
13
|
-
|
14
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
-
add_filter "/.rvm/"
|
16
|
-
end
|
17
1
|
require 'rubygems'
|
18
2
|
require 'bundler'
|
3
|
+
require 'coveralls'
|
4
|
+
Coveralls.wear!
|
5
|
+
|
19
6
|
begin
|
20
7
|
Bundler.setup(:default, :development)
|
21
8
|
rescue Bundler::BundlerError => e
|
22
9
|
$stderr.puts e.message
|
23
|
-
$stderr.puts
|
10
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
24
11
|
exit e.status_code
|
25
12
|
end
|
26
|
-
require 'test/unit'
|
27
|
-
require 'shoulda'
|
28
13
|
|
29
|
-
|
30
|
-
|
31
|
-
|
14
|
+
require 'minitest'
|
15
|
+
require 'minitest/autorun'
|
16
|
+
|
17
|
+
module Unipept
|
18
|
+
class TestCase < Minitest::Test
|
19
|
+
def setup
|
20
|
+
# Enter tmp
|
21
|
+
@tmp_dir = Dir.mktmpdir('unipept-test')
|
22
|
+
@orig_wd = FileUtils.pwd
|
23
|
+
FileUtils.cd(@tmp_dir)
|
24
|
+
|
25
|
+
@orig_io = capture_io
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
uncapture_io(*@orig_io)
|
32
30
|
|
33
|
-
|
31
|
+
# Exit tmp
|
32
|
+
FileUtils.cd(@orig_wd)
|
33
|
+
FileUtils.rm_rf(@tmp_dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
def capture_io_with_input(input, &block)
|
37
|
+
capture_io_while do
|
38
|
+
input = input.join("\n") if input.is_a? Array
|
39
|
+
$stdin.write(input)
|
40
|
+
$stdin.rewind
|
41
|
+
block.call
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def capture_io_while(&block)
|
46
|
+
orig_io = capture_io
|
47
|
+
block.call
|
48
|
+
[$stdout.string, $stderr.string]
|
49
|
+
ensure
|
50
|
+
uncapture_io(*orig_io)
|
51
|
+
end
|
52
|
+
|
53
|
+
def lines(string)
|
54
|
+
string.scan(/^.*\n/).map(&:chomp)
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def capture_io
|
60
|
+
orig_stdout = $stdout
|
61
|
+
orig_stderr = $stderr
|
62
|
+
orig_stdin = $stdin
|
63
|
+
|
64
|
+
$stdout = StringIO.new
|
65
|
+
$stderr = StringIO.new
|
66
|
+
$stdin = StringIO.new
|
67
|
+
|
68
|
+
[orig_stdout, orig_stderr, orig_stdin]
|
69
|
+
end
|
70
|
+
|
71
|
+
def uncapture_io(orig_stdout, orig_stderr, orig_stdin)
|
72
|
+
$stdout = orig_stdout
|
73
|
+
$stderr = orig_stderr
|
74
|
+
$stdin = orig_stdin
|
75
|
+
end
|
76
|
+
end
|
34
77
|
end
|
78
|
+
|
79
|
+
# Unexpected system exit is unexpected
|
80
|
+
::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS.delete(SystemExit)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative '../lib/batch_order'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class BatchOrderTestCase < Unipept::TestCase
|
5
|
+
def test_single_batch
|
6
|
+
order = BatchOrder.new
|
7
|
+
out, _err = capture_io_while do
|
8
|
+
run_batch(order, [0])
|
9
|
+
end
|
10
|
+
assert_equal(['0', ''].join("\n"), out)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_double_batch
|
14
|
+
order = BatchOrder.new
|
15
|
+
out, _err = capture_io_while do
|
16
|
+
run_batch(order, [0, 1])
|
17
|
+
end
|
18
|
+
assert_equal(['0', '1', ''].join("\n"), out)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_missing_batch
|
22
|
+
order = BatchOrder.new
|
23
|
+
out, _err = capture_io_while do
|
24
|
+
run_batch(order, [1, 2])
|
25
|
+
end
|
26
|
+
assert_equal('', out)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_out_order_batch
|
30
|
+
order = BatchOrder.new
|
31
|
+
out, _err = capture_io_while do
|
32
|
+
run_batch(order, [1, 0])
|
33
|
+
end
|
34
|
+
assert_equal(['0', '1', ''].join("\n"), out)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_gap_batch
|
38
|
+
order = BatchOrder.new
|
39
|
+
out, _err = capture_io_while do
|
40
|
+
run_batch(order, [1, 4, 0])
|
41
|
+
end
|
42
|
+
assert_equal(['0', '1', ''].join("\n"), out)
|
43
|
+
out, _err = capture_io_while do
|
44
|
+
run_batch(order, [2, 3, 5])
|
45
|
+
end
|
46
|
+
assert_equal(['2', '3', '4', '5', ''].join("\n"), out)
|
47
|
+
end
|
48
|
+
|
49
|
+
def run_batch(order, list)
|
50
|
+
list.each do |i|
|
51
|
+
order.wait(i) do
|
52
|
+
puts i
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/test/test_base.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require_relative '../lib/batch_iterator'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class BatchIteratorTestCase < Unipept::TestCase
|
5
|
+
def test_batch_size
|
6
|
+
iterator = BatchIterator.new(50)
|
7
|
+
assert_equal(50, iterator.batch_size)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_fasta
|
11
|
+
iterator = BatchIterator.new(50)
|
12
|
+
assert(iterator.fasta? '> test')
|
13
|
+
assert(!(iterator.fasta? '< test'))
|
14
|
+
assert(!(iterator.fasta? 'test'))
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_normal_iterator
|
18
|
+
iterator = BatchIterator.new(2)
|
19
|
+
data = %w(a b c d e)
|
20
|
+
out, _err = capture_io_while do
|
21
|
+
iterator.iterate(data.each) do |batch, batch_id, fasta_mapper|
|
22
|
+
assert_nil(fasta_mapper)
|
23
|
+
puts batch_id
|
24
|
+
puts batch.to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
assert_equal(['0', '["a", "b"]', '1', '["c", "d"]', '2', '["e"]', ''].join("\n"), out)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_fasta_iterator_single_header
|
31
|
+
iterator = BatchIterator.new(2)
|
32
|
+
data = %w(>h1 a b c d e)
|
33
|
+
mappings = []
|
34
|
+
out, _err = capture_io_while do
|
35
|
+
iterator.iterate(data.each) do |batch, batch_id, fasta_mapper|
|
36
|
+
assert(!fasta_mapper.nil?)
|
37
|
+
mappings << fasta_mapper
|
38
|
+
puts batch_id
|
39
|
+
puts batch.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
assert_equal(['0', '["a"]', '1', '["b", "c"]', '2', '["d", "e"]', ''].join("\n"), out)
|
43
|
+
mappings.flatten!(1)
|
44
|
+
data.shift
|
45
|
+
data.each { |element| assert(mappings.include?(['>h1', element])) }
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_fasta_iterator_double_header_single_batch
|
49
|
+
iterator = BatchIterator.new(3)
|
50
|
+
data = %w(>h1 a >h2 b c d e)
|
51
|
+
mappings = []
|
52
|
+
out, _err = capture_io_while do
|
53
|
+
iterator.iterate(data.each) do |batch, batch_id, fasta_mapper|
|
54
|
+
assert(!fasta_mapper.nil?)
|
55
|
+
mappings << fasta_mapper
|
56
|
+
puts batch_id
|
57
|
+
puts batch.to_s
|
58
|
+
end
|
59
|
+
end
|
60
|
+
assert_equal(['0', '["a"]', '1', '["b", "c", "d"]', '2', '["e"]', ''].join("\n"), out)
|
61
|
+
mappings.flatten!(1)
|
62
|
+
assert(mappings.include?(['>h1', 'a']))
|
63
|
+
assert(mappings.include?(['>h2', 'b']))
|
64
|
+
assert(mappings.include?(['>h2', 'c']))
|
65
|
+
assert(mappings.include?(['>h2', 'd']))
|
66
|
+
assert(mappings.include?(['>h2', 'e']))
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_fasta_iterator_multiple_values
|
70
|
+
iterator = BatchIterator.new(4)
|
71
|
+
data = %w(>h1 a >h2 a a)
|
72
|
+
mappings = []
|
73
|
+
out, _err = capture_io_while do
|
74
|
+
iterator.iterate(data.each) do |batch, batch_id, fasta_mapper|
|
75
|
+
assert(!fasta_mapper.nil?)
|
76
|
+
mappings << fasta_mapper
|
77
|
+
puts batch_id
|
78
|
+
puts batch.to_s
|
79
|
+
end
|
80
|
+
end
|
81
|
+
assert_equal(['0', '["a"]', '1', '["a"]', ''].join("\n"), out)
|
82
|
+
assert(mappings[0].include?(['>h1', 'a']))
|
83
|
+
assert(mappings[0].include?(['>h2', 'a']))
|
84
|
+
assert(mappings[1].include?(['>h2', 'a']))
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative '../lib/configuration'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class ConfigurationTestCase < Unipept::TestCase
|
5
|
+
def test_load_without_file
|
6
|
+
config = Configuration.new('no_file')
|
7
|
+
assert_equal({}, config.config)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_load_with_file
|
11
|
+
hash = { 'key' => 'value' }
|
12
|
+
File.open('new_file', 'w') { |f| f.write hash.to_yaml }
|
13
|
+
config = Configuration.new('new_file')
|
14
|
+
assert_equal(hash, config.config)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_save
|
18
|
+
file_name = 'no_file'
|
19
|
+
assert(!(File.exist? file_name))
|
20
|
+
config = Configuration.new(file_name)
|
21
|
+
config.config['key'] = 'value'
|
22
|
+
config.save
|
23
|
+
assert((File.exist? file_name))
|
24
|
+
other_config = Configuration.new(file_name)
|
25
|
+
assert_equal('value', other_config.config['key'])
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_assign
|
29
|
+
config = Configuration.new('no_file')
|
30
|
+
config['key'] = 'value'
|
31
|
+
assert_equal('value', config.config['key'])
|
32
|
+
assert_equal('value', config['key'])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_delete
|
36
|
+
config = Configuration.new('no_file')
|
37
|
+
config['key'] = 'value'
|
38
|
+
assert_equal('value', config['key'])
|
39
|
+
config.delete('key')
|
40
|
+
assert_equal(nil, config['key'])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require_relative '../lib/formatters'
|
2
|
+
|
3
|
+
module Unipept
|
4
|
+
class FormattersTestCase < Unipept::TestCase
|
5
|
+
def test_available_formatters
|
6
|
+
formatters = Formatter.available
|
7
|
+
assert(formatters.include? 'json')
|
8
|
+
assert(formatters.include? 'csv')
|
9
|
+
assert(formatters.include? 'xml')
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_default_formatter
|
13
|
+
assert_equal('csv', Formatter.default)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_formatter_registration
|
17
|
+
assert(!(Formatter.available.include? 'test'))
|
18
|
+
Formatter.register(:test)
|
19
|
+
assert(Formatter.available.include? 'test')
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_new_for_format
|
23
|
+
formatter = Formatter.new_for_format('json')
|
24
|
+
assert_equal('json', formatter.type)
|
25
|
+
|
26
|
+
formatter = Formatter.new_for_format('xml')
|
27
|
+
assert_equal('xml', formatter.type)
|
28
|
+
|
29
|
+
formatter = Formatter.new_for_format('csv')
|
30
|
+
assert_equal('csv', formatter.type)
|
31
|
+
|
32
|
+
formatter = Formatter.new_for_format('blah')
|
33
|
+
assert_equal('csv', formatter.type)
|
34
|
+
end
|
35
|
+
|
36
|
+
def formatter
|
37
|
+
Formatter.new
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_header
|
41
|
+
assert_equal('', formatter.header(TestObject.test_object))
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_type
|
45
|
+
assert_equal('', formatter.type)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_format
|
49
|
+
assert_equal(TestObject.test_object, formatter.format(TestObject.test_object))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class JSONFormatterTestCase < Unipept::TestCase
|
54
|
+
def formatter
|
55
|
+
Formatter.new_for_format('json')
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_header
|
59
|
+
assert_equal('', formatter.header(TestObject.test_object))
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_type
|
63
|
+
assert_equal('json', formatter.type)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_format
|
67
|
+
assert_equal(TestObject.as_json, formatter.format(TestObject.test_object))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class CSVFormatterTestCase < Unipept::TestCase
|
72
|
+
def formatter
|
73
|
+
Formatter.new_for_format('csv')
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_header
|
77
|
+
fasta = [['peptide', '>test']]
|
78
|
+
object = [TestObject.test_object, TestObject.test_object]
|
79
|
+
assert_equal(TestObject.as_csv_header, formatter.header(object))
|
80
|
+
assert_equal('fasta_header,' + TestObject.as_csv_header, formatter.header(object, fasta))
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_type
|
84
|
+
assert_equal('csv', formatter.type)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_format
|
88
|
+
object = [TestObject.test_object, TestObject.test_object]
|
89
|
+
csv = [TestObject.as_csv, TestObject.as_csv, ''].join("\n")
|
90
|
+
assert_equal(csv, formatter.format(object))
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_format_with_fasta
|
94
|
+
fasta = [['>test', '5']]
|
95
|
+
object = [TestObject.test_object, TestObject.test_object]
|
96
|
+
csv = ['>test,' + TestObject.as_csv, '>test,' + TestObject.as_csv, ''].join("\n")
|
97
|
+
assert_equal(csv, formatter.format(object, fasta))
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class XMLFormatterTestCase < Unipept::TestCase
|
102
|
+
def formatter
|
103
|
+
Formatter.new_for_format('xml')
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_header
|
107
|
+
assert_equal('', formatter.header(TestObject.test_object))
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_type
|
111
|
+
assert_equal('xml', formatter.type)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_format
|
115
|
+
assert_equal(TestObject.as_xml, formatter.format(TestObject.test_object))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class TestObject
|
120
|
+
def self.test_object
|
121
|
+
JSON.parse('{"integer": 5, "string": "string", "list": ["a", 2, false]}')
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.as_json
|
125
|
+
'{"integer":5,"string":"string","list":["a",2,false]}'
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.as_xml
|
129
|
+
'<integer>5</integer><string>string</string><list size="3"><item>a</item><item>2</item><item>false</item></list>'
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.as_csv
|
133
|
+
'5,string,"[""a"", 2, false]"'
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.as_csv_header
|
137
|
+
"integer,string,list\n"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/unipept.gemspec
CHANGED
@@ -2,16 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: unipept 0.
|
5
|
+
# stub: unipept 0.8.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "unipept"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.8.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
12
|
s.authors = ["Toon Willems", "Bart Mesuere", "Tom Naessens"]
|
14
|
-
s.date = "2015-
|
13
|
+
s.date = "2015-06-12"
|
15
14
|
s.description = " Command line interface to the Unipept (http://unipept.ugent.be) web services\n (pept2lca, taxa2lca, pept2taxa and taxonomy) and some utility commands for\n handling proteins using the command line.\n"
|
16
15
|
s.email = "unipept@ugent.be"
|
17
16
|
s.executables = ["unipept", "prot2pept", "peptfilter", "uniprot"]
|
@@ -21,6 +20,8 @@ Gem::Specification.new do |s|
|
|
21
20
|
]
|
22
21
|
s.files = [
|
23
22
|
".document",
|
23
|
+
".rubocop.yml",
|
24
|
+
".travis.yml",
|
24
25
|
"Gemfile",
|
25
26
|
"Gemfile.lock",
|
26
27
|
"LICENSE.txt",
|
@@ -31,26 +32,47 @@ Gem::Specification.new do |s|
|
|
31
32
|
"bin/prot2pept",
|
32
33
|
"bin/unipept",
|
33
34
|
"bin/uniprot",
|
34
|
-
"lib/
|
35
|
-
"lib/
|
36
|
-
"lib/
|
37
|
-
"lib/
|
38
|
-
"lib/
|
39
|
-
"lib/
|
40
|
-
"lib/unipept/
|
41
|
-
"lib/unipept/
|
42
|
-
"lib/unipept/
|
43
|
-
"lib/unipept/
|
44
|
-
"lib/unipept/
|
45
|
-
"lib/unipept/
|
35
|
+
"lib/batch_iterator.rb",
|
36
|
+
"lib/batch_order.rb",
|
37
|
+
"lib/commands.rb",
|
38
|
+
"lib/commands/peptfilter.rb",
|
39
|
+
"lib/commands/prot2pept.rb",
|
40
|
+
"lib/commands/unipept.rb",
|
41
|
+
"lib/commands/unipept/api_runner.rb",
|
42
|
+
"lib/commands/unipept/config.rb",
|
43
|
+
"lib/commands/unipept/pept2lca.rb",
|
44
|
+
"lib/commands/unipept/pept2prot.rb",
|
45
|
+
"lib/commands/unipept/pept2taxa.rb",
|
46
|
+
"lib/commands/unipept/taxa2lca.rb",
|
47
|
+
"lib/commands/unipept/taxonomy.rb",
|
48
|
+
"lib/commands/uniprot.rb",
|
49
|
+
"lib/configuration.rb",
|
50
|
+
"lib/formatters.rb",
|
51
|
+
"lib/version.rb",
|
52
|
+
"test/commands/test_peptfilter.rb",
|
53
|
+
"test/commands/test_prot2pept.rb",
|
54
|
+
"test/commands/test_unipept.rb",
|
55
|
+
"test/commands/test_uniprot.rb",
|
56
|
+
"test/commands/unipept/test_api_runner.rb",
|
57
|
+
"test/commands/unipept/test_config.rb",
|
58
|
+
"test/commands/unipept/test_pept2lca.rb",
|
59
|
+
"test/commands/unipept/test_pept2prot.rb",
|
60
|
+
"test/commands/unipept/test_pept2taxa.rb",
|
61
|
+
"test/commands/unipept/test_taxa2lca.rb",
|
62
|
+
"test/commands/unipept/test_taxonomy.rb",
|
46
63
|
"test/helper.rb",
|
47
|
-
"test/
|
64
|
+
"test/test_bach_order.rb",
|
65
|
+
"test/test_base.rb",
|
66
|
+
"test/test_batch_iterator.rb",
|
67
|
+
"test/test_configuration.rb",
|
68
|
+
"test/test_formatters.rb",
|
48
69
|
"unipept.gemspec"
|
49
70
|
]
|
50
71
|
s.homepage = "https://github.com/unipept/unipept-cli/"
|
51
72
|
s.licenses = ["MIT"]
|
73
|
+
s.require_paths = ["lib"]
|
52
74
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
|
53
|
-
s.rubygems_version = "2.
|
75
|
+
s.rubygems_version = "2.1.11"
|
54
76
|
s.summary = "Command line interface to Unipept web services."
|
55
77
|
|
56
78
|
if s.respond_to? :specification_version then
|
@@ -59,28 +81,28 @@ Gem::Specification.new do |s|
|
|
59
81
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
82
|
s.add_runtime_dependency(%q<cri>, ["~> 2.7"])
|
61
83
|
s.add_runtime_dependency(%q<typhoeus>, ["~> 0.6"])
|
62
|
-
s.add_development_dependency(%q<
|
63
|
-
s.add_development_dependency(%q<
|
64
|
-
s.add_development_dependency(%q<
|
65
|
-
s.add_development_dependency(%q<jeweler>, ["
|
66
|
-
s.add_development_dependency(%q<
|
84
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
85
|
+
s.add_development_dependency(%q<minitest>, [">= 0"])
|
86
|
+
s.add_development_dependency(%q<rubocop>, [">= 0"])
|
87
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
88
|
+
s.add_development_dependency(%q<coveralls>, [">= 0"])
|
67
89
|
else
|
68
90
|
s.add_dependency(%q<cri>, ["~> 2.7"])
|
69
91
|
s.add_dependency(%q<typhoeus>, ["~> 0.6"])
|
70
|
-
s.add_dependency(%q<
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
73
|
-
s.add_dependency(%q<jeweler>, ["
|
74
|
-
s.add_dependency(%q<
|
92
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
93
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
94
|
+
s.add_dependency(%q<rubocop>, [">= 0"])
|
95
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
96
|
+
s.add_dependency(%q<coveralls>, [">= 0"])
|
75
97
|
end
|
76
98
|
else
|
77
99
|
s.add_dependency(%q<cri>, ["~> 2.7"])
|
78
100
|
s.add_dependency(%q<typhoeus>, ["~> 0.6"])
|
79
|
-
s.add_dependency(%q<
|
80
|
-
s.add_dependency(%q<
|
81
|
-
s.add_dependency(%q<
|
82
|
-
s.add_dependency(%q<jeweler>, ["
|
83
|
-
s.add_dependency(%q<
|
101
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
102
|
+
s.add_dependency(%q<minitest>, [">= 0"])
|
103
|
+
s.add_dependency(%q<rubocop>, [">= 0"])
|
104
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
105
|
+
s.add_dependency(%q<coveralls>, [">= 0"])
|
84
106
|
end
|
85
107
|
end
|
86
108
|
|