determinations_comparison 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a0f9ca9f006e31daea83ccdb02443074130871b
4
- data.tar.gz: 68658f42da8933ba16e841168918523928d18dd6
3
+ metadata.gz: 79959ff2127c7711cea316f073102ea1b989b535
4
+ data.tar.gz: 5ef63457ad94ad279643ed0c66588f8a4fa5900a
5
5
  SHA512:
6
- metadata.gz: 75bc295c243700be46a4007d4671db6a0f9f9cd47175eadb4841e064a9ecb9411b54bb2da15f7c3c2371a9a4d7dbb0006a56bd21565fbd0b3134d517db4ca874
7
- data.tar.gz: 063e2c27011dc96996b4f6ea5eed4e0775eaa035f793d2885e7b22cf99e00eedee80287fc9994e150064f4f617960f961e999cb9dc3ec771c971808f746afe5e
6
+ metadata.gz: 8a95afd74682cc4aa92c76ec1f67ab6e4f97dd623914a744f33cd3159fd5427e4a3fbfc3247ad9adf9fa36256156fa69c39f9bd1941a2c208c636fef1a6094e0
7
+ data.tar.gz: 386971b6139d45c32fc2ff55a968dcea2af31f423a3182d657c7a037eb1fbf5a145942d846c84753654b772978c1fb684aafb6549499a351293ca2bba120ad7f
@@ -150,58 +150,65 @@ module DeterminationsComparison
150
150
 
151
151
  hashCategory = Hash.new
152
152
 
153
+ # peak picked by baseline and not undertest?
154
+ arr = Array.new
153
155
  @hashDiffs.each_pair do |chrom,hashChrom|
154
156
 
155
- # peak picked by baseline and not undertest?
157
+ hash = Hash.new
158
+
156
159
  if hashChrom['peak_picked'] == 'by baseline but not by undertest'
157
- hashCategory[:desc] = "peak picked #{hashChrom['peak_picked']}"
160
+ hash[:desc] = "peak picked #{hashChrom['peak_picked']}"
161
+ hash[:chrom] = chrom.to_s
162
+ hash[:per_diff] = 100 # temporarily using per_diff for a severity level
163
+ arr << hash
158
164
  end
159
165
 
160
- break unless hashCategory.empty?
166
+ break unless arr.empty?
161
167
 
162
168
  if hashChrom['peak_picked'] == 'by baseline (simpsons rule) but not by undertest'
163
- hashCategory[:desc] = "peak picked #{hashChrom['peak_picked']}"
169
+ hash[:desc] = "peak picked #{hashChrom['peak_picked']}"
170
+ hash[:chrom] = chrom.to_s
171
+ hash[:per_diff] = 50
172
+ arr << hash
164
173
  end
165
174
 
166
- break unless hashCategory.empty?
175
+ end
167
176
 
168
- # area within threshold?
169
- per_diff = hashChrom['peak']['area'][:percent_diff]
170
- threshold = hashPropertyThresholds[:area]
171
- if per_diff > threshold
172
- hashCategory[:desc] = 'difference in area'
173
- hashCategory[:per_diff] = per_diff
174
- end
177
+ unless arr.empty?
178
+ arr.sort_by! { |h| h[:per_diff] }
179
+ arr.first.delete(:per_diff)
180
+ return arr.first
181
+ end
175
182
 
176
- break unless hashCategory.empty?
177
183
 
178
- # apex time within threshold
179
- per_diff = hashChrom['peak']['apex_time'][:percent_diff]
180
- threshold = hashPropertyThresholds[:apex_time]
181
- if per_diff > threshold
182
- hashCategory[:desc] = 'difference in apex_time'
183
- hashCategory[:per_diff] = per_diff
184
- end
184
+ # area, apex_time, apex_intensity within threshold?
185
+ [:area,:apex_time,:apex_intensity].each do |prop|
186
+
187
+ arr = Array.new
188
+ @hashDiffs.each_pair do |chrom,hashChrom|
185
189
 
186
- break unless hashCategory.empty?
190
+ hash = Hash.new
191
+
192
+ per_diff = hashChrom['peak'][prop.to_s][:percent_diff]
193
+ threshold = hashPropertyThresholds[prop]
194
+
195
+ if per_diff > threshold
196
+ hash[:desc] = "difference in #{prop.to_s}"
197
+ hash[:per_diff] = per_diff
198
+ end
187
199
 
188
- # apex intensity within threshould
189
- per_diff = hashChrom['peak']['apex_intensity'][:percent_diff]
190
- threshold = hashPropertyThresholds[:apex_intensity]
191
- if per_diff > threshold
192
- hashCategory[:desc] = 'difference in apex_intensity'
193
- hashCategory[:per_diff] = per_diff
194
200
  end
195
201
 
196
- break unless hashCategory.empty?
202
+ unless arr.empty?
203
+ arr.sort_by! { |h| h[:per_diff] }.reverse
204
+ return arr.first
205
+ end
197
206
 
198
207
  end
199
208
 
200
- if hashCategory.empty?
201
- hashCategory[:desc] = 'match within thresholds'
202
- end
209
+ hash[:desc] = 'match within thresholds'
203
210
 
204
- return hashCategory
211
+ return hash
205
212
 
206
213
  end
207
214
 
@@ -1,3 +1,3 @@
1
1
  module DeterminationsComparison
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: determinations_comparison
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Hooper