unipept 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/bin/peptfilter +4 -7
  4. data/bin/prot2pept +1 -2
  5. data/bin/unipept +6 -17
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0a1871129de9864d8a0f3d94f69801bf0c47818
4
- data.tar.gz: bb4d0a48cedfa093a7f5db110f4aef1b95dd3875
3
+ metadata.gz: 216218db5496eaf4c84cf3fd43fac2f2cf01a813
4
+ data.tar.gz: 4f4105f3800acb86cca19394f1250ea401c4dc96
5
5
  SHA512:
6
- metadata.gz: 0fc83d3c1cb5aad538c023bce61ad1a98aec39a8a1773dda7487fd68e9cd4f7d420cddcdaa9141649198a5a6e225b3886d30b8fee1b574da41a2e5e935b92a0c
7
- data.tar.gz: 9b206f1e7b2e7cc9e1cac27192290e4961dae998425b1eb59acbf6c675994dbe48ca8757ece33198ec2de05bbc457c83b72033353abe68edf2ba8f279ef44b9c
6
+ metadata.gz: 3f0466b7b587796a7782c947e52fbd765d7389b8d8015246bf51360b7bd37b990d1e1dd77a1e31f2ae78340c7aeb803f7d4eefb6ee18142e0d208e143e2f9fd9
7
+ data.tar.gz: d678b09fd59945f400ebd6bab8a047f6d0178884db63a6a7ad660080c1d95844182d7664d23b947ecb398ff54407702db38ee3c45ba310cb8f4eb5b39aa06c30
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
data/bin/peptfilter CHANGED
@@ -13,18 +13,15 @@ root_cmd = Cri::Command.new_basic_root.modify do
13
13
  maxlen = opts.fetch(:maxlen, "50").to_i
14
14
  lacks = opts.fetch(:lacks, "").chars.to_a
15
15
  contains = opts.fetch(:contains, "").chars.to_a
16
- filtered = $stdin.readlines.select do |pept|
16
+ $stdin.each_line do |pept|
17
17
  pept = pept.chomp
18
18
  length_ok = pept.length >= minlen && pept.length <= maxlen
19
19
  lacks_ok = (pept.chars.to_a & lacks).size == 0
20
20
  contains_ok = (pept.chars.to_a & contains).size == contains.size
21
21
 
22
- length_ok && lacks_ok && contains_ok
23
- end
24
- if opts[:unique]
25
- puts filtered.uniq
26
- else
27
- puts filtered
22
+ if length_ok && lacks_ok && contains_ok
23
+ puts pept
24
+ end
28
25
  end
29
26
  end
30
27
  end
data/bin/prot2pept CHANGED
@@ -6,8 +6,7 @@ root_cmd = Cri::Command.new_basic_root.modify do
6
6
  required :p, :pattern, "cleavage pattern to split input protein (default: ([KR])([^P]))"
7
7
  run do |opts, args, cmd|
8
8
  pattern = opts.fetch(:pattern, "([KR])([^P])")
9
- puts $stdin.readlines.map { |prot| prot.gsub(/#{pattern}/,"\\1\n\\2").gsub(/#{pattern}/, "\\1\n\\2") }.
10
- map {|s| s.split("\n")}.flatten.reject(&:empty?)
9
+ $stdin.each_line { |prot| puts prot.gsub(/#{pattern}/,"\\1\n\\2").gsub(/#{pattern}/, "\\1\n\\2").split("\n").reject(&:empty?) }
11
10
  end
12
11
  end
13
12
 
data/bin/unipept CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'cri'
4
4
  require 'faraday'
5
- require 'ruby-progressbar'
6
5
  require 'yaml'
7
6
  require 'json'
8
7
  require 'fileutils'
@@ -12,8 +11,6 @@ require_relative '../lib/unipept'
12
11
 
13
12
  class ApiRunner < Cri::CommandRunner
14
13
 
15
- attr_accessor :progress
16
-
17
14
  def initialize(args, opts, cmd)
18
15
  super
19
16
  host = Unipept::Configuration.new['host']
@@ -33,14 +30,12 @@ class ApiRunner < Cri::CommandRunner
33
30
  {'pept2taxa' => 'single', 'pept2lca' => 'lca'}
34
31
  end
35
32
 
36
- def read_input
33
+ def input_iterator
37
34
  if options[:input]
38
- peptides = File.readlines(options[:input])
35
+ File.readlines(options[:input]).each
39
36
  else
40
- peptides = STDIN.readlines
37
+ STDIN.each_line
41
38
  end
42
-
43
- peptides
44
39
  end
45
40
 
46
41
  def batch_size
@@ -63,12 +58,11 @@ class ApiRunner < Cri::CommandRunner
63
58
 
64
59
  def run
65
60
  formatter = Unipept::Formatter.new_for_format(options[:format])
66
- peptides = read_input
61
+ peptides = input_iterator
67
62
 
68
63
  filter_list = options[:select] ? options[:select] : []
69
64
  filter_list = filter_list.map {|f| glob_to_regex(f) }
70
65
  output = STDOUT.tty? ? STDOUT : STDERR
71
- self.progress = ProgressBar.create(total: peptides.size, output: output)
72
66
 
73
67
  printed_header = false
74
68
  result = []
@@ -93,7 +87,6 @@ class ApiRunner < Cri::CommandRunner
93
87
  end
94
88
 
95
89
  write_to_output formatter.format(sub_result)
96
- progress.progress += sub_division.size
97
90
  end
98
91
 
99
92
  begin
@@ -110,11 +103,7 @@ class ApiRunner < Cri::CommandRunner
110
103
  f.write string
111
104
  end
112
105
  else
113
- if STDOUT.tty?
114
- progress.log string
115
- else
116
- puts string
117
- end
106
+ puts string
118
107
  end
119
108
  end
120
109
 
@@ -150,7 +139,7 @@ class Taxa2lca < ApiRunner
150
139
  end
151
140
 
152
141
  def peptide_iterator(peptides, &block)
153
- block.call(peptides)
142
+ block.call(peptides.to_a)
154
143
  end
155
144
 
156
145
  def batch_size
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.6
4
+ version: 0.2.7
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-28 00:00:00.000000000 Z
11
+ date: 2014-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda