unipept 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3efe88570b78401e07ba8e33aea86a992249db1
4
- data.tar.gz: 89f91e5cf9d921c2e3f332a39bf8fb08d2f41f4f
3
+ metadata.gz: e41863544a208f7a233fcba1e5d53d7b19ed2e79
4
+ data.tar.gz: 2c9ac26e6bcc27b4bc9c5f7a31ef8c4dba1682a4
5
5
  SHA512:
6
- metadata.gz: 94483a52a23563384ccb38a9befd0211d99e829cfa3b1bf71d1a58e760f9cd922b589a83b78d78d444786c70f3f0eaba2adf504bd3b315a33f06dd3f111dc5e6
7
- data.tar.gz: 6aa8bd08b5cd97b5ed11841a6f84ece7b7ea4c8cbe62c0d549697658ebcefc36157626a3a1c3e8b1e7d10b44cba2da5e727c485ea4f8705200d978a0364e27e6
6
+ metadata.gz: 3dd2bff19c1e90b6818f67b3320b2d1fc295b7c9c771d793aee69a9fd7dafeaa491e6b46ace0fecc19b77c2ab2a84217bc206935c74c70f4379b75f91e9a7d14
7
+ data.tar.gz: 315478728af58af13fac482240619c3349b9b4d00f451ca1302664724501203729018ebeb4427398bc84077bd982d305afea8bc02754583b681afc8aaeda3daa
data/README.md CHANGED
@@ -21,8 +21,8 @@ The Unipept CLI is available as a *gem*. This means it can easily be installed w
21
21
 
22
22
  ```bash
23
23
  $ gem install unipept
24
- Successfully installed unipept-0.7.0
25
- Parsing documentation for unipept-0.7.0
24
+ Successfully installed unipept-0.7.1
25
+ Parsing documentation for unipept-0.7.1
26
26
  Done installing documentation for unipept after 0 seconds
27
27
  1 gem installed
28
28
  ```
@@ -31,7 +31,7 @@ After successful installation, the unipept command should be available:
31
31
 
32
32
  ```bash
33
33
  $ unipept -v
34
- 0.7.0
34
+ 0.7.1
35
35
  ```
36
36
 
37
37
  The help can be accessed by running `unipept -h`.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -2,13 +2,12 @@ require 'set'
2
2
 
3
3
  module Unipept::Commands
4
4
  class ApiRunner < Cri::CommandRunner
5
-
6
5
  def initialize(args, opts, cmd)
7
6
  super
8
7
  @configuration = Unipept::Configuration.new
9
8
  set_configuration
10
9
 
11
- @user_agent = "Unipept CLI - unipept " + Unipept::VERSION
10
+ @user_agent = 'Unipept CLI - unipept ' + Unipept::VERSION
12
11
 
13
12
  @url = "#{@host}/api/v1/#{cmd.name}.json"
14
13
  @message_url = "#{@host}/api/v1/messages.json"
@@ -24,10 +23,10 @@ module Unipept::Commands
24
23
 
25
24
  # No host has been set?
26
25
  if host.nil? || host.empty?
27
- puts "WARNING: no host has been set, you can set the host with `unipept config host http://localhost:3000/`"
26
+ puts 'WARNING: no host has been set, you can set the host with `unipept config host http://localhost:3000/`'
28
27
  exit 1
29
28
  end
30
- if !host.start_with? "http://"
29
+ unless host.start_with? 'http://'
31
30
  host = "http://#{host}"
32
31
  end
33
32
 
@@ -56,12 +55,12 @@ module Unipept::Commands
56
55
  if filter.empty?
57
56
  names = true
58
57
  else
59
- names = filter.any? {|f| /.*name.*/.match f}
58
+ names = filter.any? { |f| /.*name.*/.match f }
60
59
  end
61
- {:input => sub_part,
62
- :equate_il => options[:equate],
63
- :extra => options[:extra],
64
- :names => names,
60
+ { input: sub_part,
61
+ equate_il: options[:equate],
62
+ extra: options[:all],
63
+ names: names
65
64
  }
66
65
  end
67
66
 
@@ -71,7 +70,7 @@ module Unipept::Commands
71
70
  last_fetched = @configuration['last_fetch_date']
72
71
  if last_fetched.nil? || (last_fetched + 60 * 60 * 24) < Time.now
73
72
  version = Unipept::VERSION
74
- resp = Typhoeus.get(@message_url, params: {version: version})
73
+ resp = Typhoeus.get(@message_url, params: { version: version })
75
74
  puts resp.body unless resp.body.chomp.empty?
76
75
  @configuration['last_fetch_date'] = Time.now
77
76
  @configuration.save
@@ -86,7 +85,7 @@ module Unipept::Commands
86
85
 
87
86
  filter_list = options[:select] ? options[:select] : []
88
87
  # Parse filter list: convert to regex and split on commas
89
- filter_list = filter_list.map { |f| f.include?(",") ? f.split(",") : f }.flatten.map { |f| glob_to_regex(f) }
88
+ filter_list = filter_list.map { |f| f.include?(',') ? f.split(',') : f }.flatten.map { |f| glob_to_regex(f) }
90
89
 
91
90
  batch_order = Unipept::BatchOrder.new
92
91
 
@@ -101,8 +100,8 @@ module Unipept::Commands
101
100
  @url,
102
101
  method: :post,
103
102
  body: url_options(sub_division),
104
- accept_encoding: "gzip",
105
- headers: {"User-Agent" => @user_agent}
103
+ accept_encoding: 'gzip',
104
+ headers: { 'User-Agent' => @user_agent }
106
105
  )
107
106
  request.on_complete do |resp|
108
107
  if resp.success?
@@ -157,7 +156,6 @@ module Unipept::Commands
157
156
  if num_req % 200 == 0
158
157
  hydra.run
159
158
  end
160
-
161
159
  end
162
160
 
163
161
  hydra.run
@@ -165,9 +163,8 @@ module Unipept::Commands
165
163
  begin
166
164
  download_xml(result)
167
165
  rescue
168
- STDERR.puts "Something went wrong while downloading xml information! please check the output"
166
+ STDERR.puts 'Something went wrong while downloading xml information! please check the output'
169
167
  end
170
-
171
168
  end
172
169
 
173
170
  def save_error(message)
@@ -189,11 +186,10 @@ module Unipept::Commands
189
186
  end
190
187
  end
191
188
 
192
-
193
189
  def download_xml(result)
194
190
  if options[:xml]
195
- File.open(options[:xml] + ".xml", "wb") do |f|
196
- f.write Typhoeus.get("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=taxonomy&id=#{result.first.map{|h| h['taxon_id'] }.join(",")}&retmode=xml").response_body
191
+ File.open(options[:xml] + '.xml', 'wb') do |f|
192
+ f.write Typhoeus.get("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=taxonomy&id=#{result.first.map { |h| h['taxon_id'] }.join(',')}&retmode=xml").response_body
197
193
  end
198
194
  end
199
195
  end
@@ -203,7 +199,7 @@ module Unipept::Commands
203
199
  if first.start_with? '>'
204
200
  # FASTA MODE ENGAGED
205
201
  fasta_header = first.chomp
206
- peptides.each_slice(batch_size).with_index do |sub,i|
202
+ peptides.each_slice(batch_size).with_index do |sub, i|
207
203
  fasta_input = []
208
204
  # Use a set so we don't ask data twice
209
205
  newsub = Set.new
@@ -237,8 +233,7 @@ module Unipept::Commands
237
233
  private
238
234
 
239
235
  def glob_to_regex(string)
240
- /^#{string.gsub('*','.*')}$/
236
+ /^#{string.gsub('*', '.*')}$/
241
237
  end
242
-
243
238
  end
244
239
  end
data/unipept.gemspec CHANGED
@@ -2,11 +2,11 @@
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.7.0 ruby lib
5
+ # stub: unipept 0.7.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "unipept"
9
- s.version = "0.7.0"
9
+ s.version = "0.7.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unipept
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toon Willems