unipept 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/unipept +11 -7
- data/lib/unipept/batch_order.rb +28 -0
- data/lib/unipept.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8ceae14f14f26fc95744563b982738ef445d77b
|
4
|
+
data.tar.gz: e3a91a2e7ca3b2b076c19e0d7291bb90c69dfd04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354c5fd790c33c79d638455350a1b27aba0dfddf5e5d8e1b0c23c09ecaee7d185a88b7ad9be8fc14fdb1653e8f5c7bc71809085556da1b3c6bac7771b022eb3e
|
7
|
+
data.tar.gz: 0f86c782e0e1f058f6b5243671897b62619051334cd4f8e8f6f51bf655f160e1aeab28271b7226cd093cfaf9e9ff962ae1e476d37f4767e32882abeaaeb12700
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/bin/unipept
CHANGED
@@ -70,13 +70,15 @@ class ApiRunner < Cri::CommandRunner
|
|
70
70
|
filter_list = filter_list.map {|f| glob_to_regex(f) }
|
71
71
|
output = STDOUT.tty? ? STDOUT : STDERR
|
72
72
|
|
73
|
+
batch_order = Unipept::BatchOrder.new
|
74
|
+
|
73
75
|
printed_header = false
|
74
76
|
result = []
|
75
77
|
|
76
78
|
hydra = Typhoeus::Hydra.new(max_concurrency: 20)
|
77
79
|
num_req = 0
|
78
80
|
|
79
|
-
peptide_iterator(peptides) do |sub_division|
|
81
|
+
peptide_iterator(peptides).with_index do |sub_division, i|
|
80
82
|
if $interupted
|
81
83
|
$stdin.close
|
82
84
|
exit 1
|
@@ -100,11 +102,14 @@ class ApiRunner < Cri::CommandRunner
|
|
100
102
|
|
101
103
|
result << sub_result
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
# wait till it's our turn to write
|
106
|
+
batch_order.wait(i) do
|
107
|
+
if ! printed_header
|
108
|
+
write_to_output formatter.header(sub_result)
|
109
|
+
printed_header = true
|
110
|
+
end
|
111
|
+
write_to_output formatter.format(sub_result)
|
106
112
|
end
|
107
|
-
write_to_output formatter.format(sub_result)
|
108
113
|
else
|
109
114
|
path = File.expand_path(File.join(Dir.home, "unipept.log"))
|
110
115
|
File.open(path, "w") do |f|
|
@@ -117,9 +122,8 @@ class ApiRunner < Cri::CommandRunner
|
|
117
122
|
hydra.queue request
|
118
123
|
|
119
124
|
num_req += 1
|
120
|
-
if num_req ==
|
125
|
+
if num_req % 200 == 0
|
121
126
|
hydra.run
|
122
|
-
num_req = 0
|
123
127
|
end
|
124
128
|
|
125
129
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Unipept
|
2
|
+
|
3
|
+
class BatchOrder
|
4
|
+
|
5
|
+
attr_reader :order
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@order = {}
|
9
|
+
@current = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def wait(i, &block)
|
13
|
+
if i == @current
|
14
|
+
# start writing + those who have been waiting as well
|
15
|
+
block.call
|
16
|
+
@current += 1
|
17
|
+
while order[@current]
|
18
|
+
order.delete(@current).call
|
19
|
+
@current += 1
|
20
|
+
end
|
21
|
+
else
|
22
|
+
@order[i] = block
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/unipept.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unipept
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toon Willems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- bin/unipept
|
132
132
|
- bin/uniprot
|
133
133
|
- lib/unipept.rb
|
134
|
+
- lib/unipept/batch_order.rb
|
134
135
|
- lib/unipept/configuration.rb
|
135
136
|
- lib/unipept/formatters.rb
|
136
137
|
- test/helper.rb
|