ms-in_silico 0.1.0 → 0.2.0

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 (2) hide show
  1. data/lib/ms/in_silico/spectrum.rb +11 -4
  2. metadata +3 -3
@@ -112,6 +112,9 @@ module Ms
112
112
  # hash of (residue, locations) pairs which indicate the
113
113
  # indicies at which the residue occurs in sequence. The
114
114
  # ladder corresponds to the M values described above.
115
+ # Characters in the sequence that do not add mass, such
116
+ # as whitespace, are skipped and do not add an entry to
117
+ # the ladder.
115
118
  #
116
119
  # Returns [ladder, {residue => locations}].
117
120
  #
@@ -132,10 +135,14 @@ module Ms
132
135
  mass = 0
133
136
  ladder = []
134
137
  sequence.each_byte do |byte|
135
- mass += masses_by_byte[byte]
136
- location = locations[byte]
137
-
138
- location << ladder.length if location
138
+ # check a mass is added... if not (as for whitespace)
139
+ # then skip to the next byte
140
+ next if (mass == (mass += masses_by_byte[byte]))
141
+
142
+ if location = locations[byte]
143
+ location << ladder.length
144
+ end
145
+
139
146
  ladder << mass
140
147
  end
141
148
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms-in_silico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-20 00:00:00 -07:00
12
+ date: 2008-12-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements: []
73
73
 
74
74
  rubyforge_project: mspire
75
- rubygems_version: 1.3.0
75
+ rubygems_version: 1.3.1
76
76
  signing_key:
77
77
  specification_version: 2
78
78
  summary: ms-in_silico task library