imzml 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/imzml/metadata/run/spectrum.rb +7 -35
- data/lib/imzml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c52da2783768c7aa8c665b2cee9fe78abc5d5b3a
|
4
|
+
data.tar.gz: 5cc44fda48e8f4098197b170fe48c4a1b369283d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 216c0b0d091f68511c0184130a89f01c9bd29228875c39f39927ac9ad5dc1dbd05fa577c3e63fb170c04b74e5f6d1760b138d14b7afc64a6928776e7146beef9
|
7
|
+
data.tar.gz: eb0f16e382adb599f20fdc949c16851d2778bf236103c5fc1fd701a867ec9910304504c6da55be3908ffc8a759771f8cd66b355f5080d3bdcdcfd28eb8680cea
|
@@ -36,8 +36,8 @@ module ImzML
|
|
36
36
|
# Binary values type [:int8, :int16, :int32, :int64, :float32, :float64]
|
37
37
|
attr_accessor :type
|
38
38
|
|
39
|
-
#
|
40
|
-
def data(cached =
|
39
|
+
# Grabs the actual binary data from disk
|
40
|
+
def data(cached = false)
|
41
41
|
|
42
42
|
# Return the data from the cache
|
43
43
|
return @cached_data if cached && !@cached_data.nil?
|
@@ -65,7 +65,11 @@ module ImzML
|
|
65
65
|
data = IO.binread(@filepath, @encoded_length.to_i, @offset.to_i).unpack("#{pattern}*")
|
66
66
|
|
67
67
|
# Save data only if user want's to cache it, saving take some CPU
|
68
|
-
|
68
|
+
if cached
|
69
|
+
@cached_data = data
|
70
|
+
else
|
71
|
+
data
|
72
|
+
end
|
69
73
|
end
|
70
74
|
|
71
75
|
private
|
@@ -91,38 +95,6 @@ module ImzML
|
|
91
95
|
# Represented by class BinaryData
|
92
96
|
attr_accessor :intensity_binary
|
93
97
|
|
94
|
-
def intensity(at, interval)
|
95
|
-
|
96
|
-
# read whole the binary data
|
97
|
-
mz_array = mz_binary.data
|
98
|
-
intensity_array = intensity_binary.data
|
99
|
-
|
100
|
-
default_from, default_to = mz_array.first, mz_array.first
|
101
|
-
|
102
|
-
from = default_from
|
103
|
-
to = default_to
|
104
|
-
|
105
|
-
# find designated intensity
|
106
|
-
if at
|
107
|
-
from = at - interval
|
108
|
-
from = default_from if from < 0
|
109
|
-
to = at + interval
|
110
|
-
to = default_to if to > mz_array.last
|
111
|
-
end
|
112
|
-
|
113
|
-
# find values in mz array
|
114
|
-
low_value = mz_array.bsearch { |x| x >= from }
|
115
|
-
low_index = mz_array.index(low_value)
|
116
|
-
high_value = mz_array.bsearch { |x| x >= to }
|
117
|
-
high_index = mz_array.index(high_value)
|
118
|
-
|
119
|
-
# sum all values in subarray
|
120
|
-
sum = intensity_array[low_index..high_index].inject{|sum, x| sum + x}
|
121
|
-
|
122
|
-
sum
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
98
|
end
|
127
99
|
|
128
100
|
end
|
data/lib/imzml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imzml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondra Beneš
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|