unipept 0.2.3 → 0.2.4

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/bin/peptfilter +2 -2
  4. data/bin/unipept +19 -12
  5. data/bin/uniprot +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 916121b8faa447c8d47611a59241c2635976579f
4
- data.tar.gz: 578e9800d943b98e90d6abd2dbb0eccd59ab5c62
3
+ metadata.gz: 24fa491dfa6ce5dbfbe53ff9bd7ee63159ff0b8f
4
+ data.tar.gz: d353c545fdd8db4bb33d873046f4dbf7d2a5fdab
5
5
  SHA512:
6
- metadata.gz: c30aee8e009a16872f8bc8e436cd78766a7e88a372fab19e78e4fdf90d12711a87fa49c847da6c0dd14d9e8575e14a97f7b23ec76302ff514b6da8a6e0e13c0e
7
- data.tar.gz: 9671cef3e615013e4988e886f21feabff0d69c5ff2e47f5379d39fdc475b3c37c324b8053766cd1b8389347d71ba36aaecb9ac34eb1e324d3dd522dc48fd0048
6
+ metadata.gz: 309a643a2f2f0b98c305e269aae484aa1c9c3dfed0c665a69ab2475dbf9a23b2c0519dae6b6fe5c25ab1e21dbc44fcd65d123c0a231c087242a178eed6f7c693
7
+ data.tar.gz: 43d0c9c573c2cab2facc26730873401dc07d5c1876b5927e9c226a6356a24189b652a5229292286719f1cae09dbba47f639be5caf72b97067bbd8e8285e00c4f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/bin/peptfilter CHANGED
@@ -16,8 +16,8 @@ root_cmd = Cri::Command.new_basic_root.modify do
16
16
  filtered = $stdin.readlines.select do |pept|
17
17
  pept = pept.chomp
18
18
  length_ok = pept.length >= minlen && pept.length <= maxlen
19
- lacks_ok = (pept.chars & lacks).size == 0
20
- contains_ok = (pept.chars & contains).size == contains.size
19
+ lacks_ok = (pept.chars.to_a & lacks).size == 0
20
+ contains_ok = (pept.chars.to_a & contains).size == contains.size
21
21
 
22
22
  length_ok && lacks_ok && contains_ok
23
23
  end
data/bin/unipept CHANGED
@@ -73,7 +73,7 @@ class ApiRunner < Cri::CommandRunner
73
73
  printed_header = false
74
74
  result = []
75
75
 
76
- peptides.each_slice(self.batch_size) do |sub_division|
76
+ peptide_iterator(peptides) do |sub_division|
77
77
  begin
78
78
  sub_result = JSON[Faraday.post(@url, url_options(sub_division)).body]
79
79
  rescue
@@ -105,18 +105,17 @@ class ApiRunner < Cri::CommandRunner
105
105
  end
106
106
 
107
107
  def write_to_output(string)
108
- if options[:output]
109
- File.open(options[:output], 'a') do |f|
110
- f.write string
111
- end
108
+ if options[:output]
109
+ File.open(options[:output], 'a') do |f|
110
+ f.write string
111
+ end
112
+ else
113
+ if STDOUT.tty?
114
+ progress.log string
112
115
  else
113
- if STDOUT.tty?
114
- progress.log string
115
- else
116
- puts string
117
- end
116
+ puts string
118
117
  end
119
-
118
+ end
120
119
  end
121
120
 
122
121
 
@@ -128,6 +127,10 @@ class ApiRunner < Cri::CommandRunner
128
127
  end
129
128
  end
130
129
 
130
+ def peptide_iterator(peptides, &block)
131
+ peptides.each_slice(batch_size, &block)
132
+ end
133
+
131
134
  private
132
135
 
133
136
  def glob_to_regex(glob_string)
@@ -146,8 +149,12 @@ class Taxa2lca < ApiRunner
146
149
  {:taxon_ids => sub_part, :full_lineage => options[:lineage]}
147
150
  end
148
151
 
152
+ def peptide_iterator(peptides, &block)
153
+ block.call(peptides)
154
+ end
155
+
149
156
  def batch_size
150
- 100_000_000_000
157
+ raise "NOT NEEDED FOR TAXA2LCA"
151
158
  end
152
159
 
153
160
  end
data/bin/uniprot CHANGED
@@ -3,6 +3,6 @@ require 'faraday'
3
3
  ARGV.each do |arg|
4
4
  resp = Faraday.get("http://www.uniprot.org/uniprot/#{arg}.fasta")
5
5
  if resp.success?
6
- puts resp.body.lines[1..-1].map(&:chomp).join("")
6
+ puts resp.body.lines.map(&:chomp)[1..-1].join("")
7
7
  end
8
8
  end
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.3
4
+ version: 0.2.4
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-24 00:00:00.000000000 Z
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda