unipept 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 773e25ed2369843012700a657100181e84254c905365d534136d0c1a68606ab7
4
- data.tar.gz: 78830dfab3cab145cf248b2bc41d65806a3a4274ab1d48b9be1d530c7f2eb865
3
+ metadata.gz: 2f4204e204b0e0ab2cb65f750fb89e021d4d5cc1d0b845dd1e7d88e40fe221b0
4
+ data.tar.gz: 0f75df131260799611b2fab1d1be26ac248212bc7430b5845fc7afc97c70abfe
5
5
  SHA512:
6
- metadata.gz: 55648c665eadd51c119e4091a3e8e110189df97ac70eeceee0a9a508e8b7112cd522dbec23ae55c1172e061b95b192cc383190640ec68dbd316273510640b598
7
- data.tar.gz: fdcf5b35931caee76a3acfa6a8be7828f902570e9b6669f4d184b55321dcd0177d9bd363214f4d2b4766b13010eebe15e7e1beed549b4b864a95f71684a178ae
6
+ metadata.gz: 4d768d34c3b5aa94d507fd927235ba5347a7432c68e6d5a42cbb8efc360180dddccde15f3495c4717942a097ee538abde9cbf5edefefb2de485370f078bd396f
7
+ data.tar.gz: 61987f9e9f0b3be37801f7ef88ec39e4915207785fe294f781dafcdac7de8dd0041022497ec794b033022c132378f4393f40ed2d9eac55601b61d0398fe307a4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 2.0.0
@@ -9,9 +9,13 @@ require_relative '../server_message'
9
9
  require_relative '../version'
10
10
 
11
11
  require_relative 'unipept/config'
12
+ require_relative 'unipept/pept2ec'
13
+ require_relative 'unipept/pept2funct'
14
+ require_relative 'unipept/pept2go'
12
15
  require_relative 'unipept/pept2lca'
13
16
  require_relative 'unipept/pept2prot'
14
17
  require_relative 'unipept/pept2taxa'
18
+ require_relative 'unipept/peptinfo'
15
19
  require_relative 'unipept/taxa2lca'
16
20
  require_relative 'unipept/taxonomy'
17
21
 
@@ -21,7 +25,11 @@ module Unipept
21
25
  @root_command = create_root_command
22
26
  add_config_command
23
27
  add_pept2taxa_command
28
+ add_pept2ec_command
29
+ add_pept2funct_command
30
+ add_pept2go_command
24
31
  add_pept2lca_command
32
+ add_peptinfo_command
25
33
  add_taxa2lca_command
26
34
  add_pept2prot_command
27
35
  add_taxonomy_command
@@ -115,6 +123,78 @@ module Unipept
115
123
  end
116
124
  end
117
125
 
126
+ def add_pept2ec_command
127
+ @root_command.define_command('pept2ec') do
128
+ usage 'pept2ec[options]'
129
+ summary 'Fetch EC numbers of UniProt entries that match tryptic peptides.'
130
+ description <<-EOS
131
+ For each tryptic peptide the unipept pept2ec command retrieves from Unipept the set of EC numbers from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed
132
+
133
+ - as separate command line arguments
134
+
135
+ - in a text file that is passed as an argument to the -i option
136
+
137
+ - to standard input
138
+
139
+ The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.
140
+ EOS
141
+
142
+ flag :e, :equate, 'equate isoleucine (I) and leucine (L) when matching peptides'
143
+ flag :a, :all, 'Also return the names of the EC numbers. Note that this may have a performance penalty.'
144
+ option :s, :select, 'select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.', argument: :required, multiple: true
145
+
146
+ runner Commands::Pept2ec
147
+ end
148
+ end
149
+
150
+ def add_pept2funct_command
151
+ @root_command.define_command('pept2funct') do
152
+ usage 'pept2ec[options]'
153
+ summary 'Fetch EC numbers and GO terms of UniProt entries that match tryptic peptides.'
154
+ description <<-EOS
155
+ For each tryptic peptide the unipept pept2funct command retrieves from Unipept the set of EC numbers and GO terms from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed
156
+
157
+ - as separate command line arguments
158
+
159
+ - in a text file that is passed as an argument to the -i option
160
+
161
+ - to standard input
162
+
163
+ The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.
164
+ EOS
165
+
166
+ flag :e, :equate, 'equate isoleucine (I) and leucine (L) when matching peptides'
167
+ flag :a, :all, 'Also return the names of the EC numbers and GO terms. Note that this may have a performance penalty.'
168
+ option :s, :select, 'select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.', argument: :required, multiple: true
169
+
170
+ runner Commands::Pept2funct
171
+ end
172
+ end
173
+
174
+ def add_pept2go_command
175
+ @root_command.define_command('pept2go') do
176
+ usage 'pept2go [options]'
177
+ summary 'Fetch GO terms of UniProt entries that match tryptic peptides.'
178
+ description <<-EOS
179
+ For each tryptic peptide the unipept pept2go command retrieves from Unipept the set of GO terms from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed
180
+
181
+ - as separate command line arguments
182
+
183
+ - in a text file that is passed as an argument to the -i option
184
+
185
+ - to standard input
186
+
187
+ The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.
188
+ EOS
189
+
190
+ flag :e, :equate, 'equate isoleucine (I) and leucine (L) when matching peptides'
191
+ flag :a, :all, 'Also return the names of the GO terms. Note that this may have a performance penalty.'
192
+ option :s, :select, 'select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.', argument: :required, multiple: true
193
+
194
+ runner Commands::Pept2go
195
+ end
196
+ end
197
+
118
198
  def add_pept2lca_command
119
199
  @root_command.define_command('pept2lca') do
120
200
  usage 'pept2lca [options]'
@@ -139,6 +219,30 @@ module Unipept
139
219
  end
140
220
  end
141
221
 
222
+ def add_peptinfo_command
223
+ @root_command.define_command('peptinfo') do
224
+ usage 'peptinfo [options]'
225
+ summary 'Fetch functional information and the taxonomic lowest common ancestor of UniProt entries that match tryptic peptides.'
226
+ description <<-EOS
227
+ For each tryptic peptide the unipept peptinfo command retrieves from Unipept the functional information and the lowest common ancestor of the set of taxa from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The lowest common ancestor is based on the topology of the Unipept Taxonomy -- a cleaned up version of the NCBI Taxonomy -- and is itself a record from the NCBI Taxonomy. The command expects a list of tryptic peptides that are passed
228
+
229
+ - as separate command line arguments
230
+
231
+ - in a text file that is passed as an argument to the -i option
232
+
233
+ - to standard input
234
+
235
+ The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.
236
+ EOS
237
+
238
+ flag :e, :equate, 'equate isoleucine (I) and leucine (L) when matching peptides'
239
+ flag :a, :all, 'report the names of the functional annotations and all information fields of NCBI Taxonomy records available in Unipept. Note that this may have a performance penalty.'
240
+ option :s, :select, 'select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.', argument: :required, multiple: true
241
+
242
+ runner Commands::Peptinfo
243
+ end
244
+ end
245
+
142
246
  def add_taxa2lca_command
143
247
  @root_command.define_command('taxa2lca') do
144
248
  usage 'taxa2lca [options]'
@@ -0,0 +1,16 @@
1
+ require_relative 'api_runner'
2
+ module Unipept::Commands
3
+ class Pept2ec < ApiRunner
4
+ def required_fields
5
+ ['peptide']
6
+ end
7
+
8
+ def default_batch_size
9
+ if options[:all]
10
+ 100
11
+ else
12
+ 1000
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'api_runner'
2
+ module Unipept::Commands
3
+ class Pept2funct < ApiRunner
4
+ def required_fields
5
+ ['peptide']
6
+ end
7
+
8
+ def default_batch_size
9
+ if options[:all]
10
+ 100
11
+ else
12
+ 1000
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'api_runner'
2
+ module Unipept::Commands
3
+ class Pept2go < ApiRunner
4
+ def required_fields
5
+ ['peptide']
6
+ end
7
+
8
+ def default_batch_size
9
+ if options[:all]
10
+ 100
11
+ else
12
+ 1000
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'api_runner'
2
+ module Unipept::Commands
3
+ class Peptinfo < ApiRunner
4
+ def required_fields
5
+ ['peptide']
6
+ end
7
+
8
+ def default_batch_size
9
+ if options[:all]
10
+ 100
11
+ else
12
+ 1000
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/formatters.rb CHANGED
@@ -186,7 +186,18 @@ module Unipept
186
186
  CSV.generate do |csv|
187
187
  first = data.first
188
188
  keys = fasta_mapper ? ['fasta_header'] : []
189
- csv << (keys + first.keys).map(&:to_s) if first
189
+
190
+ keys += first.keys
191
+
192
+ %w[ec go].each do |annotation|
193
+ next unless keys.include?(annotation)
194
+
195
+ idx = keys.index(annotation)
196
+ keys.delete_at(idx)
197
+ keys.insert(idx, *first[annotation].first.keys.map { |el| el == 'protein_count' ? annotation + '_protein_count' : el })
198
+ end
199
+
200
+ csv << keys.map(&:to_s) if first
190
201
  end
191
202
  end
192
203
 
@@ -204,7 +215,17 @@ module Unipept
204
215
  def convert(data, _first)
205
216
  CSV.generate do |csv|
206
217
  data.each do |o|
207
- csv << o.values.map { |v| v == '' ? nil : v }
218
+ row = []
219
+ o.each do |k, v|
220
+ if %w[ec go].include? k
221
+ v.first.keys.each do |key|
222
+ row << (v.map { |el| el[key] }).join(' ')
223
+ end
224
+ else
225
+ row << (v == '' ? nil : v)
226
+ end
227
+ end
228
+ csv << row
208
229
  end
209
230
  end
210
231
  end
data/unipept.gemspec CHANGED
@@ -2,16 +2,16 @@
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 1.4.1 ruby lib
5
+ # stub: unipept 2.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "unipept".freeze
9
- s.version = "1.4.1"
9
+ s.version = "2.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Toon Willems".freeze, "Bart Mesuere".freeze, "Tom Naessens".freeze]
14
- s.date = "2019-01-19"
14
+ s.date = "2019-06-19"
15
15
  s.description = " Command line interface to the Unipept (http://unipept.ugent.be) web services\n (pept2lca, taxa2lca, pept2taxa, pept2prot and taxonomy) and some utility\n commands for handling proteins using the command line.\n".freeze
16
16
  s.email = "unipept@ugent.be".freeze
17
17
  s.executables = ["unipept".freeze, "prot2pept".freeze, "peptfilter".freeze, "uniprot".freeze]
@@ -42,9 +42,13 @@ Gem::Specification.new do |s|
42
42
  "lib/commands/unipept.rb",
43
43
  "lib/commands/unipept/api_runner.rb",
44
44
  "lib/commands/unipept/config.rb",
45
+ "lib/commands/unipept/pept2ec.rb",
46
+ "lib/commands/unipept/pept2funct.rb",
47
+ "lib/commands/unipept/pept2go.rb",
45
48
  "lib/commands/unipept/pept2lca.rb",
46
49
  "lib/commands/unipept/pept2prot.rb",
47
50
  "lib/commands/unipept/pept2taxa.rb",
51
+ "lib/commands/unipept/peptinfo.rb",
48
52
  "lib/commands/unipept/taxa2lca.rb",
49
53
  "lib/commands/unipept/taxonomy.rb",
50
54
  "lib/commands/uniprot.rb",
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: 1.4.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toon Willems
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-01-19 00:00:00.000000000 Z
13
+ date: 2019-06-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cri
@@ -133,9 +133,13 @@ files:
133
133
  - lib/commands/unipept.rb
134
134
  - lib/commands/unipept/api_runner.rb
135
135
  - lib/commands/unipept/config.rb
136
+ - lib/commands/unipept/pept2ec.rb
137
+ - lib/commands/unipept/pept2funct.rb
138
+ - lib/commands/unipept/pept2go.rb
136
139
  - lib/commands/unipept/pept2lca.rb
137
140
  - lib/commands/unipept/pept2prot.rb
138
141
  - lib/commands/unipept/pept2taxa.rb
142
+ - lib/commands/unipept/peptinfo.rb
139
143
  - lib/commands/unipept/taxa2lca.rb
140
144
  - lib/commands/unipept/taxonomy.rb
141
145
  - lib/commands/uniprot.rb