unipept 0.2.8 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/VERSION +1 -1
  4. data/bin/peptfilter +5 -0
  5. data/bin/prot2pept +8 -1
  6. data/bin/unipept +17 -1
  7. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1201c278ea38d7192f6a6799bd9873a0b77d54da
4
- data.tar.gz: d6685c8616187aac8a4a8ab39b684f2760df9660
3
+ metadata.gz: 0ead8dcab7989d462a289d66dcde96b8fd190953
4
+ data.tar.gz: 239fb70845d676a350a0c2ec0c0ba378c196a3d2
5
5
  SHA512:
6
- metadata.gz: 069d8c44079858a7a2a715ce76194cfc9df1bf5a86f87bc496f2c25fbbe9a6f4a536fb5845c3858e0c715c7bb26e978f3b4dd68b70ca3b771df6e04ac0be9c4d
7
- data.tar.gz: 18040c09a3a23238df5668ee8011549188503e73fc5cbab76daf467aa22e7ed7eff68ead46fbfb631b1c21e50644a280f42ab4c469e750765b71ea446af16b89
6
+ metadata.gz: 98489a9cc2ad823dd787f540e4b5810fb4f98215e5ef73c5ff7756991c7c6cb44d6491218942c115e4fce1e5f9ea809c4d5766d3b56fb1d6a13a987fe4d27448
7
+ data.tar.gz: 30239e524d0d45121caee7c68a26eef59275eac3cc0c0890c6a66d6a28c6f240945d2c992a41e1bdb13f6e6f376feb68a5d47571cecd9864a82ccc4f95b520a0
data/Rakefile CHANGED
@@ -25,7 +25,6 @@ Jeweler::Tasks.new do |gem|
25
25
  # dependencies defined in Gemfile
26
26
  gem.add_dependency 'faraday', '~> 0.9'
27
27
  gem.add_dependency 'cri', '~> 2.6'
28
- gem.add_dependency 'ruby-progressbar', '~> 1.4'
29
28
  end
30
29
  Jeweler::RubygemsDotOrgTasks.new
31
30
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.10
data/bin/peptfilter CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'cri'
3
3
 
4
+ trap "INT" do
5
+ $interupted = true
6
+ end
7
+ Signal.trap("PIPE", "EXIT")
4
8
  root_cmd = Cri::Command.new_basic_root.modify do
5
9
  name 'peptfilter'
6
10
  flag :i, :unique, "only output unique peptides"
@@ -14,6 +18,7 @@ root_cmd = Cri::Command.new_basic_root.modify do
14
18
  lacks = opts.fetch(:lacks, "").chars.to_a
15
19
  contains = opts.fetch(:contains, "").chars.to_a
16
20
  $stdin.each_line do |pept|
21
+ break if $interupted
17
22
  pept = pept.chomp
18
23
  length_ok = pept.length >= minlen && pept.length <= maxlen
19
24
  lacks_ok = (pept.chars.to_a & lacks).size == 0
data/bin/prot2pept CHANGED
@@ -1,12 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'cri'
3
3
 
4
+ trap "INT" do
5
+ $interupted = true
6
+ end
7
+ Signal.trap("PIPE", "EXIT")
4
8
  root_cmd = Cri::Command.new_basic_root.modify do
5
9
  name 'prot2pept'
6
10
  required :p, :pattern, "cleavage pattern to split input protein (default: ([KR])([^P]))"
7
11
  run do |opts, args, cmd|
8
12
  pattern = opts.fetch(:pattern, "([KR])([^P])")
9
- $stdin.each_line { |prot| puts prot.gsub(/#{pattern}/,"\\1\n\\2").gsub(/#{pattern}/, "\\1\n\\2").split("\n").reject(&:empty?) }
13
+ $stdin.each_line do |prot|
14
+ break if $interupted
15
+ puts prot.gsub(/#{pattern}/,"\\1\n\\2").gsub(/#{pattern}/, "\\1\n\\2").split("\n").reject(&:empty?)
16
+ end
10
17
  end
11
18
  end
12
19
 
data/bin/unipept CHANGED
@@ -8,6 +8,12 @@ require 'fileutils'
8
8
 
9
9
  require_relative '../lib/unipept'
10
10
 
11
+ $interupted = false
12
+
13
+ trap "INT" do
14
+ puts "Interupted, exiting..."
15
+ $interupted = true
16
+ end
11
17
 
12
18
  class ApiRunner < Cri::CommandRunner
13
19
 
@@ -68,6 +74,10 @@ class ApiRunner < Cri::CommandRunner
68
74
  result = []
69
75
 
70
76
  peptide_iterator(peptides) do |sub_division|
77
+ if $interupted
78
+ $stdin.close
79
+ exit 1
80
+ end
71
81
  begin
72
82
  sub_result = JSON[Faraday.post(@url, url_options(sub_division)).body]
73
83
  rescue
@@ -173,10 +183,16 @@ end
173
183
 
174
184
  root_cmd = Cri::Command.new_basic_root.modify do
175
185
  name 'unipept'
176
- flag :v, :verbose, "verbose mode"
186
+ flag :v, :version, "print version"
177
187
  option :i, :input, "input file", :argument => :required
178
188
  option :o, :output, "output file", :argument => :required
179
189
  option :f, :format, "output format (available: #{Unipept::Formatter.available.join "," }) (default: #{Unipept::Formatter.default})", :argument => :required
190
+
191
+ run do |opts, args, cmd|
192
+ if opts[:version]
193
+ puts File.read(File.join(File.dirname(__FILE__), "..", "VERSION"))
194
+ end
195
+ end
180
196
  end
181
197
 
182
198
  root_cmd.define_command('config') do
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.2.8
4
+ version: 0.2.10
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-04-29 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.6'
111
- - !ruby/object:Gem::Dependency
112
- name: ruby-progressbar
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.4'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.4'
125
111
  description: CLI interface to unipept
126
112
  email: willemstoon@gmail.com
127
113
  executables: