mspire 0.6.6 → 0.6.7

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.6
1
+ 0.6.7
@@ -11,6 +11,7 @@ module CV
11
11
  push CV::Param.new(*args)
12
12
  end
13
13
 
14
+ # for now, assumes xml is a Nokogiri::XML::Builder object
14
15
  def to_xml(xml)
15
16
  each {|param| param.to_xml(xml) }
16
17
  end
data/lib/cv/param.rb CHANGED
@@ -9,6 +9,7 @@ module CV
9
9
  (@cv_ref, @accession, @name, @value) = [cv_ref, accession, name, value]
10
10
  end
11
11
 
12
+ # for now, assumes this is a Nokogiri::XML::Builder object
12
13
  def to_xml(xml, name=:cvParam)
13
14
  hash_to_send = {:cvRef => @cvref, :accession => @accession, :name => @name}
14
15
  hash_to_send[:value] = @value if @value
@@ -0,0 +1,44 @@
1
+ require 'ms/cv/param'
2
+
3
+ module MS
4
+ module CV
5
+ # An MS::Description is a convenient way to specify several mass spec related
6
+ # cvParam objects at once.
7
+ #
8
+ # examples of usage:
9
+ #
10
+ # Description.new( <CV::Param> )
11
+ # Description['MS:1000004', ['MS:1000004'], ['IMS:1000042', 23], param_obj, args]
12
+ # Description.new do
13
+ # param MS:1000004
14
+ # param MS:1000042, 23
15
+ # end
16
+ class Description < Array
17
+
18
+ # ensures that each argument is an argument that can be handled by
19
+ # CV::Param. Returns the Description object it creates
20
+ def self.[](*args)
21
+ list = self.new
22
+ args.each do |arg|
23
+ arg.is_a?(Array) ? list.param(*arg) : list.param(arg)
24
+ end
25
+ list
26
+ end
27
+
28
+ # takes a list of valid CV::Param objects, or they can be set in the block
29
+ # using param
30
+ def initialize(*args, &block)
31
+ args.each {|arg| param(arg) }
32
+ instance_eval &block if block
33
+ end
34
+
35
+ # if the first object is a MS::CV::Param it is just pushed onto the list,
36
+ # otherwise the arguments are sent in to initialize a fresh MS::CV::Param,
37
+ # and this object is pushed onto the list.
38
+ def param(*args)
39
+ push args.first.is_a?(::CV::Param) ? args.first : MS::CV::Param.new(*args)
40
+ end
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,39 @@
1
+
2
+ require 'ms/cv'
3
+
4
+ module MS
5
+ module CV
6
+
7
+ # a mass spec related CVParam. It initializes with a variety of obo
8
+ # accession numbers or objects to make writing CV's as easy as possible.
9
+ class Param < ::CV::Param
10
+
11
+ # takes a variety of arguments (acc = accession):
12
+ #
13
+ # acc#
14
+ # acc#, value
15
+ # acc#, unit_acc# or CV::Param object
16
+ # acc#, value, unit_acc# or CV::Param object
17
+ # cvref, acc#, name
18
+ # cvref, acc#, name, value
19
+ # cvref, acc#, name, unit_acc# or CV::Param object
20
+ # cvref, acc#, name, value, unit_acc# or CV::Param object
21
+ def initialize(*args)
22
+ @unit =
23
+ if args.size > 1 && ((args.last.is_a?(::CV::Param) || args.last =~ /[A-Za-z]+:\d+/))
24
+ unit_arg = args.pop
25
+ unit_arg.is_a?(::CV::Param) ? unit_arg : self.class.new(unit_arg)
26
+ end
27
+ (@cv_ref, @accession, @name, @value) =
28
+ case args.size
29
+ when 1..2 # accession number (maybe with value)
30
+ (obo_type, accnum) = args.first.split(':')
31
+ [obo_type, args.first, MS::CV::Obo[obo_type][args.first], args[1]]
32
+ when 3..4 # they have fully specified the object
33
+ args
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ end
data/lib/ms/cv.rb ADDED
@@ -0,0 +1,16 @@
1
+
2
+ require 'cv'
3
+ require 'obo/ms'
4
+ require 'obo/ims'
5
+ require 'obo/unit'
6
+
7
+ module MS
8
+ module CV
9
+ Obo = {
10
+ 'MS' => Obo::MS.id_to_name,
11
+ 'IMS' => Obo::IMS.id_to_name,
12
+ 'UO' => Obo::Unit.id_to_name,
13
+ }
14
+ end
15
+ end
16
+
data/lib/ms/mass.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module MS
3
2
  module Mass
4
3
 
@@ -39,6 +38,7 @@ module MS
39
38
  'h2o' => 18.0105647,
40
39
  'oh' => 17.002739665,
41
40
  'e' => 0.0005486,
41
+ 'se' => 79.9165196
42
42
  }
43
43
  AVG_STR = {
44
44
  'h+' => 1.007276, # using Mascot_H_plus mass (is this right for AVG??)
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
- require 'ms/cvlist'
2
+ require 'ms/cv/description'
3
3
  require 'cv'
4
4
 
5
- describe 'appending CV params objects to an MS::CVList' do
5
+ describe 'appending CV params objects to an MS::CV::Description' do
6
6
  describe 'intelligently appending params with #param' do
7
7
  before do
8
- @cv = MS::CVList.new
8
+ @cv = MS::CV::Description.new
9
9
  end
10
10
  it 'sends detailed descriptions to CV::Param.new' do
11
11
  arglist = [
@@ -36,7 +36,7 @@ describe 'appending CV params objects to an MS::CVList' do
36
36
  end
37
37
  describe 'appending on initialization' do
38
38
  it 'can be done with a block' do
39
- cvlist = MS::CVList.new do
39
+ cvlist = MS::CV::Description.new do
40
40
  param 'MS:1000004' # sample mass
41
41
  param 'IMS:1000042', 23 # max count of pixels of y
42
42
  end
@@ -47,7 +47,7 @@ describe 'appending CV params objects to an MS::CVList' do
47
47
  it 'can be done with brackets' do
48
48
  args = ['IMS', 'IMS:1000052', 'position z', 22]
49
49
  param_obj = CV::Param.new(*args)
50
- cvlist = MS::CVList['MS:1000004', ['MS:1000004'], ['IMS:1000042', 23], param_obj, args]
50
+ cvlist = MS::CV::Description['MS:1000004', ['MS:1000004'], ['IMS:1000042', 23], param_obj, args]
51
51
  cvlist.size.should == 5
52
52
  cvlist[0].should == cvlist[1]
53
53
  cvlist.each do |param|
metadata CHANGED
@@ -1,105 +1,103 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mspire
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.7
4
5
  prerelease:
5
- version: 0.6.6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - John T. Prince
9
9
  - Simon Chiang
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2012-02-13 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2012-02-16 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: nokogiri
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &8166300 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
19
+ requirements:
22
20
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: "1.5"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.5'
25
23
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: bsearch
29
24
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *8166300
26
+ - !ruby/object:Gem::Dependency
27
+ name: bsearch
28
+ requirement: &8165640 !ruby/object:Gem::Requirement
31
29
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
35
33
  version: 1.5.0
36
34
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: andand
40
35
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *8165640
37
+ - !ruby/object:Gem::Dependency
38
+ name: andand
39
+ requirement: &8164920 !ruby/object:Gem::Requirement
42
40
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
46
44
  version: 1.3.1
47
45
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: obo
51
46
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *8164920
48
+ - !ruby/object:Gem::Dependency
49
+ name: obo
50
+ requirement: &8163980 !ruby/object:Gem::Requirement
53
51
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
57
55
  version: 0.1.0
58
56
  type: :runtime
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rspec
62
57
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *8163980
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: &8162940 !ruby/object:Gem::Requirement
64
62
  none: false
65
- requirements:
63
+ requirements:
66
64
  - - ~>
67
- - !ruby/object:Gem::Version
68
- version: "2.6"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.6'
69
67
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: jeweler
73
68
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: *8162940
70
+ - !ruby/object:Gem::Dependency
71
+ name: jeweler
72
+ requirement: &8162280 !ruby/object:Gem::Requirement
75
73
  none: false
76
- requirements:
74
+ requirements:
77
75
  - - ~>
78
- - !ruby/object:Gem::Version
76
+ - !ruby/object:Gem::Version
79
77
  version: 1.5.2
80
78
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: rcov
84
79
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
80
+ version_requirements: *8162280
81
+ - !ruby/object:Gem::Dependency
82
+ name: rcov
83
+ requirement: &8161500 !ruby/object:Gem::Requirement
86
84
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
91
89
  type: :development
92
- version_requirements: *id007
93
- description: mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire, merging of ms-* gems
90
+ prerelease: false
91
+ version_requirements: *8161500
92
+ description: mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire,
93
+ merging of ms-* gems
94
94
  email: jtprince@gmail.com
95
95
  executables: []
96
-
97
96
  extensions: []
98
-
99
- extra_rdoc_files:
97
+ extra_rdoc_files:
100
98
  - LICENSE
101
99
  - README.rdoc
102
- files:
100
+ files:
103
101
  - LICENSE
104
102
  - README.rdoc
105
103
  - Rakefile
@@ -112,7 +110,9 @@ files:
112
110
  - lib/io/bookmark.rb
113
111
  - lib/merge.rb
114
112
  - lib/ms.rb
115
- - lib/ms/cvlist.rb
113
+ - lib/ms/cv.rb
114
+ - lib/ms/cv/description.rb
115
+ - lib/ms/cv/param.rb
116
116
  - lib/ms/digester.rb
117
117
  - lib/ms/fasta.rb
118
118
  - lib/ms/ident.rb
@@ -161,7 +161,7 @@ files:
161
161
  - obo/ms.obo
162
162
  - obo/unit.obo
163
163
  - spec/bin_spec.rb
164
- - spec/ms/cvlist_spec.rb
164
+ - spec/ms/cv/description_spec.rb
165
165
  - spec/ms/digester_spec.rb
166
166
  - spec/ms/fasta_spec.rb
167
167
  - spec/ms/ident/peptide/db_spec.rb
@@ -206,31 +206,28 @@ files:
206
206
  - spec/testfiles/ms/quant/unlog_transform.rb
207
207
  - spec/testfiles/plms1/output.key
208
208
  homepage: http://github.com/princelab/mspire
209
- licenses:
209
+ licenses:
210
210
  - MIT
211
211
  post_install_message:
212
212
  rdoc_options: []
213
-
214
- require_paths:
213
+ require_paths:
215
214
  - lib
216
- required_ruby_version: !ruby/object:Gem::Requirement
215
+ required_ruby_version: !ruby/object:Gem::Requirement
217
216
  none: false
218
- requirements:
219
- - - ">="
220
- - !ruby/object:Gem::Version
221
- version: "0"
222
- required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ! '>='
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
223
222
  none: false
224
- requirements:
225
- - - ">="
226
- - !ruby/object:Gem::Version
227
- version: "0"
223
+ requirements:
224
+ - - ! '>='
225
+ - !ruby/object:Gem::Version
226
+ version: '0'
228
227
  requirements: []
229
-
230
228
  rubyforge_project:
231
- rubygems_version: 1.8.10
229
+ rubygems_version: 1.8.15
232
230
  signing_key:
233
231
  specification_version: 3
234
232
  summary: mass spectrometry proteomics, lipidomics, and tools
235
233
  test_files: []
236
-
data/lib/ms/cvlist.rb DELETED
@@ -1,76 +0,0 @@
1
-
2
- require 'cv'
3
- require 'obo/ms'
4
- require 'obo/ims'
5
- require 'obo/unit'
6
-
7
- module MS
8
- module CV
9
- Obo = {
10
- 'MS' => Obo::MS.id_to_name,
11
- 'IMS' => Obo::IMS.id_to_name,
12
- 'UO' => Obo::Unit.id_to_name,
13
- }
14
-
15
- class Param < ::CV::Param
16
- # takes a variety of arguments (acc = accession):
17
- #
18
- # acc#
19
- # acc#, value
20
- # acc#, unit_acc# or CV::Param object
21
- # acc#, value, unit_acc# or CV::Param object
22
- # cvref, acc#, name
23
- # cvref, acc#, name, value
24
- # cvref, acc#, name, unit_acc# or CV::Param object
25
- # cvref, acc#, name, value, unit_acc# or CV::Param object
26
- def initialize(*args)
27
- @unit =
28
- if args.size > 1 && ((args.last.is_a?(::CV::Param) || args.last =~ /[A-Za-z]+:\d+/))
29
- unit_arg = args.pop
30
- unit_arg.is_a?(::CV::Param) ? unit_arg : self.class.new(unit_arg)
31
- end
32
- (@cv_ref, @accession, @name, @value) =
33
- case args.size
34
- when 1..2 # accession number (maybe with value)
35
- (obo_type, accnum) = args.first.split(':')
36
- [obo_type, args.first, MS::CV::Obo[obo_type][args.first], args[1]]
37
- when 3..4 # they have fully specified the object
38
- args
39
- end
40
- end
41
- end
42
- end
43
-
44
- # CVList.new( <CV::Param> )
45
- # CVList['MS:1000004', ['MS:1000004'], ['IMS:1000042', 23], param_obj, args]
46
- # CVList.new do
47
- # param MS:1000004
48
- # param MS:1000042, 23
49
- # end
50
- class CVList < Array
51
-
52
- # ensures that each argument is an argument that can be handled by
53
- # CV::Param. Returns the CVList object it creates
54
- def self.[](*args)
55
- list = self.new
56
- args.each do |arg|
57
- arg.is_a?(Array) ? list.param(*arg) : list.param(arg)
58
- end
59
- list
60
- end
61
-
62
- # takes a list of valid CV::Param objects, or they can be set in the block
63
- # using param
64
- def initialize(*args, &block)
65
- args.each {|arg| param(arg) }
66
- instance_eval &block if block
67
- end
68
-
69
- # if the first object is a MS::CV::Param it is just pushed onto the list,
70
- # otherwise the arguments are sent in to initialize a fresh MS::CV::Param,
71
- # and this object is pushed onto the list.
72
- def param(*args)
73
- push args.first.is_a?(::CV::Param) ? args.first : MS::CV::Param.new(*args)
74
- end
75
- end
76
- end