ms-core 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/io/bookmark.rb +13 -0
  3. data/lib/ms/mass/aa.rb +78 -85
  4. metadata +4 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.14
1
+ 0.0.16
@@ -0,0 +1,13 @@
1
+
2
+ class IO
3
+ # saves the position and returns to it after the block
4
+ # is executed. Returns the block's reply. if rewind, io.rewind is called
5
+ # before handing the io object to the block.
6
+ def bookmark(rewind=false, &block)
7
+ start = self.pos
8
+ self.rewind if rewind
9
+ reply = block.call(self)
10
+ self.pos = start
11
+ reply
12
+ end
13
+ end
data/lib/ms/mass/aa.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'yaml'
2
-
3
1
  require 'ms/mass'
4
2
 
5
3
  module Ms
@@ -26,87 +24,82 @@ module Ms
26
24
  # library for more serious work with masses.
27
25
  module AA
28
26
 
29
- yaml = <<-END
30
- ---
31
- avg:
32
- "*": 118.88603
33
- A: 71.0779
34
- B: 172.1405
35
- C: 103.1429
36
- D: 115.0874
37
- E: 129.11398
38
- F: 147.17386
39
- G: 57.05132
40
- H: 137.13928
41
- I: 113.15764
42
- K: 128.17228
43
- L: 113.15764
44
- M: 131.19606
45
- N: 114.10264
46
- O: 211.28076
47
- P: 97.11518
48
- Q: 128.12922
49
- R: 156.18568
50
- S: 87.0773
51
- T: 101.10388
52
- U: 150.0379
53
- V: 99.13106
54
- W: 186.2099
55
- X: 118.88603
56
- Y: 163.17326
57
- Z: 128.6231
58
- mono:
59
- "*": 118.805716
60
- A: 71.0371137878
61
- B: 172.048405
62
- C: 103.0091844778
63
- D: 115.026943032
64
- E: 129.0425930962
65
- F: 147.0684139162
66
- G: 57.0214637236
67
- H: 137.0589118624
68
- I: 113.0840639804
69
- K: 128.0949630177
70
- L: 113.0840639804
71
- M: 131.0404846062
72
- N: 114.0429274472
73
- O: 211.1446528645
74
- P: 97.052763852
75
- Q: 128.0585775114
76
- R: 156.1011110281
77
- S: 87.0320284099
78
- T: 101.0476784741
79
- U: 150.9536355878
80
- V: 99.0684139162
81
- W: 186.0793129535
82
- X: 118.805716
83
- Y: 163.0633285383
84
- Z: 128.550585
85
- END
86
-
87
-
88
- embedded_mass_hashes = YAML.load(yaml)
89
- # amino_acids keys as strings, monoisotopic masses
90
- MONO_STRING = embedded_mass_hashes['mono']
91
- # amino_acids keys as symbols, monoisotopic masses
92
- MONO_SYM = Hash[MONO_STRING.map {|aa,mass| [aa.to_sym, mass] } ]
93
-
94
27
  # amino_acids keys as strings, average masses
95
- AVG_STRING = embedded_mass_hashes['avg']
96
- # amino_acids keys as symbols, average masses
97
- AVG_SYM = Hash[AVG_STRING.map {|aa,mass| [aa.to_sym, mass] } ]
98
-
99
- # Monoisotopic amino acid masses keyed as symbols and also strings (all
100
- # upper case). Also includes Ms::Mass::MONO for things like protons ('h+')
101
- MONO = MONO_SYM.merge(MONO_STRING).merge(Ms::Mass::MONO)
102
- # Average amino acid masses keyed as symbols and also strings (all
103
- # uppder case). Also includes Ms::Mass::AVG for things like protons ('h+')
104
- AVG = AVG_SYM.merge(AVG_STRING).merge(Ms::Mass::AVG)
105
-
106
- ###########################################################################
107
- # This section is broken in 1.9 (ruby-units fault), so we generate the
108
- # data and include it.
109
- ###########################################################################
28
+ AVG_STRING = {
29
+ "*"=>118.88603,
30
+ "A"=>71.0779,
31
+ "B"=>172.1405,
32
+ "C"=>103.1429,
33
+ "D"=>115.0874,
34
+ "E"=>129.11398,
35
+ "F"=>147.17386,
36
+ "G"=>57.05132,
37
+ "H"=>137.13928,
38
+ "I"=>113.15764,
39
+ "K"=>128.17228,
40
+ "L"=>113.15764,
41
+ "M"=>131.19606,
42
+ "N"=>114.10264,
43
+ "O"=>211.28076,
44
+ "P"=>97.11518,
45
+ "Q"=>128.12922,
46
+ "R"=>156.18568,
47
+ "S"=>87.0773,
48
+ "T"=>101.10388,
49
+ "U"=>150.0379,
50
+ "V"=>99.13106,
51
+ "W"=>186.2099,
52
+ "X"=>118.88603,
53
+ "Y"=>163.17326,
54
+ "Z"=>128.6231
55
+ }
56
+ # amino_acids keys as strings, monoisotopic masses
57
+ MONO_STRING = {
58
+ "*"=>118.805716,
59
+ "A"=>71.0371137878,
60
+ "B"=>172.048405,
61
+ "C"=>103.0091844778,
62
+ "D"=>115.026943032,
63
+ "E"=>129.0425930962,
64
+ "F"=>147.0684139162,
65
+ "G"=>57.0214637236,
66
+ "H"=>137.0589118624,
67
+ "I"=>113.0840639804,
68
+ "K"=>128.0949630177,
69
+ "L"=>113.0840639804,
70
+ "M"=>131.0404846062,
71
+ "N"=>114.0429274472,
72
+ "O"=>211.1446528645,
73
+ "P"=>97.052763852,
74
+ "Q"=>128.0585775114,
75
+ "R"=>156.1011110281,
76
+ "S"=>87.0320284099,
77
+ "T"=>101.0476784741,
78
+ "U"=>150.9536355878,
79
+ "V"=>99.0684139162,
80
+ "W"=>186.0793129535,
81
+ "X"=>118.805716,
82
+ "Y"=>163.0633285383,
83
+ "Z"=>128.550585}
84
+ }
85
+
86
+ # amino_acids keys as symbols, monoisotopic masses
87
+ MONO_SYM = Hash[MONO_STRING.map {|aa,mass| [aa.to_sym, mass] } ]
88
+
89
+ # amino_acids keys as symbols, average masses
90
+ AVG_SYM = Hash[AVG_STRING.map {|aa,mass| [aa.to_sym, mass] } ]
91
+
92
+ # Monoisotopic amino acid masses keyed as symbols and also strings (all
93
+ # upper case). Also includes Ms::Mass::MONO for things like protons ('h+')
94
+ MONO = MONO_SYM.merge(MONO_STRING).merge(Ms::Mass::MONO)
95
+ # Average amino acid masses keyed as symbols and also strings (all
96
+ # uppder case). Also includes Ms::Mass::AVG for things like protons ('h+')
97
+ AVG = AVG_SYM.merge(AVG_STRING).merge(Ms::Mass::AVG)
98
+
99
+ ###########################################################################
100
+ # This section is broken in 1.9 (ruby-units fault), so we generate the
101
+ # data and include it.
102
+ ###########################################################################
110
103
 
111
104
  =begin
112
105
  # These are included here to offer maximum functionality
@@ -172,9 +165,9 @@ module Ms
172
165
 
173
166
  =end
174
167
 
175
- ###########################################################################
176
- # End fudge
177
- ###########################################################################
168
+ ###########################################################################
169
+ # End fudge
170
+ ###########################################################################
178
171
 
179
172
  end
180
173
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 14
9
- version: 0.0.14
8
+ - 16
9
+ version: 0.0.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - John T. Prince
@@ -108,6 +108,7 @@ files:
108
108
  - lib/cv.rb
109
109
  - lib/cv/description.rb
110
110
  - lib/cv/param.rb
111
+ - lib/io/bookmark.rb
111
112
  - lib/ms.rb
112
113
  - lib/ms/calc.rb
113
114
  - lib/ms/data.rb
@@ -143,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
144
  requirements:
144
145
  - - ">="
145
146
  - !ruby/object:Gem::Version
146
- hash: 1895205922860773162
147
+ hash: 4415238762267398352
147
148
  segments:
148
149
  - 0
149
150
  version: "0"